Skip to content

Commit 7393c9c

Browse files
committed
RequirementMachine: Remove unsound cycle-breaking hack
1 parent f33eb17 commit 7393c9c

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,6 @@ struct InferRequirementsWalker : public TypeWalker {
292292
auto decl = ty->getAnyNominal();
293293
if (!decl) return Action::Continue;
294294

295-
// FIXME: The GSB and the request evaluator both detect a cycle here if we
296-
// force a recursive generic signature. We should look into moving cycle
297-
// detection into the generic signature request(s) - see rdar://55263708
298-
if (!decl->hasComputedGenericSignature())
299-
return Action::Continue;
300-
301295
auto genericSig = decl->getGenericSignature();
302296
if (!genericSig)
303297
return Action::Continue;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-inferred-signatures=on
2+
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-inferred-signatures=on 2>&1 | %FileCheck %s
3+
4+
protocol P1 {}
5+
6+
protocol P2 {}
7+
8+
protocol IteratorProtocol {
9+
associatedtype Element
10+
11+
func next() -> Element?
12+
}
13+
14+
// CHECK: requirement_inference_funny_order.(file).LocalArray@
15+
// CHECK: Generic signature: <Element where Element : P1>
16+
17+
// CHECK: ExtensionDecl line={{[0-9]+}} base=LocalArray
18+
// CHECK: Generic signature: <Element where Element : P1, Element : P2>
19+
extension LocalArray where Element : P2 {
20+
static func ==(lhs: Self, rhs: Self) -> Bool {}
21+
}
22+
23+
struct LocalArray<Element : P1>: IteratorProtocol {
24+
func next() -> Element? {}
25+
}

0 commit comments

Comments
 (0)