mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
LoadableByAddress: Fix shouldTransformYields to use substituted types
rdar://149281263 issues/80818
This commit is contained in:
@@ -375,12 +375,14 @@ static bool modResultType(SILFunction *F, irgen::IRGenModule &Mod,
|
||||
static bool shouldTransformYields(GenericEnvironment *genEnv,
|
||||
CanSILFunctionType loweredTy,
|
||||
irgen::IRGenModule &Mod,
|
||||
LargeSILTypeMapper &Mapper) {
|
||||
LargeSILTypeMapper &Mapper,
|
||||
TypeExpansionContext expansion) {
|
||||
if (!modifiableFunction(loweredTy)) {
|
||||
return false;
|
||||
}
|
||||
for (auto &yield : loweredTy->getYields()) {
|
||||
auto yieldStorageType = yield.getSILStorageInterfaceType();
|
||||
auto yieldStorageType = yield.getSILStorageType(Mod.getSILModule(),
|
||||
loweredTy, expansion);
|
||||
auto newYieldStorageType =
|
||||
Mapper.getNewSILType(genEnv, yieldStorageType, Mod);
|
||||
if (yieldStorageType != newYieldStorageType)
|
||||
@@ -394,7 +396,8 @@ static bool modYieldType(SILFunction *F, irgen::IRGenModule &Mod,
|
||||
GenericEnvironment *genEnv = getSubstGenericEnvironment(F);
|
||||
auto loweredTy = F->getLoweredFunctionType();
|
||||
|
||||
return shouldTransformYields(genEnv, loweredTy, Mod, Mapper);
|
||||
return shouldTransformYields(genEnv, loweredTy, Mod, Mapper,
|
||||
F->getTypeExpansionContext());
|
||||
}
|
||||
|
||||
SILParameterInfo LargeSILTypeMapper::getNewParameter(GenericEnvironment *env,
|
||||
|
||||
@@ -30,3 +30,30 @@ public class Test {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// So did this test case.
|
||||
enum E {
|
||||
case a
|
||||
}
|
||||
|
||||
protocol P {
|
||||
associatedtype A
|
||||
typealias S = C<A>.S
|
||||
|
||||
var v: E { get set }
|
||||
|
||||
var v2: (t: Int, i: S)? { get set }
|
||||
}
|
||||
|
||||
class C<A> {
|
||||
struct S { }
|
||||
|
||||
init(_: ClosedRange<Double>) { }
|
||||
}
|
||||
|
||||
class C2<T>: P {
|
||||
typealias A = T
|
||||
var v: E = .a
|
||||
|
||||
var v2: (t: Int, i: S)?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user