Skip to content

Commit ab2a799

Browse files
authored
Merge pull request swiftlang#39700 from slavapestov/two-rqm-fixes
RequirementMachine: Fix a couple of minor problems
2 parents 67d48a3 + aa0dc1a commit ab2a799

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ namespace swift {
475475

476476
/// Maximum iteration count for requirement machine confluent completion
477477
/// algorithm.
478-
unsigned RequirementMachineStepLimit = 2000;
478+
unsigned RequirementMachineStepLimit = 4000;
479479

480480
/// Maximum term length for requirement machine confluent completion
481481
/// algorithm.

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)