mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST/Serialization: Some assertions for extensions
These helped me rule out my first theory about another bug, even though it turned out to be unrelated.
This commit is contained in:
@@ -1675,6 +1675,7 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
|
||||
case DeclContextKind::ExtensionDecl: {
|
||||
auto ext = cast<ExtensionDecl>(DC);
|
||||
Type baseTy = ext->getExtendedType();
|
||||
assert(!baseTy->hasUnboundGenericType());
|
||||
writeCrossReference(baseTy->getAnyNominal(), pathLen + 1);
|
||||
|
||||
abbrCode = DeclTypeAbbrCodes[XRefExtensionPathPieceLayout::Code];
|
||||
@@ -2424,6 +2425,7 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
|
||||
auto contextID = addDeclContextRef(extension->getDeclContext());
|
||||
Type baseTy = extension->getExtendedType();
|
||||
assert(!baseTy->hasUnboundGenericType());
|
||||
|
||||
// FIXME: Use the canonical type here in order to minimize circularity
|
||||
// issues at deserialization time. A known problematic case here is
|
||||
@@ -4430,6 +4432,7 @@ void Serializer::writeAST(ModuleOrSourceFile DC,
|
||||
.push_back({ getKindForTable(D), addDeclRef(D) });
|
||||
} else if (auto ED = dyn_cast<ExtensionDecl>(D)) {
|
||||
Type extendedTy = ED->getExtendedType();
|
||||
assert(!extendedTy->hasUnboundGenericType());
|
||||
const NominalTypeDecl *extendedNominal = extendedTy->getAnyNominal();
|
||||
extensionDecls[extendedNominal->getName()]
|
||||
.push_back({ extendedNominal, addDeclRef(D) });
|
||||
|
||||
Reference in New Issue
Block a user