Skip to content

Commit

Permalink
Merge pull request swiftlang#39700 from slavapestov/two-rqm-fixes
Browse files Browse the repository at this point in the history
RequirementMachine: Fix a couple of minor problems
  • Loading branch information
slavapestov authored Oct 12, 2021
2 parents 67d48a3 + aa0dc1a commit ab2a799
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ namespace swift {

/// Maximum iteration count for requirement machine confluent completion
/// algorithm.
unsigned RequirementMachineStepLimit = 2000;
unsigned RequirementMachineStepLimit = 4000;

/// Maximum term length for requirement machine confluent completion
/// algorithm.
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenProto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2666,7 +2666,7 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
CanType baseSubstType =
sourceConformance.getAssociatedType(sourceType, depMemType.getBase())
->getCanonicalType();
if (auto archetypeType = cast<ArchetypeType>(baseSubstType)) {
if (auto archetypeType = dyn_cast<ArchetypeType>(baseSubstType)) {
AssociatedType baseAssocType(depMemType->getAssocType());

MetadataResponse response =
Expand Down
42 changes: 42 additions & 0 deletions test/Generics/rdar83894546_2.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// RUN: %target-typecheck-verify-swift
// RUN: %target-swift-frontend -emit-ir %s

public struct G<A : P7> : P2 {}

public protocol P1 {
associatedtype A
}

public protocol P2: P1 where A: P7 {}

public protocol P3 {
associatedtype B: P1 where B.A == A
associatedtype A: P7
}

public protocol P4: P3 where B == G<A> { }

public protocol P5 : P3 {
associatedtype C: P3 where C.A == A
}

public protocol P6 : P5 where B == G<A>, C: P4 {}

public protocol P7 {
associatedtype D: P1 where D.A == Self
}

public protocol P8 {
associatedtype E: P5 where E.C.B: P2
associatedtype F: P4 where F.A == E.A
}

public protocol P9 : P8 where E.C == F, E: P6 {}

public func callee<T : P1>(_: T.Type) -> T {
fatalError()
}

public func callee<T : P9>(_: T) {
_ = callee(T.F.A.D.self)
}

0 comments on commit ab2a799

Please sign in to comment.