Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/IRGen/LoadableByAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down
27 changes: 27 additions & 0 deletions test/IRGen/loadable_by_address.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
}