mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Mark decls that can never be cross-referenced (#17223)
This allows us to filter them out in cases that would otherwise be ambiguous. The particular prompting situation looks a lot like the test case: a protocol, plus a forward-declared class with the same name. (Normally we ignore forward-declared classes, but SourceKit's module interface generation feature makes dummy ClassDecls for them instead.) https://bugs.swift.org/browse/SR-4851
This commit is contained in:
@@ -603,6 +603,10 @@ DeclID Serializer::addDeclRef(const Decl *D, bool forceSerialization,
|
||||
isa<PrecedenceGroupDecl>(D)) &&
|
||||
"cannot cross-reference this decl");
|
||||
|
||||
assert((!isDeclXRef(D) ||
|
||||
!D->getAttrs().hasAttribute<ForbidSerializingReferenceAttr>()) &&
|
||||
"cannot cross-reference this decl");
|
||||
|
||||
assert((allowTypeAliasXRef || !isa<TypeAliasDecl>(D) ||
|
||||
D->getModuleContext() == M) &&
|
||||
"cannot cross-reference typealiases directly (use the NameAliasType)");
|
||||
|
||||
Reference in New Issue
Block a user