mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Make sure we don't provide duplicate synthesized conformance table entries.
This was benign with `Sendable`, but is not benign for the `Encodable` and `Decodable` synthesis for distributed actors, which results in a crash in TBD generation. Fixes rdar://92008955.
This commit is contained in:
@@ -1532,8 +1532,16 @@ IterableDeclContext::getLocalConformances(ConformanceLookupKind lookupKind)
|
||||
// Look for a Sendable conformance globally. If it is synthesized
|
||||
// and matches this declaration context, use it.
|
||||
auto dc = getAsGenericContext();
|
||||
|
||||
SmallPtrSet<ProtocolConformance *, 4> known;
|
||||
for (auto conformance : findSynthesizedConformances(dc)) {
|
||||
result.push_back(conformance);
|
||||
// Compute the known set of conformances for the first time.
|
||||
if (known.empty()) {
|
||||
known.insert(result.begin(), result.end());
|
||||
}
|
||||
|
||||
if (known.insert(conformance).second)
|
||||
result.push_back(conformance);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user