Skip to content

Commit ecb70d2

Browse files
[Diagnostics] Adding optional note specific to keypath application base diagnostics
1 parent 108094d commit ecb70d2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,9 @@ NOTE(optional_base_chain,none,
10771077
"base values", (DeclNameRef))
10781078
NOTE(optional_base_remove_optional_for_keypath_root, none,
10791079
"use unwrapped type %0 as key path root", (Type))
1080-
1080+
NOTE(optional_keypath_application_base, none,
1081+
"use '?' to access key path subscript only for non-'nil' base values", ())
1082+
10811083
ERROR(missing_unwrap_optional_try,none,
10821084
"value of optional type %0 not unwrapped; did you mean to use 'try!' "
10831085
"or chain with '?'?",

localization/diagnostics/en.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,6 +4292,10 @@
42924292
msg: >-
42934293
use unwrapped type %0 as key path root
42944294
4295+
- id: optional_keypath_application_base
4296+
msg: >-
4297+
use '?' to access key path subscript only for non-'nil' base values
4298+
42954299
- id: missing_unwrap_optional_try
42964300
msg: >-
42974301
value of optional type %0 not unwrapped; did you mean to use 'try!' or

0 commit comments

Comments
 (0)