mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Recover if a typealias's underlying type is broken (#12979)
We could handle a typealias itself disappearing, but not if the typealias was okay but the underlying type wasn't. This came up in real Swift 3/4 mix-and-match code. rdar://problem/34940079
This commit is contained in:
@@ -2514,11 +2514,22 @@ ModuleFile::getDeclCheckedImpl(DeclID DID, Optional<DeclContext *> ForcedContext
|
||||
bool isImplicit;
|
||||
GenericEnvironmentID genericEnvID;
|
||||
uint8_t rawAccessLevel;
|
||||
ArrayRef<uint64_t> dependencyIDs;
|
||||
|
||||
decls_block::TypeAliasLayout::readRecord(scratch, nameID, contextID,
|
||||
underlyingTypeID, interfaceTypeID,
|
||||
isImplicit, genericEnvID,
|
||||
rawAccessLevel);
|
||||
rawAccessLevel, dependencyIDs);
|
||||
|
||||
Identifier name = getIdentifier(nameID);
|
||||
|
||||
for (TypeID dependencyID : dependencyIDs) {
|
||||
auto dependency = getTypeChecked(dependencyID);
|
||||
if (!dependency) {
|
||||
return llvm::make_error<TypeError>(
|
||||
name, takeErrorInfo(dependency.takeError()));
|
||||
}
|
||||
}
|
||||
|
||||
auto DC = ForcedContext ? *ForcedContext : getDeclContext(contextID);
|
||||
|
||||
@@ -2526,8 +2537,7 @@ ModuleFile::getDeclCheckedImpl(DeclID DID, Optional<DeclContext *> ForcedContext
|
||||
if (declOrOffset.isComplete())
|
||||
return declOrOffset;
|
||||
|
||||
auto alias = createDecl<TypeAliasDecl>(SourceLoc(), SourceLoc(),
|
||||
getIdentifier(nameID),
|
||||
auto alias = createDecl<TypeAliasDecl>(SourceLoc(), SourceLoc(), name,
|
||||
SourceLoc(), genericParams, DC);
|
||||
declOrOffset = alias;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user