Skip to content

Commit 18d4da1

Browse files
Suyash SrijanSuyash Srijan
authored andcommitted
[test] update diagnostics in more tests
1 parent 8845fcb commit 18d4da1

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

test/Constraints/closures.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ func simplified1069() {
295295
func genericallyNonOptional<T: AnyObject>(_ a: T, _ b: T, _ c: T) { }
296296

297297
func f(_ a: C?, _ b: C?, _ c: C) {
298-
genericallyNonOptional(a, b, c) // expected-error 2{{value of optional type 'C?' must be unwrapped to a value of type 'C'}}
299-
// expected-note @-1 2{{coalesce}}
300-
// expected-note @-2 2{{force-unwrap}}
298+
genericallyNonOptional(a, b, c) // expected-error {{value of optional type 'C?' must be unwrapped to a value of type 'C'}}
299+
// expected-note @-1 {{coalesce}}
300+
// expected-note @-2 {{force-unwrap}}
301301
}
302302
}
303303
}

test/Constraints/fixes.swift

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ struct S1116 {
160160
}
161161

162162
let a1116: [S1116] = []
163-
var s1116 = Set(1...10).subtracting(a1116.map({ $0.s })) // expected-error {{cannot convert value of type '[Int?]' to expected argument type 'Set<Int>'}}
163+
var s1116 = Set(1...10).subtracting(a1116.map({ $0.s })) // expected-error {{value of optional type 'Int?' must be unwrapped to a value of type 'Int'}}
164+
// expected-note@-1{{force-unwrap}}
165+
// expected-note@-2{{coalesce}}
164166

165167

166168
func moreComplexUnwrapFixes() {
@@ -202,22 +204,16 @@ func moreComplexUnwrapFixes() {
202204
// expected-note@-4{{force-unwrap using '!'}}{{17-17=!}}
203205

204206
takeNon(os?.value) // expected-error{{value of optional type 'Int?' must be unwrapped to a value of type 'Int'}}
205-
// expected-note@-1{{force-unwrap using '!'}}{{13-14=!}}
207+
// expected-note@-1{{force-unwrap using '!'}}{{21-21=!}}
206208
// expected-note@-2{{coalesce}}
207209
takeNon(os?.optValue) // expected-error{{value of optional type 'Int?' must be unwrapped to a value of type 'Int'}}
208-
// expected-note@-1{{force-unwrap using '!'}}{{11-11=(}}{{23-23=)!}}
210+
// expected-note@-1{{force-unwrap using '!'}}{{24-24=!}}
209211
// expected-note@-2{{coalesce}}
210212

211213
func sample(a: Int?, b: Int!) {
212214
let aa = a
213-
// expected-note@-1{{short-circuit using 'guard'}}{{5-5=guard }} {{15-15= else \{ return \}}}
214-
// expected-note@-2{{force-unwrap}}
215-
// expected-note@-3{{coalesce}}
216215

217-
let bb = b // expected-note{{value inferred to be type 'Int?' when initialized with an implicitly unwrapped value}}
218-
// expected-note@-1{{short-circuit using 'guard'}}{{5-5=guard }} {{15-15= else \{ return \}}}
219-
// expected-note@-2{{force-unwrap}}
220-
// expected-note@-3{{coalesce}}
216+
let bb = b
221217

222218
let cc = a
223219

0 commit comments

Comments
 (0)