@@ -689,6 +689,9 @@ NOTE(keypath_static_member_access_from_unsupported_module_note,none,
689
689
ERROR(expr_keypath_enum_case,none,
690
690
" %select{key path|dynamic key path member lookup}1 cannot refer to enum case %0" ,
691
691
(const ValueDecl *, bool ))
692
+ ERROR(expr_keypath_mutating_method,none,
693
+ " %select{key path|dynamic key path member lookup}1 cannot refer to mutating method %0" ,
694
+ (const ValueDecl *, bool ))
692
695
ERROR(expr_keypath_empty,none,
693
696
" empty key path does not refer to a property" , ())
694
697
ERROR(expr_unsupported_objc_key_path_component,none,
@@ -718,8 +721,8 @@ ERROR(expr_swift_keypath_empty, none,
718
721
" key path must have at least one component" , ())
719
722
ERROR(expr_string_interpolation_outside_string,none,
720
723
" string interpolation can only appear inside a string literal" , ())
721
- ERROR(expr_keypath_subscript_index_not_hashable , none,
722
- " subscript index of type %0 in a key path must be Hashable" , (Type))
724
+ ERROR(expr_keypath_arg_or_index_not_hashable , none,
725
+ " %select{method argument| subscript index}0 of type %1 in a key path must be Hashable" , (bool , Type))
723
726
ERROR(expr_smart_keypath_application_type_mismatch,none,
724
727
" key path of type %0 cannot be applied to a base of type %1" ,
725
728
(Type, Type))
@@ -1560,6 +1563,8 @@ ERROR(cannot_pass_inout_arg_to_subscript,none,
1560
1563
" cannot pass an inout argument to a subscript; use "
1561
1564
" 'withUnsafeMutablePointer' to explicitly convert argument "
1562
1565
" to a pointer" , ())
1566
+ ERROR(cannot_pass_inout_arg_to_keypath_method,none,
1567
+ " cannot pass an inout argument to a keypath method" , ())
1563
1568
1564
1569
ERROR(incorrect_property_wrapper_reference,none,
1565
1570
" cannot convert value %0 of type %1 to expected type %2, "
@@ -5596,8 +5601,8 @@ ERROR(actor_isolated_keypath_component,none,
5596
5601
" cannot form key path to %0 %kind1" ,
5597
5602
(ActorIsolation, const ValueDecl *))
5598
5603
ERROR(effectful_keypath_component,none,
5599
- " cannot form key path to %0 with 'throws' or 'async'" ,
5600
- (DescriptiveDeclKind))
5604
+ " cannot form %select{ key path|dynamic key path member lookup}1 to %0 with 'throws' or 'async'" ,
5605
+ (DescriptiveDeclKind, bool ))
5601
5606
ERROR(local_function_executed_concurrently,none,
5602
5607
" concurrently-executed %kind0 must be marked as '@Sendable'" ,
5603
5608
(const ValueDecl *))
@@ -8089,7 +8094,7 @@ ERROR(pack_iteration_where_clause_not_supported, none,
8089
8094
8090
8095
8091
8096
// ------------------------------------------------------------------------------
8092
- // MARK: Lifetime Dependence Diagnostics
8097
+ // MARK: Lifetime Dependence Syntax
8093
8098
// ------------------------------------------------------------------------------
8094
8099
8095
8100
ERROR(lifetime_dependence_invalid_param_name, none,
@@ -8108,34 +8113,15 @@ ERROR(lifetime_dependence_cannot_use_kind, none,
8108
8113
ERROR(lifetime_dependence_cannot_use_parsed_scoped_consuming, none,
8109
8114
" invalid use of scoped lifetime dependence with consuming ownership" ,
8110
8115
())
8111
- ERROR(lifetime_dependence_cannot_use_inferred_scoped_consuming, none,
8112
- " invalid use of lifetime dependence on an Escapable parameter with "
8113
- " consuming ownership" ,
8114
- ())
8115
- ERROR(lifetime_dependence_invalid_self_ownership, none,
8116
- " invalid scoped lifetime dependence on an Escapable self with consuming "
8117
- " ownership" ,
8118
- ())
8119
8116
ERROR(lifetime_dependence_only_on_function_method_init_result, none,
8120
8117
" lifetime dependence specifiers may only be used on result of "
8121
8118
" functions, methods, initializers" , ())
8122
- ERROR(lifetime_dependence_invalid_type, none,
8123
- " lifetime dependence can only be specified on ~Escapable types" , ())
8124
- ERROR(lifetime_dependence_cannot_infer_ambiguous_candidate, none,
8125
- " cannot infer lifetime dependence %0, multiple parameters qualifiy as a candidate" , (StringRef))
8126
- ERROR(lifetime_dependence_cannot_infer_no_candidates, none,
8127
- " cannot infer lifetime dependence%0, no parameters found that are either "
8128
- " ~Escapable or Escapable with a borrowing ownership" , (StringRef))
8129
- ERROR(lifetime_dependence_ctor_non_self_or_nil_return, none,
8130
- " expected nil or self as return values in an initializer with "
8131
- " lifetime dependent specifiers" ,
8132
- ())
8133
- ERROR(lifetime_dependence_cannot_be_applied_to_tuple_elt, none,
8134
- " lifetime dependence specifiers cannot be applied to tuple elements" , ())
8135
- ERROR(lifetime_dependence_method_escapable_bitwisecopyable_self, none,
8136
- " cannot infer lifetime dependence on a self which is BitwiseCopyable & "
8137
- " Escapable" ,
8119
+ ERROR(lifetime_dependence_ctor_non_self_or_nil_return, none,
8120
+ " expected 'nil' or 'self' as return values in an initializer with "
8121
+ " lifetime dependent specifiers" ,
8138
8122
())
8123
+ ERROR(lifetime_dependence_cannot_be_applied_to_tuple_elt, none,
8124
+ " lifetime dependence specifiers cannot be applied to tuple elements" , ())
8139
8125
ERROR(lifetime_dependence_immortal_conflict_name, none,
8140
8126
" conflict between the parameter name and 'immortal' contextual keyword" , ())
8141
8127
ERROR(lifetime_dependence_function_type, none,
@@ -8144,18 +8130,75 @@ ERROR(lifetime_dependence_function_type, none,
8144
8130
ERROR(lifetime_dependence_immortal_alone, none,
8145
8131
" cannot specify any other dependence source along with immortal" , ())
8146
8132
ERROR(lifetime_dependence_invalid_inherit_escapable_type, none,
8147
- " invalid lifetime dependence on a source of Escapable type, use borrow "
8148
- " dependence instead" ,
8149
- ())
8133
+ " cannot copy the lifetime of an Escapable type, use "
8134
+ " '@lifetime(borrow %0)' instead" ,
8135
+ (StringRef ))
8150
8136
ERROR(lifetime_dependence_cannot_use_parsed_borrow_consuming, none,
8151
8137
" invalid use of borrow dependence with consuming ownership" ,
8152
8138
())
8139
+ ERROR(lifetime_dependence_cannot_use_parsed_borrow_inout, none,
8140
+ " invalid use of borrow dependence on the same inout parameter" ,
8141
+ ())
8153
8142
ERROR(lifetime_dependence_duplicate_target, none,
8154
8143
" invalid duplicate target lifetime dependencies on function" , ())
8144
+ ERROR(lifetime_parameter_requires_inout, none,
8145
+ " lifetime-dependent parameter must be 'inout'" , (Identifier))
8146
+
8147
+ // ------------------------------------------------------------------------------
8148
+ // MARK: Lifetime Dependence Requirements
8149
+ // ------------------------------------------------------------------------------
8150
+
8151
+ ERROR(lifetime_dependence_feature_required_return, none,
8152
+ " %0 with a ~Escapable result requires "
8153
+ " '-enable-experimental-feature LifetimeDependence'" , (StringRef))
8154
+ ERROR(lifetime_dependence_feature_required_mutating, none,
8155
+ " %0 with ~Escapable 'self' requires "
8156
+ " '-enable-experimental-feature LifetimeDependence'" , (StringRef))
8157
+ ERROR(lifetime_dependence_feature_required_inout, none,
8158
+ " %0 with a ~Escapable 'inout' parameter requires "
8159
+ " '-enable-experimental-feature LifetimeDependence'" ,
8160
+ // arg list is interchangable with lifetime_dependence_cannot_infer_inout
8161
+ (StringRef, Identifier))
8155
8162
8156
- ERROR(lifetime_dependence_feature_required, none,
8157
- " returning ~Escapable type requires '-enable-experimental-feature "
8158
- " LifetimeDependence'" , ())
8163
+ ERROR(lifetime_dependence_cannot_infer_return, none,
8164
+ " %0 with a ~Escapable result requires '@lifetime(...)'" , (StringRef))
8165
+ ERROR(lifetime_dependence_cannot_infer_mutating, none,
8166
+ " %0 with a ~Escapable 'self' requires '@lifetime(self: ...)'" , (StringRef))
8167
+ ERROR(lifetime_dependence_cannot_infer_inout, none,
8168
+ " %0 with a ~Escapable 'inout' parameter requires '@lifetime(%1: ...)'" ,
8169
+ (StringRef, Identifier))
8170
+
8171
+ // ------------------------------------------------------------------------------
8172
+ // MARK: Lifetime Dependence Inference - refinements to the requirements above
8173
+ // ------------------------------------------------------------------------------
8174
+
8175
+ ERROR(lifetime_dependence_cannot_infer_return_no_param, none,
8176
+ " %0 with a ~Escapable result needs a parameter to depend on" ,
8177
+ (StringRef))
8178
+ NOTE(lifetime_dependence_cannot_infer_return_immortal, none,
8179
+ " '@lifetime(immortal)' can be used to indicate that values produced by "
8180
+ " this initializer have no lifetime dependencies" , ())
8181
+ ERROR(lifetime_dependence_cannot_infer_bitwisecopyable, none,
8182
+ " cannot infer lifetime dependence on %0 because '%1' is BitwiseCopyable, "
8183
+ " specify '@lifetime(borrow self)'" ,
8184
+ (StringRef, StringRef))
8185
+ ERROR(lifetime_dependence_cannot_infer_kind, none,
8186
+ " cannot infer the lifetime dependence scope on %0 with a ~Escapable "
8187
+ " parameter, specify '@lifetime(borrow %1)' or '@lifetime(copy %1)'" ,
8188
+ (StringRef, StringRef))
8189
+ ERROR(lifetime_dependence_cannot_infer_scope_ownership, none,
8190
+ " cannot borrow the lifetime of '%0', which has consuming ownership on %1" ,
8191
+ (StringRef, StringRef))
8192
+
8193
+ // ------------------------------------------------------------------------------
8194
+ // MARK: Lifetime Dependence Experimental Inference
8195
+ // ------------------------------------------------------------------------------
8196
+
8197
+ ERROR(lifetime_dependence_cannot_infer_no_candidates, none,
8198
+ " cannot infer lifetime dependence%0, no parameters found that are either "
8199
+ " ~Escapable or Escapable with a borrowing ownership" , (StringRef))
8200
+ ERROR(lifetime_dependence_cannot_infer_ambiguous_candidate, none,
8201
+ " cannot infer lifetime dependence%0, multiple parameters qualify as a candidate" , (StringRef))
8159
8202
8160
8203
// ===----------------------------------------------------------------------===//
8161
8204
// MARK: Sending
0 commit comments