Skip to content

Commit 53ab300

Browse files
committed
GSB: Fix maybeResolveEquivalenceClass() with member type of concrete type
Fixes <rdar://problem/55401811>, <https://bugs.swift.org/browse/SR-11475>.
1 parent b73b7c2 commit 53ab300

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3659,8 +3659,14 @@ ResolvedType GenericSignatureBuilder::maybeResolveEquivalenceClass(
36593659
// Check whether this associated type references a protocol to which
36603660
// the base conforms. If not, it's unresolved.
36613661
if (baseEquivClass->conformsTo.find(assocType->getProtocol())
3662-
== baseEquivClass->conformsTo.end())
3663-
return ResolvedType::forUnresolved(baseEquivClass);
3662+
== baseEquivClass->conformsTo.end()) {
3663+
if (!baseEquivClass->concreteType ||
3664+
!lookupConformance(type->getCanonicalType(),
3665+
baseEquivClass->concreteType,
3666+
assocType->getProtocol())) {
3667+
return ResolvedType::forUnresolved(baseEquivClass);
3668+
}
3669+
}
36643670

36653671
nestedTypeDecl = assocType;
36663672
} else {

test/SILGen/fully-concrete-extension-of-generic.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ func exerciseInits(which: Bool) -> C<Int> {
1717
return C(forInt: ())
1818
}
1919
}
20+
21+
protocol P {
22+
associatedtype T
23+
}
24+
25+
struct S : P {
26+
typealias T = Int
27+
}
28+
29+
struct G<T : P> {}
30+
31+
extension G where T == S {
32+
func foo(_: T.T) {}
33+
}

0 commit comments

Comments
 (0)