Skip to content

RequirementMachine: Fix a couple of minor problems #39700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}