Skip to content

Commit e78d734

Browse files
authored
Merge pull request #82447 from slavapestov/fix-rdar152509409-6.2
[6.2] AST: Tweak ConformanceLookupTable::compareConformances() some more
2 parents b8d0749 + e5af49a commit e78d734

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lib/AST/ConformanceLookupTable.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,10 @@ ConformanceLookupTable::Ordering ConformanceLookupTable::compareConformances(
615615
rhs->getDeclContext()->isAlwaysAvailableConformanceContext()) {
616616
// Diagnose conflicting marker protocol conformances that differ in
617617
// un-availability.
618-
diagnoseSuperseded = (lhs->getProtocol()->isMarkerProtocol() &&
619-
isUnavailable(lhs->getDeclContext()) !=
620-
isUnavailable(rhs->getDeclContext()));
618+
diagnoseSuperseded =
619+
(lhs->getProtocol()->isMarkerProtocol() &&
620+
isUnavailable(lhs->getDeclContext()) != isUnavailable(rhs->getDeclContext()) &&
621+
(lhsKind != ConformanceEntryKind::Implied || rhsKind != ConformanceEntryKind::Implied));
621622

622623
return (lhs->getDeclContext()->isAlwaysAvailableConformanceContext()
623624
? Ordering::Before

test/Sema/conformance_availability_implied.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,12 @@ extension Conformer2: Derived1 {
5757
extension Conformer2: Derived2 {
5858
func f() {} // expected-note {{'f()' declared here}}
5959
}
60+
61+
protocol P: MarkerBase {}
62+
63+
struct Conformer3: P {}
64+
65+
@available(*, unavailable)
66+
extension Conformer3: MarkerDerived1 {}
67+
68+
takesMarkerBase(Conformer3.self)

0 commit comments

Comments
 (0)