Skip to content

Commit ddbe845

Browse files
committed
Improve readability of expected diagnostics comments
1 parent 82e76e4 commit ddbe845

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

test/Parse/generic_disambiguation.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,19 @@ A<(B) throws -> D>(x: 0) // expected-warning{{unused}}
7979

8080
// https://github.com/apple/swift/issues/43053
8181
do {
82-
1 as! A<B>.F << 2 // expected-warning{{cast from 'Int' to unrelated type 'A<B>.F' always fails}} // expected-error {{referencing operator function '<<' on 'BinaryInteger' requires that 'A<B>.F' conform to 'BinaryInteger'}}
83-
1 as! A<B> << 2 // expected-warning{{cast from 'Int' to unrelated type 'A<B>' always fails}} expected-error{{referencing operator function '<<' on 'BinaryInteger' requires that 'A<B>' conform to 'BinaryInteger'}}
82+
1 as! A<B>.F << 2 // expected-warning {{cast from 'Int' to unrelated type 'A<B>.F' always fails}}
83+
// expected-error@-1 {{referencing operator function '<<' on 'BinaryInteger' requires that 'A<B>.F' conform to 'BinaryInteger'}}
84+
1 as! A<B> << 2 // expected-warning {{cast from 'Int' to unrelated type 'A<B>' always fails}}
85+
// expected-error@-1 {{referencing operator function '<<' on 'BinaryInteger' requires that 'A<B>' conform to 'BinaryInteger'}}
8486
let _ = 1 as Int16 << 7
85-
let _ = 1 as? Int16 << 7 // expected-error{{value of optional type 'Int16?' must be unwrapped to a value of type 'Int16'}} expected-warning{{conditional downcast from literal to 'Int16' always fails; consider using 'as' coercion}} expected-note{{coalesce using '??' to provide a default when the optional value contains 'nil'}} expected-note{{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
86-
let _ = 1 is Int16 << 7 // expected-warning{{conditional downcast from literal to 'Int16' always fails; consider using 'as' coercion}} expected-error{{binary operator '<<' cannot be applied to operands of type 'Bool' and 'Int'}}
87-
let _ = 1 as! Int16 << 7 // expected-warning{{conditional downcast from literal to 'Int16' always fails; consider using 'as' coercion}}
87+
let _ = 1 as? Int16 << 7 // expected-error {{value of optional type 'Int16?' must be unwrapped to a value of type 'Int16'}}
88+
// expected-warning@-1 {{conditional downcast from literal to 'Int16' always fails; consider using 'as' coercion}}
89+
// expected-note@-2 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
90+
// expected-note@-3 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
91+
let _ = 1 is Int16 << 7 // expected-warning {{conditional downcast from literal to 'Int16' always fails; consider using 'as' coercion}}
92+
// expected-error@-1 {{binary operator '<<' cannot be applied to operands of type 'Bool' and 'Int'}}
93+
let _ = 1 as! Int16 << 7 // expected-warning {{conditional downcast from literal to 'Int16' always fails; consider using 'as' coercion}}
8894
let _ = 1 as Int16 <= 7
8995
// FIXME: this should not produce any errors.
90-
let _ = 1 as Int16 < 7 // expected-error{{expected type}}
96+
let _ = 1 as Int16 < 7 // expected-error {{expected type}}
9197
}

0 commit comments

Comments
 (0)