Skip to content

Commit 3e9287c

Browse files
committed
[Diagnostics] Fix diagnostic improved after labeling changes
1 parent effd0d0 commit 3e9287c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/Constraints/patterns.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ switch staticMembers {
291291
case .init(0): break
292292
case .init(_): break // expected-error{{'_' can only appear in a pattern}}
293293
case .init(let x): break // expected-error{{cannot appear in an expression}}
294-
case .init(opt: 0): break // expected-error{{pattern cannot match values of type 'StaticMembers'}}
294+
case .init(opt: 0): break // expected-error{{value of optional type 'StaticMembers?' must be unwrapped to a value of type 'StaticMembers'}}
295+
// expected-note@-1 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
296+
// expected-note@-2 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
295297

296298
case .prop: break
297299
// TODO: repeated error message

0 commit comments

Comments
 (0)