Skip to content

Commit aa0dc1a

Browse files
committed
IRGen: Fix typo in MetadataPath::followComponent()
This is a regression from a recent change, where I meant to write dyn_cast<> instead of cast<>.
1 parent 6ee74b3 commit aa0dc1a

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2666,7 +2666,7 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
26662666
CanType baseSubstType =
26672667
sourceConformance.getAssociatedType(sourceType, depMemType.getBase())
26682668
->getCanonicalType();
2669-
if (auto archetypeType = cast<ArchetypeType>(baseSubstType)) {
2669+
if (auto archetypeType = dyn_cast<ArchetypeType>(baseSubstType)) {
26702670
AssociatedType baseAssocType(depMemType->getAssocType());
26712671

26722672
MetadataResponse response =

test/Generics/rdar83894546_2.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// RUN: %target-typecheck-verify-swift
2+
// RUN: %target-swift-frontend -emit-ir %s
3+
4+
public struct G<A : P7> : P2 {}
5+
6+
public protocol P1 {
7+
associatedtype A
8+
}
9+
10+
public protocol P2: P1 where A: P7 {}
11+
12+
public protocol P3 {
13+
associatedtype B: P1 where B.A == A
14+
associatedtype A: P7
15+
}
16+
17+
public protocol P4: P3 where B == G<A> { }
18+
19+
public protocol P5 : P3 {
20+
associatedtype C: P3 where C.A == A
21+
}
22+
23+
public protocol P6 : P5 where B == G<A>, C: P4 {}
24+
25+
public protocol P7 {
26+
associatedtype D: P1 where D.A == Self
27+
}
28+
29+
public protocol P8 {
30+
associatedtype E: P5 where E.C.B: P2
31+
associatedtype F: P4 where F.A == E.A
32+
}
33+
34+
public protocol P9 : P8 where E.C == F, E: P6 {}
35+
36+
public func callee<T : P1>(_: T.Type) -> T {
37+
fatalError()
38+
}
39+
40+
public func callee<T : P9>(_: T) {
41+
_ = callee(T.F.A.D.self)
42+
}

0 commit comments

Comments
 (0)