mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Distinguish between protocol/extension for types too. (#7794)
Replace an existing flag for cross-references to member types (that wasn't getting much use) with one consistent with how we lookup values. This fixes the case where someone actually has a useful type as a member of a protocol extension, and that type gets referenced in another module; Dispatch does exactly this. Because you can currently only define typealiases in protocol extensions, not new types, there's always a workaround for someone hitting this issue: just use the underlying type. https://bugs.swift.org/browse/SR-4076
This commit is contained in:
@@ -1803,18 +1803,17 @@ void Serializer::writeCrossReference(const Decl *D) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool isProtocolExt = D->getDeclContext()->getAsProtocolExtensionContext();
|
||||
if (auto type = dyn_cast<TypeDecl>(D)) {
|
||||
abbrCode = DeclTypeAbbrCodes[XRefTypePathPieceLayout::Code];
|
||||
XRefTypePathPieceLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addIdentifierRef(type->getName()),
|
||||
isa<ProtocolDecl>(
|
||||
type->getDeclContext()));
|
||||
isProtocolExt);
|
||||
return;
|
||||
}
|
||||
|
||||
auto val = cast<ValueDecl>(D);
|
||||
auto ty = val->getInterfaceType()->getCanonicalType();
|
||||
bool isProtocolExt = D->getDeclContext()->getAsProtocolExtensionContext();
|
||||
abbrCode = DeclTypeAbbrCodes[XRefValuePathPieceLayout::Code];
|
||||
XRefValuePathPieceLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addTypeRef(ty),
|
||||
|
||||
Reference in New Issue
Block a user