Skip to content

Commit 1844578

Browse files
Add more tests
1 parent 5ff6fe2 commit 1844578

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/Constraints/optional.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ func sr_12309() {
436436

437437
_ = S(foo: nil!) // expected-error {{'nil' literal cannot be force unwrapped}}
438438
_ = nil! // expected-error {{'nil' literal cannot be force unwrapped}}
439+
_ = (nil!) // expected-error {{'nil' literal cannot be force unwrapped}}
440+
_ = (nil)! // expected-error {{'nil' literal cannot be force unwrapped}}
439441
_ = nil? // expected-error {{value of optional type 'Optional<_>' must be unwrapped to a value of type '_'}}
440442
// expected-note@-1 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
441443
// expected-note@-2 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}

0 commit comments

Comments
 (0)