mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
This commit is contained in:
@@ -920,7 +920,7 @@ void SILModule::performOnceForPrespecializedImportedExtensions(
|
||||
SmallVector<ModuleDecl *, 8> importedModules;
|
||||
// Add the Swift module.
|
||||
if (!isStdlibModule()) {
|
||||
auto *SwiftStdlib = getASTContext().getStdlibModule(true);
|
||||
auto *SwiftStdlib = getASTContext().getStdlibModule();
|
||||
if (SwiftStdlib)
|
||||
importedModules.push_back(SwiftStdlib);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user