AST: Replace GenericSignature::createGenericEnvironment() with getGenericEnvironment()

This memoizes the result, which is fine for all callers; the only
exception is open existential types where each new open existential
now explicitly gets a unique generic environment, allocated by
calling GenericEnvironment::getIncomplete().
This commit is contained in:
Slava Pestov
2019-09-05 00:02:02 -04:00
parent e9bcd00bc2
commit 1e94466bcc
19 changed files with 42 additions and 36 deletions

View File

@@ -943,7 +943,7 @@ ModuleFile::getGenericSignatureOrEnvironment(
if (wantEnvironment)
if (auto *sig = sigOrEnvOrOffset.get().dyn_cast<GenericSignature *>())
sigOrEnvOrOffset.uncheckedOverwrite(sig->createGenericEnvironment());
sigOrEnvOrOffset.uncheckedOverwrite(sig->getGenericEnvironment());
return sigOrEnvOrOffset.get();
}