mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Drop inherited conformances on classes (#23347)
These can be recreated if needed in a client library. To do this, I've added a new ConformanceLookupKind::NonInherited, which can also be used elsewhere in the project where we're already filtering out inherited conformances some other way. Note that this doesn't drop inherited conformances from the entire serialized interface, just from the list that a class explicitly declares. They still get referenced sometimes. rdar://problem/50541451 and possibly others
This commit is contained in:
@@ -989,10 +989,30 @@ void ConformanceLookupTable::lookupConformances(
|
||||
return true;
|
||||
|
||||
// If we are to filter out this result, do so now.
|
||||
if (lookupKind == ConformanceLookupKind::OnlyExplicit &&
|
||||
entry->getKind() != ConformanceEntryKind::Explicit &&
|
||||
entry->getKind() != ConformanceEntryKind::Synthesized)
|
||||
return false;
|
||||
switch (lookupKind) {
|
||||
case ConformanceLookupKind::OnlyExplicit:
|
||||
switch (entry->getKind()) {
|
||||
case ConformanceEntryKind::Explicit:
|
||||
case ConformanceEntryKind::Synthesized:
|
||||
break;
|
||||
case ConformanceEntryKind::Implied:
|
||||
case ConformanceEntryKind::Inherited:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ConformanceLookupKind::NonInherited:
|
||||
switch (entry->getKind()) {
|
||||
case ConformanceEntryKind::Explicit:
|
||||
case ConformanceEntryKind::Synthesized:
|
||||
case ConformanceEntryKind::Implied:
|
||||
break;
|
||||
case ConformanceEntryKind::Inherited:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ConformanceLookupKind::All:
|
||||
break;
|
||||
}
|
||||
|
||||
// Record the protocol.
|
||||
if (protocols)
|
||||
|
||||
Reference in New Issue
Block a user