Skip to content

Commit 31a2bc7

Browse files
hamishknightjrose-apple
authored andcommitted
[IRGen] Always get the CanType of a conformance's contextual type (#14928)
The conformance type's contextual type might not be canonical, such as in the case of substituting a `typealias` type for a generic placeholder, so ensure we get the canonical type for the conformance.
1 parent 2380950 commit 31a2bc7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,8 @@ class AccessorConformanceInfo : public ConformanceInfo {
12101210
ConcreteType(SILWT->getConformance()->getDeclContext()
12111211
->mapTypeIntoContext(
12121212
SILWT->getConformance()->getType()
1213-
->getCanonicalType())),
1213+
->getCanonicalType())
1214+
->getCanonicalType()),
12141215
Conformance(*SILWT->getConformance()),
12151216
SILEntries(SILWT->getEntries()),
12161217
SILConditionalConformances(SILWT->getConditionalConformances()),

test/Inputs/conditional_conformance_basic_conformances.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,3 +323,11 @@ public func double_concrete_concrete() {
323323
func dynamicCastToP1(_ value: Any) -> P1? {
324324
return value as? P1
325325
}
326+
327+
protocol P4 {}
328+
typealias P4Typealias = P4
329+
protocol P5 {}
330+
331+
struct SR7101<T> {}
332+
extension SR7101 : P5 where T == P4Typealias {}
333+

0 commit comments

Comments
 (0)