1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend -emit-module %S/Inputs/rdar79564324_other.swift -emit-module-path %t/rdar79564324_other.swiftmodule -requirement-machine=on -debug-requirement-machine 2>&1 | %FileCheck %s
3
+ // RUN: %target-swift-frontend -emit-silgen %s -I %t -requirement-machine=on
4
+
5
+ import rdar79564324_other
6
+
7
+ public func test< T : P > ( _ t: T ) where T == T . A {
8
+ foo ( from: t, to: t)
9
+ }
10
+
11
+ // foo(from:to:) has minimal signature <T, U where T == T.A, U : P, T.A == U.A>.
12
+ //
13
+ // The GSB had trouble re-building after deserialization because of the two
14
+ // requirements 'T == T.A' and 'T.A == U.A'.
15
+ //
16
+ // What should happen is that these two imply that 'T == U.A', and 'U : P'
17
+ // implies the existence of 'U.A' and thus the conformance of T to P.
18
+ //
19
+ // Instead what happens is that 'T == T.A' and 'T.A == U.A' both get delayed
20
+ // because T does not yet have a nested type A, so it gets stuck.
21
+ //
22
+ // The rewrite system handles this correctly though:
23
+
24
+ // CHECK-LABEL: Requirement machine for <τ_0_0, τ_0_1 where τ_0_0 == τ_0_0.A, τ_0_1 : P, τ_0_0.A == τ_0_1.A>
25
+ // CHECK-NEXT: Rewrite system: {
26
+ // CHECK-NEXT: - [P].A => [P:A]
27
+ // CHECK-NEXT: - [P:A].[P] => [P:A]
28
+ // CHECK-NEXT: - τ_0_0.[P:A] => τ_0_0
29
+ // CHECK-NEXT: - τ_0_1.[P] => τ_0_1
30
+ // CHECK-NEXT: - τ_0_1.[P:A] => τ_0_0
31
+ // CHECK-NEXT: - [P:A].A => [P:A].[P:A]
32
+ // CHECK-NEXT: - τ_0_0.[P] => τ_0_0
33
+ // CHECK-NEXT: - τ_0_1.A => τ_0_0
34
+ // CHECK-NEXT: - τ_0_0.A => τ_0_0
35
+ // CHECK-NEXT: }
36
+ // CHECK-NEXT: Equivalence class map: {
37
+ // CHECK-NEXT: [P:A] => { conforms_to: [P] }
38
+ // CHECK-NEXT: τ_0_0 => { conforms_to: [P] }
39
+ // CHECK-NEXT: τ_0_1 => { conforms_to: [P] }
40
+ // CHECK-NEXT: }
0 commit comments