Skip to content

Commit cf4832e

Browse files
committed
Prespecialize standard library only if it is loaded
We currently load it for prespecialization when it wasn't loaded initially. This causes an inadvertant issue for invertible protocols. When we don’t have the stdlib loaded initially, we “synthesize” the invertible protocol from the Builtin module by creating a new `ProtocolDecl*` and stashing it on the `ASTContext`. If the stdlib gets loaded later, deserialized stdlib types conform to the deserialized `Escapable` protocol which has a different `ProtocolDecl *` pointer for `Escapable`. So queries like `conformsToInvertible` fail because they are using the wrong `ProtocolDecl*` for `Copyable`/`Escapable` while looking up the ConformanceTable.
1 parent 827caa9 commit cf4832e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SIL/IR/SILModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ void SILModule::performOnceForPrespecializedImportedExtensions(
920920
SmallVector<ModuleDecl *, 8> importedModules;
921921
// Add the Swift module.
922922
if (!isStdlibModule()) {
923-
auto *SwiftStdlib = getASTContext().getStdlibModule(true);
923+
auto *SwiftStdlib = getASTContext().getStdlibModule();
924924
if (SwiftStdlib)
925925
importedModules.push_back(SwiftStdlib);
926926
}

0 commit comments

Comments
 (0)