Skip to content

Commit 09e4582

Browse files
committed
[Diagnostics] NFC: Adjust test-cases improved by changes to closure expression handling
1 parent 3f1083e commit 09e4582

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

test/Constraints/function_builder_diags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func erroneousSR11350(x: Int) {
211211
if b {
212212
acceptInt(0) { }
213213
}
214-
}).domap(0) // expected-error{{value of type 'Optional<()>' has no member 'domap'}}
214+
}).domap(0) // expected-error{{value of type '()?' has no member 'domap'}}
215215
}
216216
}
217217

test/Constraints/function_builder_one_way.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ func tuplify<C: Collection, T>(_ collection: C, @TupleBuilder body: (C.Element)
4949
}
5050

5151
// CHECK: ---Connected components---
52-
// CHECK-NEXT: 0: $T1 $T2 $T3 $T5 $T6 $T7 $T8 $T69 depends on 1
53-
// CHECK-NEXT: 1: $T9 $T11 $T16 $T30 $T62 $T63 $T64 $T65 $T66 $T67 $T68 depends on 2, 3, 4, 5
52+
// CHECK-NEXT: 0: $T1 $T2 $T3 $T5 $T6 $T7 $T8 $T10 $T11 $T69 depends on 1
53+
// CHECK-NEXT: 1: $T12 $T14 $T19 $T30 $T62 $T63 $T64 $T65 $T66 $T67 $T68 depends on 2, 3, 4, 5
5454
// CHECK-NEXT: 5: $T32 $T43 $T44 $T45 $T46 $T47 $T57 $T58 $T59 $T60 $T61 depends on 6, 9
5555
// CHECK-NEXT: 9: $T48 $T54 $T55 $T56 depends on 10
5656
// CHECK-NEXT: 10: $T49 $T50 $T51 $T52 $T53
5757
// CHECK-NEXT: 6: $T33 $T35 $T39 $T40 $T41 $T42 depends on 7, 8
5858
// CHECK-NEXT: 8: $T36 $T37 $T38
5959
// CHECK-NEXT: 7: $T34
60-
// CHECK-NEXT: 4: $T17 $T18 $T19 $T20 $T21 $T22 $T23 $T24 $T25 $T26 $T27 $T28 $T29
61-
// CHECK-NEXT: 3: $T14 $T15
62-
// CHECK-NEXT: 2: $T10
60+
// CHECK-NEXT: 4: $T20 $T21 $T22 $T23 $T24 $T25 $T26 $T27 $T28 $T29
61+
// CHECK-NEXT: 3: $T17 $T18
62+
// CHECK-NEXT: 2: $T13
6363
let names = ["Alice", "Bob", "Charlie"]
6464
let b = true
6565
var number = 17

test/Constraints/tuple_arguments.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,8 @@ func autoclosureSplat() {
17361736
// wrap the closure in a function conversion.
17371737

17381738
takeFn { (fn: @autoclosure () -> Int, x: Int) in }
1739-
// expected-error@-1 {{contextual closure type '(@escaping () -> Int) -> ()' expects 1 argument, but 2 were used in closure body}}
1739+
// expected-error@-1 {{contextual closure type '(() -> Int) -> ()' expects 1 argument, but 2 were used in closure body}}
1740+
// expected-error@-2 {{converting non-escaping value to 'T' may allow it to escape}}
17401741

17411742
takeFn { (fn: @autoclosure @escaping () -> Int) in }
17421743
// FIXME: It looks like matchFunctionTypes() does not check @autoclosure at all.

validation-test/Sema/type_checker_crashers_fixed/rdar50869732.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ struct Generic<T> {
1010

1111
@_functionBuilder
1212
struct Builder {
13-
static func buildBlock<C0, C1>(_ c0: C0, _ c1: C1) // expected-note {{where 'C0' = 'Empty'}} expected-note {{where 'C1' = 'Test<Empty>'}}
13+
static func buildBlock<C0, C1>(_ c0: C0, _ c1: C1) // expected-note 2 {{where 'C0' = 'Empty'}} expected-note {{where 'C1' = 'Test<Generic<(Empty, _)>>'}}
14+
// expected-note@-1 {{'buildBlock' declared here}}
1415
-> Generic<(C0, C1)> where C0 : P, C1 : P {
1516
return Generic((c0, c1))
1617
}
@@ -24,13 +25,16 @@ struct Empty {
2425
init() {}
2526
}
2627

27-
struct Test<T> where T : P { // expected-note {{where 'T' = 'Empty'}}
28+
struct Test<T> where T : P { // expected-note {{where 'T' = 'Generic<(Empty, _)>'}}
2829
init(@Builder _: () -> T) {}
2930
}
3031

3132
let x = G {
3233
// expected-error@-1 {{static method 'buildBlock' requires that 'Empty' conform to 'P'}}
33-
// expected-error@-2 {{static method 'buildBlock' requires that 'Test<Empty>' conform to 'P'}}
34+
// expected-error@-2 {{static method 'buildBlock' requires that 'Test<Generic<(Empty, _)>>' conform to 'P'}}
3435
Empty()
35-
Test { Empty() } // expected-error {{generic struct 'Test' requires that 'Empty' conform to 'P'}}
36+
Test { Empty() }
37+
// expected-error@-1 {{static method 'buildBlock' requires that 'Empty' conform to 'P'}}
38+
// expected-error@-2 {{missing argument for parameter #2 in call}}
39+
// expected-error@-3 {{generic struct 'Test' requires that 'Generic<(Empty, _)>' conform to 'P'}}
3640
}

0 commit comments

Comments
 (0)