Skip to content

Commit 789d3a3

Browse files
author
Amritpan Kaur
committed
[Tests] Update tests to reflect new output.
1 parent 1a609f0 commit 789d3a3

File tree

4 files changed

+69
-17
lines changed

4 files changed

+69
-17
lines changed

test/Concurrency/async_overload_filtering.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ var a: String? = nil
1818

1919
// CHECK: attempting disjunction choice $T0 bound to decl async_overload_filtering.(file).filter_async(fn2:)
2020
// CHECK-NEXT: overload set choice binding $T0 := {{.*}}
21+
// CHECK-NEXT: (considering -> ({{.*}}) -> {{.*}} applicable fn {{.*}}
22+
// CHECK-NEXT: (simplification result:
2123
// CHECK-NEXT: increasing 'sync-in-asynchronous' score by 1
24+
// CHECK-NEXT: (added constraint: {{.*}} arg conv () async -> {{.*}}
25+
// CHECK-NEXT: (removed constraint: ({{.*}}) -> {{.*}} applicable fn {{.*}}
26+
// CHECK-NEXT: )
27+
// CHECK-NEXT: (outcome: simplified)
28+
// CHECK-NEXT: )
2229
// CHECK-NEXT: solution is worse than the best solution
2330
filter_async {
2431
Obj()

test/Constraints/common_type.swift

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,34 @@ func f(_: Int) -> X { return X() }
2727
func f(_: Double) -> Y { return Y() }
2828

2929
func testCallCommonType() {
30-
// CHECK: overload set choice binding $T{{[0-9]+}} := (Int) -> X
31-
// CHECK-NEXT: (common result type for $T{{[0-9]+}} is Int)
32-
// CHECK: (overload set choice binding $T{{[0-9]+}} := (Double) -> Y)
33-
// CHECK-NEXT: (common result type for $T{{[0-9]+}} is Double)
30+
// CHECK: overload set choice binding [[A:\$T[0-9]+]] := (Int) -> X
31+
// CHECK-NEXT: (considering -> (_const [[B:\$T[0-9]+]]) -> [[C:\$T[0-9]+]] applicable fn [[A]]
32+
// CHECK-NEXT: (simplification result:
33+
// CHECK-NEXT: (added constraint: [[B]] arg conv Int
34+
// CHECK-NEXT: (removed constraint: (_const [[B]]) -> [[C]] applicable fn [[A]] {{.+}})
35+
// CHECK-NEXT: )
36+
// CHECK-NEXT: (outcome: simplified)
37+
// CHECK-NEXT: )
38+
// CHECK-NEXT: (considering -> [[C]][.g: value] == [[D:\$T[0-9]+]]
39+
// CHECK-NEXT: (simplification result:
40+
// CHECK-NEXT: (added constraint: disjunction
41+
// CHECK-NEXT: > [[D]] bound to decl common_type
42+
// CHECK-NEXT: > [[D]] bound to decl common_type
43+
// CHECK-NEXT: (common result type for [[D]] is Int)
44+
// CHECK: (overload set choice binding [[F:\$T[0-9]+]] := (Double) -> Y)
45+
// CHECK-NEXT: (considering -> (_const [[G:\$T[0-9]+]]) -> [[H:\$T[0-9]+]] applicable fn [[F]]
46+
// CHECK-NEXT: (simplification result:
47+
// CHECK-NEXT: (added constraint: [[G]] arg conv Double
48+
// CHECK-NEXT: (removed constraint: (_const [[G]]) -> [[H]] applicable fn [[F]] {{.+}})
49+
// CHECK-NEXT: )
50+
// CHECK-NEXT: (outcome: simplified)
51+
// CHECK-NEXT: )
52+
// CHECK-NEXT: (considering -> [[H]][.g: value] == [[I:\$T[0-9]+]]
53+
// CHECK-NEXT: (simplification result:
54+
// CHECK-NEXT: (added constraint: disjunction
55+
// CHECK-NEXT: > [[I]] bound to decl common_type
56+
// CHECK-NEXT: > [[I]] bound to decl common_type
57+
// CHECK-NEXT: (common result type for [[I]] is Double)
3458
_ = f(0).g(0)
3559
}
3660

test/Constraints/one_way_solve.swift

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ func takeDoubleAndBool(_: Double, _: Bool) { }
77

88
func testTernaryOneWay(b: Bool, b2: Bool) {
99
// CHECK: ---Connected components---
10-
// CHECK-NEXT: 3: $T10 depends on 1
11-
// CHECK-NEXT: 1: $T5 $T8 $T9 depends on 0, 2
12-
// CHECK-NEXT: 2: $T7
13-
// CHECK-NEXT: 0: $T4
14-
// CHECK-NEXT: 4: $T11 $T13 $T14
10+
// CHECK-NEXT: 3: $T{{[0-9]+}} depends on 1
11+
// CHECK-NEXT: 1: $T{{[0-9]+}} $T{{[0-9]+}} $T{{[0-9]+}} depends on 0, 2
12+
// CHECK-NEXT: 2: $T{{[0-9]+}}
13+
// CHECK-NEXT: 0: $T{{[0-9]+}}
14+
// CHECK-NEXT: 4: $T{{[0-9]+}} $T{{[0-9]+}} $T{{[0-9]+}}
1515
takeDoubleAndBool(
1616
Builtin.one_way(
1717
b ? Builtin.one_way(3.14159) : Builtin.one_way(2.71828)),
@@ -23,22 +23,35 @@ func int8Or16(_ x: Int16) -> Int16 { return x }
2323

2424
func testTernaryOneWayOverload(b: Bool) {
2525
// CHECK: ---Connected components---
26-
// CHECK: 1: $T5 $T10 $T11 depends on 0, 2
27-
// CHECK: 2: $T7 $T8 $T9
28-
// CHECK: 0: $T2 $T3 $T4
26+
// CHECK: 1: [[A:\$T[0-9]+]] [[B:\$T[0-9]+]] [[C:\$T[0-9]+]] depends on 0, 2
27+
// CHECK: 2: $T{{[0-9]+}} $T{{[0-9]+}} $T{{[0-9]+}}
28+
// CHECK: 0: $T{{[0-9]+}} $T{{[0-9]+}} $T{{[0-9]+}}
2929

3030
// CHECK: solving component #1
31-
// CHECK: (attempting type variable $T11 := Int8
31+
// CHECK: (attempting type variable [[C]] := Int8
3232

3333
// CHECK: solving component #1
34-
// CHECK: (attempting type variable $T11 := Int8
34+
// CHECK: (attempting type variable [[C]] := Int8
3535

3636
// CHECK: solving component #1
37-
// CHECK: (attempting type variable $T11 := Int8
37+
// CHECK: (attempting type variable [[C]] := Int8
3838

3939
// CHECK: solving component #1
40-
// CHECK: (attempting type variable $T11 := Int8
41-
// CHECK: (found solution: [component: non-default literal(s), value: 2] [component: use of overloaded unapplied function(s), value: 2])
40+
// CHECK: (attempting type variable [[C]] := Int8
41+
// CHECK: (considering -> [[A]] conv [[C]]
42+
// CHECK: (removed constraint: [[A]] conv [[C]]
43+
// CHECK: (outcome: simplified)
44+
// CHECK: )
45+
// CHECK: (considering -> [[B]] conv [[C]]
46+
// CHECK: (removed constraint: [[B]] conv [[C]]
47+
// CHECK: (outcome: simplified)
48+
// CHECK: )
49+
// CHECK: (considering -> [[C]] conv Int8
50+
// CHECK: > [[B]] conv [[C]]
51+
// CHECK: > [[C]] conv Int8
52+
// CHECK: )
53+
// CHECK: )
54+
// CHECK: (found solution: [component: non-default literal(s), value: 2] [component: use of overloaded unapplied function(s), value: 2])
4255

4356
// CHECK: (composed solution: [component: non-default literal(s), value: 2] [component: use of overloaded unapplied function(s), value: 2])
4457
// CHECK-NOT: (composed solution: [component: non-default literal(s), value: 2] [component: use of overloaded unapplied function(s), value: 2])

test/Constraints/overload_filtering.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ func testSubscript(x: X, i: Int) {
3535
func testUnresolvedMember(i: Int) -> X {
3636
// CHECK: disabled disjunction term {{.*}} bound to decl overload_filtering.(file).X.init(_:)
3737
// CHECK-NEXT: disabled disjunction term {{.*}} bound to decl overload_filtering.(file).X.init(_:_:_:)
38+
// CHECK-NEXT: (removed constraint: disjunction
39+
// CHECK-NEXT: > [[A:\$T[0-9]+]] bound to decl overload_filtering
40+
// CHECK-NEXT: > [disabled] [[A]] bound to decl overload_filtering
41+
// CHECK-NEXT: > [disabled] [[A]] bound to decl overload_filtering
3842
// CHECK-NEXT: introducing single enabled disjunction term {{.*}} bound to decl overload_filtering.(file).X.init(_:_:)
3943
return .init(i, i)
4044
}
@@ -56,6 +60,10 @@ func test_member_filtering() {
5660
func test(s: S) {
5761
// CHECK: disabled disjunction term {{.*}} bound to decl overload_filtering.(file).test_member_filtering().S.bar(v:)
5862
// CHECK-NEXT: disabled disjunction term {{.*}} bound to decl overload_filtering.(file).test_member_filtering().S.bar(a:b:)
63+
// CHECK-NEXT: (removed constraint: disjunction
64+
// CHECK-NEXT: > [[B:\$T[0-9]+]] bound to decl overload_filtering
65+
// CHECK-NEXT: > [disabled] [[B]] bound to decl overload_filtering
66+
// CHECK-NEXT: > [disabled] [[B]] bound to decl overload_filtering
5967
// CHECK-NEXT: introducing single enabled disjunction term {{.*}} bound to decl overload_filtering.(file).test_member_filtering().S.bar
6068
s.foo(42).bar(42)
6169
}

0 commit comments

Comments
 (0)