SILGen: Allow static stored properties in fully-concrete extensions of generic types.

There's no need for per-instantiation storage in this case, so we can relax the implementation limitation for them.
This commit is contained in:
Joe Groff
2017-02-24 14:55:56 -08:00
parent 73b1df31f5
commit 886c83f6e7
6 changed files with 39 additions and 17 deletions

View File

@@ -201,8 +201,11 @@ void SILGenModule::emitGlobalInitialization(PatternBindingDecl *pd,
unsigned pbdEntry) {
// Generic and dynamic static properties require lazy initialization, which
// isn't implemented yet.
if (pd->isStatic())
assert(!pd->getDeclContext()->isGenericContext());
if (pd->isStatic()) {
assert(!pd->getDeclContext()->isGenericContext()
|| pd->getDeclContext()->getGenericSignatureOfContext()
->areAllParamsConcrete());
}
// Emit the lazy initialization token for the initialization expression.
auto counter = anonymousSymbolCounter++;
@@ -248,7 +251,7 @@ void SILGenModule::emitGlobalInitialization(PatternBindingDecl *pd,
NewMangling::ASTMangler NewMangler;
std::string New = NewMangler.mangleGlobalInit(varDecl, counter, true);
onceFuncBuffer = NewMangling::selectMangling(Old, New);
}
}
SILFunction *onceFunc = emitLazyGlobalInitializer(onceFuncBuffer, pd,
pbdEntry);