@@ -689,6 +689,9 @@ NOTE(keypath_static_member_access_from_unsupported_module_note,none,
689689ERROR(expr_keypath_enum_case,none,
690690 " %select{key path|dynamic key path member lookup}1 cannot refer to enum case %0" ,
691691 (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 ))
692695ERROR(expr_keypath_empty,none,
693696 " empty key path does not refer to a property" , ())
694697ERROR(expr_unsupported_objc_key_path_component,none,
@@ -718,8 +721,8 @@ ERROR(expr_swift_keypath_empty, none,
718721 " key path must have at least one component" , ())
719722ERROR(expr_string_interpolation_outside_string,none,
720723 " 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))
723726ERROR(expr_smart_keypath_application_type_mismatch,none,
724727 " key path of type %0 cannot be applied to a base of type %1" ,
725728 (Type, Type))
@@ -1560,6 +1563,8 @@ ERROR(cannot_pass_inout_arg_to_subscript,none,
15601563 " cannot pass an inout argument to a subscript; use "
15611564 " 'withUnsafeMutablePointer' to explicitly convert argument "
15621565 " to a pointer" , ())
1566+ ERROR(cannot_pass_inout_arg_to_keypath_method,none,
1567+ " cannot pass an inout argument to a keypath method" , ())
15631568
15641569ERROR(incorrect_property_wrapper_reference,none,
15651570 " cannot convert value %0 of type %1 to expected type %2, "
@@ -5596,8 +5601,8 @@ ERROR(actor_isolated_keypath_component,none,
55965601 " cannot form key path to %0 %kind1" ,
55975602 (ActorIsolation, const ValueDecl *))
55985603ERROR(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 ))
56015606ERROR(local_function_executed_concurrently,none,
56025607 " concurrently-executed %kind0 must be marked as '@Sendable'" ,
56035608 (const ValueDecl *))
@@ -8089,7 +8094,7 @@ ERROR(pack_iteration_where_clause_not_supported, none,
80898094
80908095
80918096// ------------------------------------------------------------------------------
8092- // MARK: Lifetime Dependence Diagnostics
8097+ // MARK: Lifetime Dependence Syntax
80938098// ------------------------------------------------------------------------------
80948099
80958100ERROR(lifetime_dependence_invalid_param_name, none,
@@ -8108,34 +8113,15 @@ ERROR(lifetime_dependence_cannot_use_kind, none,
81088113ERROR(lifetime_dependence_cannot_use_parsed_scoped_consuming, none,
81098114 " invalid use of scoped lifetime dependence with consuming ownership" ,
81108115 ())
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- ())
81198116ERROR(lifetime_dependence_only_on_function_method_init_result, none,
81208117 " lifetime dependence specifiers may only be used on result of "
81218118 " 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" ,
81388122 ())
8123+ ERROR(lifetime_dependence_cannot_be_applied_to_tuple_elt, none,
8124+ " lifetime dependence specifiers cannot be applied to tuple elements" , ())
81398125ERROR(lifetime_dependence_immortal_conflict_name, none,
81408126 " conflict between the parameter name and 'immortal' contextual keyword" , ())
81418127ERROR(lifetime_dependence_function_type, none,
@@ -8144,18 +8130,75 @@ ERROR(lifetime_dependence_function_type, none,
81448130ERROR(lifetime_dependence_immortal_alone, none,
81458131 " cannot specify any other dependence source along with immortal" , ())
81468132ERROR(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 ))
81508136ERROR(lifetime_dependence_cannot_use_parsed_borrow_consuming, none,
81518137 " invalid use of borrow dependence with consuming ownership" ,
81528138 ())
8139+ ERROR(lifetime_dependence_cannot_use_parsed_borrow_inout, none,
8140+ " invalid use of borrow dependence on the same inout parameter" ,
8141+ ())
81538142ERROR(lifetime_dependence_duplicate_target, none,
81548143 " 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))
81558162
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))
81598202
81608203// ===----------------------------------------------------------------------===//
81618204// MARK: Sending
0 commit comments