//===--- DiagnosticsSema.def - Diagnostics Text -----------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines diagnostics emitted during semantic analysis and type // checking. // Each diagnostic is described using one of three kinds (error, warning, or // note) along with a unique identifier, category, options, and text, and is // followed by a signature describing the diagnostic argument kinds. // //===----------------------------------------------------------------------===// #define DEFINE_DIAGNOSTIC_MACROS #include "DefineDiagnosticMacros.h" #ifndef REMARK # define REMARK(ID,Options,Text,Signature) \ DIAG(REMARK,ID,Options,Text,Signature) #endif NOTE(decl_declared_here,none, "%0 declared here", (const ValueDecl *)) NOTE(decl_declared_here_base,none, "%base0 declared here", (const ValueDecl *)) NOTE(name_declared_here,none, "%0 declared here", (DeclName)) NOTE(kind_declared_here,none, "%0 declared here", (DescriptiveDeclKind)) NOTE(implicit_member_declared_here,none, "%kindbase0 is implicitly declared", (const ValueDecl *)) NOTE(extended_type_declared_here,none, "extended type declared here", ()) NOTE(opaque_return_type_declared_here,none, "opaque return type declared here", ()) NOTE(default_value_declared_here,none, "default value declared here", ()) NOTE(requirement_declared_here,none, "requirement %0 declared here", (const ValueDecl *)) //------------------------------------------------------------------------------ // MARK: Constraint solver diagnostics //------------------------------------------------------------------------------ ERROR(ambiguous_member_overload_set,none, "ambiguous reference to member %0", (DeclNameRef)) ERROR(no_overloads_match_exactly_in_call,none, "no exact matches in %select{reference|call}0 to %kindonly1 " "%select{%base1|}2", (bool, const ValueDecl *, bool)) NOTE(candidate_partial_match,none, "candidate has partially matching parameter list %0", (StringRef)) ERROR(could_not_find_value_subscript,none, "value of type %0 has no subscripts", (Type)) ERROR(could_not_find_tuple_member,none, "value of tuple type %0 has no member %1", (Type, DeclNameRef)) ERROR(could_not_find_value_member,none, "value of type %0 has no member %1", (Type, DeclNameRef)) ERROR(could_not_find_value_member_corrected,none, "value of type %0 has no member %1; did you mean %2?", (Type, DeclNameRef, DeclName)) ERROR(could_not_find_value_dynamic_member_corrected,none, "value of type %0 has no dynamic member %2 using key path from root type %1; did you mean %3?", (Type, Type, DeclNameRef, DeclName)) ERROR(could_not_find_value_dynamic_member,none, "value of type %0 has no dynamic member %2 using key path from root type %1", (Type, Type, DeclNameRef)) ERROR(cannot_infer_contextual_keypath_type_specify_root,none, "cannot infer key path type from context; consider explicitly specifying a root type", ()) ERROR(cannot_infer_keypath_root_anykeypath_context,none, "'AnyKeyPath' does not provide enough context for root type to be inferred; " "consider explicitly specifying a root type", ()) ERROR(could_not_find_type_member,none, "type %0 has no member %1", (Type, DeclNameRef)) ERROR(could_not_find_type_member_corrected,none, "type %0 has no member %1; did you mean %2?", (Type, DeclNameRef, DeclName)) ERROR(could_not_find_subscript_member_did_you_mean,none, "value of type %0 has no property or method named 'subscript'; " "did you mean to use the subscript operator?", (Type)) ERROR(could_not_find_subscript_member_tuple, none, "cannot access element using subscript for tuple type %0; " "use '.' notation instead", (Type)) ERROR(could_not_find_subscript_member_tuple_did_you_mean_use_dot, none, "cannot access element using subscript for tuple type %0; " "did you mean to use '.%1'?", (Type, StringRef)) ERROR(could_not_find_enum_case,none, "enum type %0 has no case %1; did you mean %2?", (Type, DeclNameRef, DeclName)) ERROR(could_not_find_imported_enum_case,none, "type %0 has no case %1, but it does have a case named %2; if %1 worked " "before, a recent change to the underlying C enum may have affected how " "prefixes are stripped from its case names", (Type, DeclNameRef, ValueDecl *)) NOTE(did_you_mean_raw_type,none, "did you mean to specify a raw type on the enum declaration?", ()) NOTE(did_you_mean_generic_param_as_conformance,none, "did you mean to declare %0 as a protocol conformance for %1?", (DeclName, Type)) NOTE(any_as_anyobject_fixit, none, "cast 'Any' to 'AnyObject' or use 'as!' to force downcast to a more specific type to access members", ()) ERROR(expected_argument_in_contextual_member,none, "member %0 expects argument of type %1", (const ValueDecl *, Type)) ERROR(expected_parens_in_contextual_member,none, "member %0 is a function; did you mean to call it?", (const ValueDecl *)) ERROR(expected_parens_in_contextual_member_type,none, "member %0 is a function that produces expected type %1; did you mean to " "call it?", (const ValueDecl *, Type)) ERROR(expected_result_in_contextual_member,none, "member %0 in %2 produces result of type %1, but context expects %2", (const ValueDecl *, Type, Type)) ERROR(unexpected_arguments_in_enum_case,none, "enum case %base0 has no associated values", (const ValueDecl *)) ERROR(could_not_use_type_member_on_instance,none, "static member %1 cannot be used on instance of type %0", (Type, DeclNameRef)) ERROR(could_not_use_enum_element_on_instance,none, "enum case %0 cannot be used as an instance member", (DeclNameRef)) ERROR(could_not_use_type_member_on_protocol_metatype,none, "static member %1 cannot be used on protocol metatype %0", (Type, DeclNameRef)) ERROR(could_not_use_instance_member_on_type,none, "instance member %1" "%select{| of type %2}3 cannot be used on" "%select{| instance of nested}3 type %0", (Type, DeclNameRef, Type, bool)) GROUPED_ERROR(could_not_use_member_on_existential,ExistentialMemberAccess,none, "member %1 cannot be used on value of type %0; consider using a" " generic constraint instead", (Type, DeclNameRef)) FIXIT(replace_with_type,"%0",(Type)) FIXIT(insert_type_qualification,"%0.",(Type)) ERROR(candidate_inaccessible,none, "%base0 is inaccessible due to " "'%select{private|fileprivate|internal|package|@_spi|@_spi}1' protection level", (const ValueDecl *, AccessLevel)) ERROR(init_candidate_inaccessible,none, "%0 initializer is inaccessible due to " "'%select{private|fileprivate|internal|package|@_spi|@_spi}1' protection level", (Type, AccessLevel)) GROUPED_ERROR(member_from_missing_import,MemberImportVisibility,none, "%kind0 is not available due to missing import of defining module %1", (const ValueDecl *, const ModuleDecl *)) GROUPED_ERROR(member_from_missing_imports_2_or_more,MemberImportVisibility,none, "%kind0 is not available due to missing imports of defining modules " "%2%select{ and|, }1 %3%select{|, and others}1", (const ValueDecl *, bool, const ModuleDecl *, const ModuleDecl *)) NOTE(candidate_add_import,none, "add import of module %0", (const ModuleDecl *)) GROUPED_WARNING(add_required_import_for_member,MemberImportVisibility,none, "import of module %0 is required", (const ModuleDecl *)) NOTE(decl_from_module_used_here,none, "%kind0 from %1 used here", (const ValueDecl *, const ModuleDecl *)) ERROR(cannot_pass_rvalue_mutating_subelement,none, "cannot use mutating member on immutable value: %0", (StringRef)) ERROR(cannot_pass_rvalue_mutating,none, "cannot use mutating member on immutable value of type %0", (Type)) ERROR(cannot_pass_rvalue_mutating_getter_subelement,none, "cannot use mutating getter on immutable value: %0", (StringRef)) ERROR(cannot_pass_rvalue_mutating_getter,none, "cannot use mutating getter on immutable value of type %0", (Type)) ERROR(expression_too_complex,none, "the compiler is unable to type-check this expression in reasonable time; " "try breaking up the expression into distinct sub-expressions", ()) ERROR(value_type_comparison_with_nil_illegal_did_you_mean,none, "value of type %0 cannot be compared by reference; " "did you mean to compare by value?", (Type)) ERROR(value_type_comparison_with_nil_illegal,none, "type %0 is not optional, value can never be nil", (Type)) ERROR(cannot_match_expr_pattern_with_value,none, "expression pattern of type %0 cannot match values of type %1", (Type, Type)) ERROR(cannot_match_expr_tuple_pattern_with_nontuple_value,none, "tuple pattern cannot match values of non-tuple type %0", (Type)) ERROR(cannot_match_unresolved_expr_pattern_with_value,none, "pattern cannot match values of type %0", (Type)) ERROR(cannot_match_value_with_pattern,none, "pattern of type %1 cannot match %0", (Type, Type)) ERROR(pattern_does_not_conform_to_match,none, "pattern of type %0 does not conform to expected match type %1", (Type, Type)) ERROR(cannot_reference_compare_types,none, "cannot check reference equality of functions; operands here have types " "%1 and %2", (StringRef, Type, Type)) ERROR(cannot_apply_binop_to_args,none, "binary operator '%0' cannot be applied to operands of type " "%1 and %2", (StringRef, Type, Type)) ERROR(cannot_apply_binop_to_same_args,none, "binary operator '%0' cannot be applied to two %1 operands", (StringRef, Type)) ERROR(cannot_apply_unop_to_arg,none, "unary operator '%0' cannot be applied to an operand of type %1", (StringRef, Type)) ERROR(cannot_apply_lvalue_unop_to_subelement,none, "cannot pass immutable value to mutating operator: %0", (StringRef)) ERROR(cannot_apply_lvalue_unop_to_rvalue,none, "cannot pass immutable value of type %0 to mutating operator", (Type)) ERROR(cannot_apply_lvalue_binop_to_subelement,none, "left side of mutating operator isn't mutable: %0", (StringRef)) ERROR(cannot_apply_lvalue_binop_to_rvalue,none, "left side of mutating operator has immutable type %0", (Type)) ERROR(cannot_subscript_nil_literal,none, "cannot subscript a nil literal value", ()) ERROR(conditional_cast_from_nil,none, "nil literal cannot be the source of a conditional cast", ()) ERROR(cannot_pass_rvalue_inout_subelement,none, "cannot pass immutable value as inout argument: %0", (StringRef)) ERROR(cannot_pass_rvalue_inout_converted,none, "inout argument could be set to a value with a type other than %0; " "use a value declared as type %1 instead", (Type, Type)) NOTE(inout_change_var_type_if_possible,none, "change variable type to %1 if it doesn't need to be declared as %0", (Type, Type)) ERROR(cannot_pass_rvalue_inout,none, "cannot pass immutable value of type %0 as inout argument", (Type)) ERROR(cannot_provide_default_value_inout,none, "cannot provide default value to inout parameter %0", (Identifier)) ERROR(cannot_call_non_function_value,none, "cannot call value of non-function type %0", (Type)) ERROR(no_candidates_match_result_type,none, "no '%0' candidates produce the expected contextual result type %1", (StringRef, Type)) ERROR(no_overloads_have_result_type_conformance,none, "no '%0' overloads produce result type that conforms to %1", (StringRef, Type)) ERROR(no_candidates_match_argument_type,none, "no '%0' candidates produce the expected type %1 for parameter #%2", (StringRef, Type, unsigned)) ERROR(cannot_infer_closure_parameter_type,none, "cannot infer type of closure parameter %0 without a type annotation", (StringRef)) ERROR(cannot_infer_closure_type,none, "unable to infer closure type without a type annotation", ()) ERROR(cannot_infer_empty_closure_result_type,none, "cannot infer return type of empty closure", ()) ERROR(cannot_infer_closure_result_type,none, "cannot infer return type for closure with multiple statements; " "add explicit type to disambiguate", ()) FIXIT(insert_closure_return_type_placeholder, "%select{| () }0-> <#Result#> %select{|in }0", (bool)) NOTE(use_of_anon_closure_param,none, "anonymous closure parameter %0 is used here", (Identifier)) ERROR(incorrect_explicit_closure_result_vs_contextual_type,none, "declared closure result %0 is incompatible with contextual type %1", (Type, Type)) ERROR(incorrect_explicit_closure_result_vs_return_type,none, "declared closure result %0 is incompatible with return type %1", (Type, Type)) ERROR(addressable_not_enabled,none, "'@_addressable' is an experimental feature", ()) ERROR(addressableSelf_not_on_method,none, "'@_addressableSelf' cannot be applied to non-member declarations", ()) ERROR(addressable_types_not_enabled,none, "'@_addressableForDependencies' is an experimental feature", ()) ERROR(class_cannot_be_addressable_for_dependencies,none, "a class cannot be '@_addressableForDependencies'", ()) ERROR(unsupported_closure_attr,none, "%select{attribute |}0%1 is not supported on a closure", (bool, DeclAttribute)) NOTE(suggest_partial_overloads,none, "overloads for '%1' exist with these %select{" "partially matching parameter lists|result types}0: %2", (bool, StringRef, StringRef)) NOTE(no_binary_op_overload_for_enum_with_payload,none, "binary operator '%0' cannot be synthesized for enums " "with associated values", (StringRef)) ERROR(cannot_convert_initializer_value,none, "cannot convert value of type %0 to specified type %1", (Type,Type)) ERROR(cannot_convert_initializer_value_protocol,none, "value of type %0 does not conform to specified type %1", (Type,Type)) ERROR(cannot_convert_initializer_value_anyobject,none, "value of type %0 expected to be instance of class or " "class-constrained type", (Type, Type)) ERROR(cannot_convert_initializer_value_nil,none, "'nil' cannot initialize specified type %0", (Type)) ERROR(cannot_convert_to_return_type,none, "cannot convert return expression of type %0 to return type %1", (Type,Type)) ERROR(cannot_convert_to_return_type_protocol,none, "return expression of type %0 does not conform to %1", (Type,Type)) ERROR(cannot_convert_return_type_to_anyobject,none, "return expression of type %0 expected to be an instance of " "a class or class-constrained type", (Type, Type)) ERROR(cannot_convert_to_return_type_nil,none, "'nil' is incompatible with return type %0", (Type)) ERROR(cannot_convert_thrown_type,none, "thrown expression type %0 %select{cannot be converted to error type %1|" "does not conform to 'Error'}2", (Type, Type, bool)) ERROR(cannot_throw_error_code,none, "thrown error code type %0 does not conform to 'Error'; construct an %1 " "instance", (Type, Type)) FIXIT(insert_type_coercion, " %select{as!|as}0 %1",(bool, Type)) ERROR(bad_yield_count,none, "expected %0 yield value(s)", (unsigned)) ERROR(cannot_throw_nil,none, "cannot infer concrete Error for thrown 'nil' value", ()) ERROR(cannot_convert_raw_initializer_value,none, "cannot convert value of type %0 to raw type %1", (Type,Type)) ERROR(cannot_convert_raw_initializer_value_nil,none, "cannot convert 'nil' to raw type %0", (Type)) ERROR(cannot_convert_default_arg_value,none, "default argument value of type %0 cannot be converted to type %1", (Type,Type)) ERROR(cannot_convert_default_arg_value_protocol,none, "default argument value of type %0 does not conform to %1", (Type,Type)) ERROR(cannot_convert_default_arg_value_nil,none, "nil default argument value cannot be converted to type %0", (Type)) ERROR(cannot_convert_argument_value,none, "cannot convert value of type %0 to expected argument type %1", (Type,Type)) ERROR(cannot_convert_unresolved_key_path_argument_value,none, "cannot convert value of key path type to expected argument type %0", (Type)) ERROR(cannot_convert_argument_value_for_swift_func,none, "cannot convert value of type %0 to expected argument type %1 " "because %kind2 was not imported from C header", (Type,Type, const ValueDecl *)) NOTE(candidate_has_invalid_argument_at_position,none, "candidate expects %select{|in-out }2value of type %0 for parameter #%1 (got %3)", (Type, unsigned, bool, Type)) NOTE(candidate_has_invalid_closure_at_position,none, "closure passed to parameter of type %0 that does not " "accept a closure", (Type)) ERROR(cannot_convert_array_to_variadic,none, "cannot pass array of type %0 as variadic arguments of type %1", (Type,Type)) NOTE(candidate_would_match_array_to_variadic,none, "candidate would match if array elements were passed as" " variadic arguments of type %0", (Type)) NOTE(suggest_pass_elements_directly,none, "remove brackets to pass array elements directly", ()) ERROR(cannot_convert_argument_value_generic,none, "cannot convert value of type %0 (%1) to expected argument type %2 (%3)", (Type, StringRef, Type, StringRef)) ERROR(conflicting_arguments_for_generic_parameter,none, "conflicting arguments to generic parameter %0 (%1)", (Type, StringRef)) NOTE(generic_parameter_inferred_from_closure,none, "generic parameter %0 inferred as %1 from closure return expression", (Type, Type)) NOTE(generic_parameter_inferred_from_result_context,none, "generic parameter %0 inferred as %1 from context", (Type, Type)) ERROR(cannot_convert_global_actor,none, "cannot convert function actor-isolated to %0 to function actor-isolated to %1", (Type,Type)) ERROR(cannot_convert_global_actor_coercion,none, "cannot convert value actor-isolated to %0 to function actor-isolated to %1 in coercion", (Type,Type)) ERROR(cannot_convert_argument_value_global_actor,none, "cannot convert value actor-isolated to %0 to expected argument type actor-isolated to %1", (Type,Type)) ERROR(cannot_convert_global_actor_contextual,none, "cannot convert value actor-isolated to %0 to specified type actor-isolated to %1", (Type,Type)) ERROR(cannot_convert_closure_result_global_actor,none, "cannot convert value actor-isolated to %0 to expected closure result type actor-isolated to %1", (Type,Type)) ERROR(cannot_convert_global_actor_mismatch_element,none, "cannot convert value actor-isolated to %0 to expected element type actor-isolated to %1", (Type,Type)) GROUPED_ERROR(cannot_convert_global_actor_mismatch_dict_value,TemporaryPointers,none, "cannot convert value actor-isolated to %0 to expected dictionary value type actor-isolated to %1", (Type,Type)) ERROR(cannot_convert_global_actor_mismatch_tuple_element,none, "cannot convert type actor-isolated to %0 to type actor-isolated to %1 at tuple element '#%2'", (Type,Type, unsigned)) ERROR(ternary_expr_cases_global_actor_mismatch,none, "result values in '? :' expression are functions isolated to different actors (%0 vs. %1)", (Type, Type)) // @_nonEphemeral conversion diagnostics GROUPED_ERROR(cannot_pass_type_to_non_ephemeral,TemporaryPointers,none, "cannot pass %0 to parameter; argument %1 must be a pointer that " "outlives the call%select{| to %2}2", (Type, StringRef, const ValueDecl *)) GROUPED_ERROR(cannot_use_inout_non_ephemeral,TemporaryPointers,none, "cannot use inout expression here; argument %0 must be a pointer that " "outlives the call%select{| to %1}1", (StringRef, const ValueDecl *)) GROUPED_ERROR(cannot_construct_dangling_pointer,TemporaryPointers,none, "initialization of %0 results in a dangling %select{|buffer }1pointer", (Type, unsigned)) NOTE(ephemeral_pointer_argument_conversion_note,none, "implicit argument conversion from %0 to %1 produces a pointer valid only " "for the duration of the call%select{| to %2}2", (Type, Type, const ValueDecl *)) NOTE(ephemeral_use_with_unsafe_pointer,none, "use 'withUnsafe%select{Bytes|MutableBytes|Pointer|MutablePointer}0' in " "order to explicitly convert argument to %select{buffer |buffer ||}0" "pointer valid for a defined scope", (unsigned)) NOTE(ephemeral_use_string_with_c_string,none, "use the 'withCString' method on String in order to explicitly " "convert argument to pointer valid for a defined scope", ()) NOTE(ephemeral_use_array_with_unsafe_buffer,none, "use the 'withUnsafe%select{Bytes|MutableBytes|BufferPointer|" "MutableBufferPointer}0' method on Array in order to explicitly convert " "argument to buffer pointer valid for a defined scope", (unsigned)) NOTE(candidate_performs_illegal_ephemeral_conv,none, "candidate expects pointer that outlives the call for parameter #%0", (unsigned)) ERROR(cannot_convert_argument_value_protocol,none, "argument type %0 does not conform to expected type %1", (Type, Type)) ERROR(cannot_convert_argument_value_anyobject,none, "argument type %0 expected to be an instance of " "a class or class-constrained type", (Type, Type)) ERROR(cannot_convert_argument_value_nil,none, "'nil' is not compatible with expected argument type %0", (Type)) NOTE(note_incompatible_argument_value_nil_at_pos,none, "'nil' is not compatible with expected argument type %0 at position #%1", (Type, unsigned)) ERROR(cannot_convert_condition_value,none, "cannot convert value of type %0 to expected condition type %1", (Type, Type)) ERROR(cannot_convert_condition_value_nil,none, "'nil' is not compatible with expected condition type %0", (Type)) ERROR(cannot_yield_rvalue_by_reference_same_type,none, "cannot yield immutable value of type %0 as an inout yield", (Type)) ERROR(cannot_yield_rvalue_by_reference,none, "cannot yield immutable value of type %0 as an inout yield of type %1", (Type,Type)) ERROR(cannot_yield_wrong_type_by_reference,none, "cannot yield reference to storage of type %0 as an inout yield of type %1", (Type,Type)) ERROR(cannot_convert_yield_value,none, "cannot convert value of type %0 to expected yield type %1", (Type,Type)) ERROR(cannot_convert_yield_value_protocol,none, "yielded type %0 does not conform to expected type %1", (Type,Type)) ERROR(cannot_convert_yield_value_nil,none, "nil is not compatible with expected yield type %0", (Type)) ERROR(cannot_convert_discard_value,none, "cannot convert value of type %0 to expected discard type %1", (Type,Type)) ERROR(cannot_convert_closure_result,none, "cannot convert value of type %0 to closure result type %1", (Type,Type)) ERROR(cannot_convert_closure_result_protocol,none, "result value of type %0 does not conform to closure result type %1", (Type, Type)) ERROR(cannot_convert_closure_result_nil,none, "'nil' is not compatible with closure result type %0", (Type)) ERROR(cannot_convert_parent_type,none, "cannot convert parent type %0 to expected type %1", (Type, Type)) ERROR(cannot_convert_chain_result_type,none, "member chain produces result of type %0 but contextual base was " "inferred as %1", (Type, Type)) NOTE(generic_argument_mismatch,none, "arguments to generic parameter %0 (%1 and %2) are expected to be equal", (Identifier, Type, Type)) ERROR(destructor_not_accessible,none, "deinitializers cannot be accessed", ()) // Array Element ERROR(cannot_convert_array_element,none, "cannot convert value of type %0 to expected element type %1", (Type,Type)) ERROR(cannot_convert_array_element_protocol,none, "value of type %0 does not conform to expected element type %1", (Type, Type)) ERROR(cannot_convert_array_element_nil,none, "'nil' is not compatible with expected element type %0", (Type)) // Dictionary Key ERROR(cannot_convert_dict_key,none, "cannot convert value of type %0 to expected dictionary key type %1", (Type,Type)) ERROR(cannot_convert_dict_key_protocol,none, "value of type %0 does not conform to expected dictionary key type %1", (Type, Type)) ERROR(cannot_convert_dict_key_nil,none, "'nil' is not compatible with expected dictionary key type %0", (Type)) // Dictionary Value ERROR(cannot_convert_dict_value,none, "cannot convert value of type %0 to expected dictionary value type %1", (Type,Type)) ERROR(cannot_convert_dict_value_protocol,none, "value of type %0 does not conform to expected dictionary value type %1", (Type, Type)) ERROR(cannot_convert_dict_value_nil,none, "'nil' is not compatible with expected dictionary value type %0", (Type)) // Coerce Expr ERROR(cannot_convert_coerce,none, "cannot convert value of type %0 to type %1 in coercion", (Type,Type)) ERROR(cannot_convert_coerce_protocol,none, "value of type %0 does not conform to %1 in coercion", (Type, Type)) ERROR(cannot_convert_coerce_nil,none, "'nil' is not compatible with type %0 in coercion", (Type)) // Assign Expr ERROR(cannot_convert_assign,none, "cannot assign value of type %0 to type %1", (Type,Type)) NOTE(assign_protocol_conformance_fix_it,none, "add missing conformance to %0 to %kind1", (Type, const NominalTypeDecl *)) ERROR(cannot_convert_assign_protocol,none, "value of type %0 does not conform to %1 in assignment", (Type, Type)) ERROR(cannot_convert_assign_anyobject,none, "value of type %0 expected to be an instance of " "a class or class-constrained type in assignment", (Type, Type)) ERROR(cannot_convert_assign_nil,none, "'nil' cannot be assigned to type %0", (Type)) // Subscript Assign Expr ERROR(cannot_convert_subscript_assign,none, "cannot assign value of type %0 to subscript of type %1", (Type,Type)) ERROR(cannot_convert_subscript_assign_protocol,none, "value of type %0 does not conform to %1 in subscript assignment", (Type, Type)) ERROR(cannot_convert_subscript_assign_nil,none, "'nil' cannot be assigned to subscript of type %0", (Type)) NOTE(cannot_convert_candidate_result_to_contextual_type,none, "%0 produces %1, not the expected contextual result type %2", (const ValueDecl *, Type, Type)) NOTE(overload_result_type_does_not_conform,none, "result type %1 of %0 does not conform to %2", (const ValueDecl *, Type, Type)) // for ... in expression ERROR(cannot_convert_sequence_element_value,none, "cannot convert sequence element type %0 to expected type %1", (Type, Type)) ERROR(cannot_convert_sequence_element_protocol,none, "sequence element type %0 does not conform to expected protocol %1", (Type, Type)) ERROR(throws_functiontype_mismatch,none, "invalid conversion from throwing function of type %0 to " "non-throwing function type %1", (Type, Type)) ERROR(thrown_error_type_mismatch,none, "invalid conversion of thrown error type %0 to %1", (Type, Type)) ERROR(async_functiontype_mismatch,none, "invalid conversion from 'async' function of type %0 to " "synchronous function type %1", (Type, Type)) ERROR(cannot_pass_async_func_to_sync_parameter,none, "cannot pass function of type %0 " "to parameter expecting synchronous function type", (Type)) NOTE(async_inferred_from_operation,none, "'async' inferred from asynchronous operation used here", ()) // Key-path expressions. ERROR(expr_keypath_no_objc_runtime,none, "'#keyPath' can only be used with the Objective-C runtime", ()) ERROR(expression_unused_keypath_result,NoUsage, "result of key path is unused", ()) ERROR(expr_keypath_non_objc_property,none, "argument of '#keyPath' refers to non-'@objc' property %0", (Identifier)) ERROR(expr_keypath_type_of_property,none, "cannot refer to type member %0 within instance of type %1", (DeclNameRef, Type)) ERROR(expr_keypath_generic_type,none, "key path cannot refer to generic type %0", (Identifier)) ERROR(expr_keypath_noncopyable_type,none, "key path cannot refer to noncopyable type %0", (Type)) ERROR(expr_keypath_nonescapable_type,none, "key path cannot refer to nonescapable type %0", (Type)) ERROR(expr_keypath_not_property,none, "%select{key path|dynamic key path member lookup}1 cannot refer to %kind0", (const ValueDecl *, bool)) ERROR(expr_keypath_type_ref,none, "%select{key path|dynamic key path member lookup}1 cannot refer to type %0", (const ValueDecl *, bool)) ERROR(expr_keypath_mutating_getter,none, "%select{key path|dynamic key path member lookup}1 cannot refer to %0, " "which has a mutating getter", (const ValueDecl *, bool)) ERROR(expr_keypath_static_member,none, "%select{key path|dynamic key path member lookup}1 cannot refer to static member %0", (const ValueDecl *, bool)) ERROR(keypath_static_member_access_from_unsupported_module,none, "%select{key path|dynamic key path member lookup}3 cannot refer " "to static member %1 of type %0 from module %2", (Type, const ValueDecl *, const ModuleDecl *, bool)) NOTE(keypath_static_member_access_from_unsupported_module_note,none, "rebuild %0 to enable static member use in key paths", (const ModuleDecl *)) ERROR(expr_keypath_enum_case,none, "%select{key path|dynamic key path member lookup}1 cannot refer to enum case %0", (const ValueDecl *, bool)) ERROR(expr_keypath_mutating_method,none, "%select{key path|dynamic key path member lookup}1 cannot refer to mutating method %0", (const ValueDecl *, bool)) ERROR(expr_keypath_empty,none, "empty key path does not refer to a property", ()) ERROR(expr_unsupported_objc_key_path_component,none, "an Objective-C key path cannot contain " "%select{BAD|subscript|BAD|BAD|optional-forcing|optional-chaining|BAD} " "components", (unsigned)) ERROR(expr_unsupported_objc_key_path_compound_name,none, "an Objective-C key path cannot reference a declaration with a " "compound name", ()) ERROR(expr_keypath_no_keypath_type,none, "broken standard library: no 'KeyPath' type found", ()) ERROR(expr_swift_keypath_invalid_component,none, "invalid component of Swift key path", ()) ERROR(expr_swift_keypath_not_starting_with_type,none, "a Swift key path must begin with a type", ()) ERROR(expr_swift_keypath_not_starting_with_dot,none, "a Swift key path with contextual root must begin with a leading dot", ()) ERROR(expr_keypath_value_covert_to_contextual_type,none, "key path value type %0 cannot be converted to contextual type %1", (Type, Type)) ERROR(expr_keypath_type_covert_to_contextual_type,none, "cannot convert key path type %0 to contextual type %1", (Type, Type)) ERROR(expr_swift_keypath_empty, none, "key path must have at least one component", ()) ERROR(expr_string_interpolation_outside_string,none, "string interpolation can only appear inside a string literal", ()) ERROR(expr_keypath_arg_or_index_not_hashable, none, "%select{method argument|subscript index}0 of type %1 in a key path must be Hashable", (bool, Type)) ERROR(expr_smart_keypath_application_type_mismatch,none, "key path of type %0 cannot be applied to a base of type %1", (Type, Type)) ERROR(expr_keypath_root_type_mismatch, none, "cannot convert key path root type %0 to contextual type %1", (Type, Type)) ERROR(expr_keypath_type_mismatch, none, "cannot convert key path of type %0 to contextual type %1", (Type, Type)) ERROR(expr_keypath_application_root_type_mismatch, none, "key path with root type %0 cannot be applied to a base of type %1", (Type, Type)) ERROR(expr_swift_keypath_anyobject_root,none, "the root type of a Swift key path cannot be 'AnyObject'", ()) ERROR(expr_keypath_multiparam_func_conversion, none, "cannot convert key path into a multi-argument function type %0", (Type)) ERROR(cannot_convert_type_to_keypath_subscript_index,none, "cannot use value of type %0 as a key path subscript index; argument must be" " a key path", (Type)) WARNING(expr_deprecated_writable_keypath,Deprecation, "forming a writable keypath to property %0 that is read-only in this context " "is deprecated and will be removed in a future release", (const ValueDecl *)) // Selector expressions. ERROR(expr_selector_no_objc_runtime,none, "'#selector' can only be used with the Objective-C runtime", ()) ERROR(expr_selector_module_missing,none, "import the 'ObjectiveC' module to use '#selector'", ()) ERROR(expr_selector_no_declaration,none, "argument of '#selector' does not refer to an '@objc' method, property, " "or initializer", ()) ERROR(expr_selector_not_method,none, "argument of '#selector' cannot refer to %select{local|global}0 " "function %1", (bool, const ValueDecl *)) ERROR(expr_selector_expected_property,none, "cannot reference %kind1 as a property; remove '%select{getter|setter}0:'", (bool, const ValueDecl *)) ERROR(expr_selector_not_property,none, "argument of '#selector' cannot refer to %select{variable|parameter}0 %1", (bool, const ValueDecl *)) ERROR(expr_selector_expected_method,none, "use 'getter:'%select{| or 'setter:'}0 to refer to the Objective-C getter" "%select{| or setter}0 of property %1%select{|, respectively}0", (bool, const ValueDecl *)) NOTE(expr_selector_add_modifier,none, "add '%select{getter|setter}0:' to reference the Objective-C " "%select{getter|setter}0 for %1", (bool, const ValueDecl *)) ERROR(expr_selector_property_not_settable,none, "argument of '#selector(setter:)' refers to non-settable %kind0", (const ValueDecl *)) ERROR(expr_selector_property_setter_inaccessible,none, "setter of %kind0 is inaccessible", (const ValueDecl *)) ERROR(expr_selector_cannot_be_used,none, "cannot use %base0 as a selector because protocol %1 is not exposed to Objective-C", (const ValueDecl *, const ValueDecl *)) ERROR(expr_selector_not_objc,none, "argument of '#selector' refers to %kind0 that is not exposed to " "Objective-C", (const ValueDecl *)) NOTE(make_decl_objc,none, "add '@objc' to expose this %kindonly0 to Objective-C", (const ValueDecl *)) NOTE(make_decl_objc_for_implementation,none, "add '@objc' to implement an Objective-C %kindonly0", (const Decl *)) // Selectors-as-string-literals. WARNING(selector_literal_invalid,none, "string literal is not a valid Objective-C selector", ()) WARNING(selector_literal_undeclared,none, "no method declared with Objective-C selector %0", (ObjCSelector)) WARNING(selector_literal_deprecated,Deprecation, "use of string literal for Objective-C selectors is deprecated; " "use '#selector' or explicitly construct a 'Selector'", ()) WARNING(selector_literal_deprecated_suggest,Deprecation, "use of string literal for Objective-C selectors is deprecated; " "use '#selector' instead", ()) WARNING(selector_construction_suggest,none, "use '#selector' instead of explicitly constructing a 'Selector'", ()) NOTE(selector_construction_suppress_warning,none, "wrap the selector name in parentheses to suppress this warning", ()) ERROR(cannot_return_value_from_void_func,none, "unexpected non-void return value in void function", ()) NOTE(add_return_type_note,none, "did you mean to add a return type?", ()) ERROR(expect_compile_time_literal,none, "expect a compile-time constant literal", ()) ERROR(const_unsupported_enum_associated_value,none, "enums with associated values not supported in a '@const' expression", ()) ERROR(const_unsupported_operator,none, "unsupported operator in a '@const' expression", ()) ERROR(const_unsupported_type,none, "unsupported type in a '@const' expression", ()) ERROR(const_unsupported_type_expr,none, "type expressions not supported in a '@const' expression", ()) ERROR(const_unsupported_closure,none, "closures not supported in a '@const' expression", ()) ERROR(const_unsupported_keypath,none, "keypaths not supported in a '@const' expression", ()) ERROR(const_opaque_decl_ref,none, "unable to resolve variable reference in a '@const' expression", ()) ERROR(const_opaque_func_decl_ref,none, "unable to resolve function reference in a '@const' expression", ()) ERROR(const_non_convention_c_conversion,none, "only 'convention(c)' function values are supported in a '@const' expression", ()) ERROR(const_opaque_callee,none, "unable to resolve callee in a '@const' expression", ()) ERROR(const_non_const_param,none, "reference to a non-'@const' parameter in a '@const' expression", ()) ERROR(const_unknown_default,none, "not supported in a '@const' expression", ()) //------------------------------------------------------------------------------ // MARK: Import Resolution //------------------------------------------------------------------------------ ERROR(sema_no_import,Fatal, "no such module '%0'", (StringRef)) NOTE(did_you_mean_cxxstdlib,none, "did you mean 'CxxStdlib'?'", ()) ERROR(sema_no_import_target,Fatal, "could not find module '%0' for target '%1'; " "found: %2, at: %3", (StringRef, StringRef, StringRef, StringRef)) ERROR(sema_no_import_repl,none, "no such module '%0'", (StringRef)) NOTE(sema_no_import_no_sdk,none, "did you forget to set an SDK using -sdk or SDKROOT?", ()) NOTE(sema_no_import_no_sdk_xcrun,none, "use \"xcrun swiftc\" to select the default macOS SDK " "installed with Xcode", ()) WARNING(sema_import_current_module,none, "this file is part of module %0; ignoring import", (Identifier)) WARNING(sema_import_current_module_with_file,none, "file '%0' is part of module %1; ignoring import", (StringRef, Identifier)) ERROR(sema_opening_import,Fatal, "opening import file for module %0: %1", (Identifier, StringRef)) REMARK(serialization_skipped_invalid_decl,none, "serialization skipped invalid %kind0", (const Decl *)) REMARK(serialization_skipped_invalid_type,none, "serialization skipped for invalid type %0", (TypeRepr *)) REMARK(serialization_skipped_invalid_type_unknown_name,none, "serialization skipped for invalid type", ()) ERROR(serialization_failed,none, "serialization of module %0 failed due to the errors above", (const ModuleDecl *)) WARNING(can_import_invalid_swiftmodule,none, "canImport() evaluated to false due to invalid swiftmodule: %0", (StringRef)) ERROR(map_os_version_from_textual_interface_failed,none, "failed to map OS version from %0 to %1 in %2", (StringRef, StringRef, StringRef)) ERROR(serialization_load_failed,Fatal, "failed to load module '%0'", (StringRef)) ERROR(module_interface_build_failed,Fatal, "failed to %select{build module '%1' for importation|" "verify module interface of '%1'}0 due to the errors above; " "the textual interface may be broken by project issues" "%select{, differences between compilers (the producer '%3' and this compiler '%4')|}2 or a compiler bug", (bool, StringRef, bool, StringRef, StringRef)) ERROR(module_interface_build_failed_mismatching_compiler,Fatal, "failed to build module '%0'; this SDK is not supported by the compiler " "(the SDK is built with '%1', while this compiler is '%2'). Please select a toolchain which matches the SDK.", (StringRef, StringRef, StringRef)) ERROR(serialization_malformed_module,Fatal, "malformed compiled module: %0", (StringRef)) ERROR(serialization_module_too_new,Fatal, "compiled module was created by a newer version of the compiler: %0", (StringRef)) ERROR(serialization_module_language_version_mismatch,Fatal, "module compiled with Swift %0 cannot be imported by the Swift %1 " "compiler: %2", (StringRef, StringRef, StringRef)) ERROR(serialization_module_too_old,Fatal, "compiled module was created by an older version of the compiler; " "rebuild %0 and try again: %1", (Identifier, StringRef)) ERROR(serialization_module_incompatible_revision,Fatal, "compiled module was created by a different version of the compiler '%0'; " "rebuild %1 and try again: %2", (StringRef, Identifier, StringRef)) ERROR(serialization_module_incompatible_channel,Fatal, "the binary module for %2 was compiled for '%0', " "it cannot be imported by the current compiler " "which is aligned with '%1'. " "Binary module loaded from path: %3", (StringRef, StringRef, Identifier, StringRef)) ERROR(serialization_missing_single_dependency,Fatal, "missing required module '%0'", (StringRef)) ERROR(serialization_missing_dependencies,Fatal, "missing required modules: %0", (StringRef)) ERROR(serialization_circular_dependency,Fatal, "circular dependency between modules '%0' and %1", (StringRef, Identifier)) ERROR(serialization_missing_underlying_module,Fatal, "cannot load underlying module for %0", (Identifier)) ERROR(serialization_name_mismatch,Fatal, "cannot load module '%0' as '%1'", (StringRef, StringRef)) ERROR(serialization_name_mismatch_repl,none, "cannot load module '%0' as '%1'", (StringRef, StringRef)) ERROR(serialization_target_incompatible,Fatal, "module %0 was created for incompatible target %1: %2", (Identifier, StringRef, StringRef)) ERROR(serialization_sdk_mismatch,Fatal, "cannot load module %0 built with SDK '%1' when using SDK '%2': %3", (Identifier, StringRef, StringRef, StringRef)) ERROR(serialization_target_incompatible_repl,none, "module %0 was created for incompatible target %1: %2", (Identifier, StringRef, StringRef)) ERROR(serialization_target_too_new,Fatal, "compiling for %0 %1, but module %2 has a minimum " "deployment target of %0 %3: %4", (StringRef, llvm::VersionTuple, Identifier, llvm::VersionTuple, StringRef)) ERROR(serialization_target_too_new_repl,none, "compiling for %0 %1, but module %2 has a minimum " "deployment target of %0 %3: %4", (StringRef, llvm::VersionTuple, Identifier, llvm::VersionTuple, StringRef)) ERROR(serialization_non_ossa_module_incompatible, Fatal, "cannot import non-OSSA module into an OSSA module", (Identifier)) ERROR(serialization_fatal,Fatal, "fatal error encountered while reading from module '%0'; " SWIFT_BUG_REPORT_MESSAGE, (StringRef)) ERROR(serialization_invalid_decl,Fatal, "deserialized invalid declaration %0 (%kindonly0) in module %1", (const Decl *, const ModuleDecl *)) ERROR(serialization_allowing_invalid_decl,none, "allowing deserialization of invalid declaration %0 (%kindonly0) in " "module %1", (const Decl *, const ModuleDecl *)) ERROR(serialization_error_type,Fatal, "deserialized error type '%0' in module '%1'", (StringRef, StringRef)) ERROR(serialization_allowing_error_type,none, "allowing deserialization of error type '%0' in module '%1'", (StringRef, StringRef)) WARNING(serialization_malformed_sourceinfo,none, "'%0' is either malformed or generated by a different Swift version. " "Note that it uses an unstable format and may leak internal project " "details, it should not be distributed alongside modules", (StringRef)) ERROR(need_hermetic_seal_to_import_module,none, "module %0 was built with -experimental-hermetic-seal-at-link, but " "current compilation does not have -experimental-hermetic-seal-at-link", (Identifier)) ERROR(cannot_import_embedded_module,none, "module %0 cannot be imported because it was built with embedded Swift", (Identifier)) ERROR(cannot_import_non_embedded_module,none, "module %0 cannot be imported in embedded Swift mode", (Identifier)) ERROR(volatile_is_experimental,none, "importing _Volatile module requires '-enable-experimental-feature Volatile'", ()) ERROR(need_cxx_interop_to_import_module,none, "module %0 was built with C++ interoperability enabled, but " "current compilation does not enable C++ interoperability", (Identifier)) NOTE(enable_cxx_interop_docs,none, "visit https://www.swift.org/documentation/cxx-interop/project-build-setup to learn how to enable C++ interoperability", ()) ERROR(cxx_stdlib_kind_mismatch,none, "module %0 was built with %1, but current compilation uses %2", (Identifier, StringRef, StringRef)) ERROR(modularization_issue_decl_moved,Fatal, "reference to %select{top-level declaration|type}0 %1 broken by a context change; " "%1 was expected to be in %2, but now a candidate is found only in %3", (bool, DeclName, const ModuleDecl*, const ModuleDecl*)) ERROR(modularization_issue_decl_type_changed,Fatal, "reference to %select{top-level declaration|type}0 %1 broken by a context change; " "the declaration kind of %1 %select{from %2|}5 changed since building '%3'" "%select{|, it was in %2 and now a candidate is found only in %4}5", (bool, DeclName, const ModuleDecl*, StringRef, const ModuleDecl*, bool)) ERROR(modularization_issue_decl_not_found,Fatal, "reference to %select{top-level declaration|type}0 %1 broken by a context change; " "%1 is not found, it was expected to be in %2", (bool, DeclName, const ModuleDecl*)) NOTE(modularization_issue_note_expected,none, "the %select{declaration|type}0 was expected to be found in module %1 at '%2'", (bool, const ModuleDecl*, StringRef)) NOTE(modularization_issue_note_expected_underlying,none, "or expected to be found in the underlying module '%0' defined at '%1'", (StringRef, StringRef)) NOTE(modularization_issue_note_found,none, "the %select{declaration|type}0 was actually found in module %1 at '%2'", (bool, const ModuleDecl*, StringRef)) NOTE(modularization_issue_stale_module,none, "the module %0 has enabled library-evolution; " "the following file may need to be deleted if the SDK was modified: '%1'", (const ModuleDecl *, StringRef)) NOTE(modularization_issue_type_mismatch,none, "a candidate was filtered out because of a type mismatch; " "expected: %0, found: %1", (const Type, const Type)) NOTE(modularization_issue_swift_version,none, "the module %0 was built with a Swift language version set to %1 " "while the current invocation uses %2; " "APINotes may change how clang declarations are imported", (const ModuleDecl *, llvm::VersionTuple, llvm::VersionTuple)) NOTE(modularization_issue_audit_headers,none, "declarations in the %select{underlying |}0clang module %1 " "may be hidden by clang preprocessor macros", (bool, const ModuleDecl*)) NOTE(modularization_issue_layering_expected_local,none, "the distributed module %0 refers to the local module %1; " "this may be caused by header maps or search paths", (const ModuleDecl*, const ModuleDecl*)) NOTE(modularization_issue_layering_found_local,none, "the reference may break layering; the candidate was found in " "the local module %1 for a reference from the distributed module %0", (const ModuleDecl*, const ModuleDecl*)) NOTE(modularization_issue_related_modules,none, "the %select{declaration|type}0 %1 moved between related modules; " "clang preprocessor macros may affect headers shared between these modules", (bool, DeclName)) NOTE(interface_block_listed_broken,none, "textual interface for %0 is blocklisted as broken; " "interface verification errors are downgraded to warnings", (StringRef)) NOTE(modularization_issue_side_effect_extension_error,none, "could not deserialize extension", ()) NOTE(modularization_issue_side_effect_type_error,none, "could not deserialize type for %0", (DeclName)) NOTE(modularization_issue_worked_around,none, "attempting forced recovery enabled by " "-experimental-force-workaround-broken-modules", ()) ERROR(modularization_issue_conformance_xref_error,none, "Conformance of %0 to %1 not found in referenced module %2", (DeclName, DeclName, DeclName)) NOTE(modularization_issue_conformance_xref_note,none, "Breaks conformances of '%0' to %1", (StringRef, DeclName)) ERROR(modularization_issue_conformance_error,none, "Conformances of '%0' " "do not match requirement signature of %1; " "%2 conformances for %3 requirements", (StringRef, DeclName, unsigned int, unsigned int)) ERROR(reserved_member_name,none, "type member must not be named %0, since it would conflict with the" " 'foo.%1' expression", (const ValueDecl *, StringRef)) NOTE(invalid_redecl_by_optionality_note,none, "%select{implicitly unwrapped |}0optional parameter is of " "same type as %select{implicitly unwrapped |}1optional parameter", (bool, bool)) ERROR(invalid_redecl,none,"invalid redeclaration of %0", (const ValueDecl *)) ERROR(invalid_redecl_init,none, "invalid redeclaration of synthesized %select{|memberwise }1%0", (const ValueDecl *, bool)) ERROR(invalid_redecl_implicit,none, "invalid redeclaration of synthesized " "%select{%kindonly0|implementation for protocol requirement}1 %2", (const ValueDecl *, bool, const ValueDecl *)) WARNING(invalid_redecl_swift5_warning,Deprecation, "redeclaration of %0 is deprecated and will be an error in Swift 5", (const ValueDecl *)) NOTE(invalid_redecl_prev,none, "%0 previously declared here", (const ValueDecl *)) NOTE(invalid_redecl_prev_name,none, "%0 previously declared here", (DeclName)) NOTE(invalid_redecl_implicit_wrapper,none, "%0 synthesized for property wrapper " "%select{projected value|backing storage}1", (const ValueDecl *, bool)) ERROR(protocol_extension_in_where_clause,none, "%0 was defined in extension of protocol %1 and cannot be referenced " "from a %select{'where' clause|generic parameter inheritance clause|" "associated type inheritance clause}2", (Identifier, Identifier, unsigned)) NOTE(protocol_extension_in_where_clause_note,none, "consider moving %0 into the definition of protocol %1", (Identifier, Identifier)) ERROR(ambiguous_type_base,none, "%0 is ambiguous for type lookup in this context", (DeclNameRef)) ERROR(invalid_member_type,none, "%0 is not a member type of %1 %2", (DeclNameRef, DescriptiveDeclKind, FullyQualified)) ERROR(invalid_member_type_suggest,none, "%0 does not have a member type named %1; did you mean %2?", (Type, DeclNameRef, const TypeDecl *)) ERROR(invalid_member_reference,none, "%kind0 is not a member type of %1", (const ValueDecl *, Type)) ERROR(ambiguous_member_type,none, "ambiguous type name %0 in %1", (DeclNameRef, Type)) ERROR(no_module_type,none, "no type named %0 in module %1", (DeclNameRef, Identifier)) ERROR(ambiguous_module_type,none, "ambiguous type name %0 in module %1", (DeclNameRef, Identifier)) ERROR(use_nonmatching_operator,none, "%0 is not a %select{binary|prefix unary|postfix unary}1 operator", (DeclNameRef, unsigned)) ERROR(unsupported_recursion_in_associated_type_reference,none, "unsupported recursion for reference to %kind0 of type %1", (const ValueDecl *, Type)) ERROR(broken_associated_type_witness,none, "reference to invalid %kind0 of type %1", (const ValueDecl *, Type)) ERROR(unspaced_binary_operator_fixit,none, "missing whitespace between %0 and %1 operators", (Identifier, Identifier, bool)) ERROR(unspaced_binary_operator,none, "ambiguous missing whitespace between unary and binary operators", ()) NOTE(unspaced_binary_operators_candidate,none, "could be %select{binary|postfix}2 %0 and %select{prefix|binary}2 %1", (Identifier, Identifier, bool)) ERROR(unspaced_unary_operator,none, "unary operators must not be juxtaposed; parenthesize inner expression", ()) ERROR(nonexistent_power_operator,none, "no operator '**' is defined; did you mean 'pow(_:_:)'?", ()) ERROR(cannot_find_in_scope,none, "cannot %select{find|find operator}1 %0 in scope", (DeclNameRef, bool)) ERROR(cannot_find_in_scope_corrected,none, "cannot %select{find|find operator}1 %0 in scope; did you mean '%2'?", (DeclNameRef, bool, StringRef)) ERROR(cannot_find_self_in_scope,none, "cannot find 'self' in scope; did you mean to use it in a type or extension context?", ()) NOTE(confusable_character,none, "%select{identifier|operator}0 '%1' contains possibly confused characters; " "did you mean to use '%2'?", (bool, StringRef, StringRef)) NOTE(single_confusable_character,none, "%select{identifier|operator}0 '%1' (%2) looks similar to '%3' (%4); did you mean '%3' (%4)?", (bool, StringRef, StringRef, StringRef, StringRef)) ERROR(cannot_find_type_in_scope,none, "cannot find type %0 in scope", (DeclNameRef)) ERROR(cannot_find_type_in_cast_expression,none, "type-casting operator expects a type on its right-hand side (got: %kind0)", (const ValueDecl *)) ERROR(cannot_find_type_in_scope_did_you_mean,none, "cannot find type %0 in scope; did you mean to use '%1'?", (DeclNameRef, StringRef)) NOTE(note_typo_candidate_implicit_member,none, "did you mean the implicitly-synthesized %kindbase0?", (const ValueDecl *)) NOTE(note_remapped_type,none, "did you mean to use '%0'?", (StringRef)) NOTE(note_module_as_type,none, "cannot use module %0 as a type", (Identifier)) ERROR(use_unknown_object_literal_protocol,none, "cannot deduce protocol for %0 literal", (StringRef)) ERROR(object_literal_default_type_missing,none, "could not infer type of %0 literal", (StringRef)) NOTE(object_literal_resolve_import,none, "import %0 to use '%1' as the default %2 literal type", (StringRef, StringRef, StringRef)) ERROR(use_local_before_declaration,none, "use of local variable %0 before its declaration", (DeclNameRef)) ERROR(decl_does_not_exist_in_module,none, "%select{%error|type|struct|class|enum|protocol|variable|function}0 " "%1 does not exist in module %2", (/*ImportKind*/ unsigned, Identifier, Identifier)) ERROR(imported_decl_is_wrong_kind,none, "%0 was imported as '%1', but is " "%select{%error|a type|a struct|a class|an enum|a protocol|a variable|" "a function}2", (Identifier, StringRef, /*ImportKind*/ unsigned)) ERROR(imported_decl_is_wrong_kind_typealias,none, "%0 %1 cannot be imported as '%2'", (DescriptiveDeclKind, Type, StringRef)) ERROR(ambiguous_decl_in_module,none, "ambiguous name %0 in module %1", (Identifier, Identifier)) GROUPED_ERROR(module_not_testable,ModuleNotTestable,Fatal, "module %0 was not compiled for testing", (Identifier)) ERROR(module_not_compiled_for_private_import,none, "module %0 was not compiled for private import", (Identifier)) ERROR(in_package_module_not_compiled_from_source_or_package_interface,none, "module %0 is in package '%1' but was built from a non-package interface; " "modules of the same package can only be loaded if built from source or package interface: %2", (Identifier, StringRef, StringRef)) WARNING(in_package_module_not_compiled_locally,none, "module %0 is in package %1 but was loaded from SDK; " "modules of the same package should be built locally from source only: %2", (Identifier, Identifier, StringRef)) ERROR(import_restriction_conflict,none, "module %0 cannot be both " "%select{implementation-only|SPI only|exported}1 and " "%select{implementation-only|SPI only|exported}2 ", (Identifier, unsigned, unsigned)) ERROR(module_not_compiled_with_library_evolution,none, "module %0 was not compiled with library evolution support; " "using it means binary compatibility for %1 can't be guaranteed", (Identifier, Identifier)) GROUPED_WARNING(implementation_only_requires_library_evolution, ImplementationOnlyDeprecated,none, "using '@_implementationOnly' without enabling library evolution " "for %0 may lead to instability during execution", (Identifier)) GROUPED_WARNING(implementation_only_deprecated, ImplementationOnlyDeprecated,none, "'@_implementationOnly' is deprecated, use 'internal import' instead", ()) ERROR(module_allowable_client_violation,none, "module %0 doesn't allow importation from module %1", (Identifier, Identifier)) REMARK(cross_import_added,none, "import of %0 and %1 triggered a cross-import of %2", (Identifier, Identifier, Identifier)) REMARK(module_loaded,none, "loaded module %0" "%select{| (overlay for a clang dependency)}1" "; source: '%2', loaded: '%3'", (Identifier, unsigned, StringRef, StringRef)) REMARK(module_api_import,none, "%select{|implicitly used }4" "%kind0 is imported via %1" "%select{, which reexports definition from %2|}3", (const Decl *, ModuleDecl *, ModuleDecl *, bool, bool)) REMARK(module_api_import_conformance,none, "conformance of %0 to %kind1 used here is imported via %2" "%select{ which reexports the definition from %3|}4", (const Type, const Decl *, ModuleDecl *, ModuleDecl *, bool)) REMARK(module_api_import_aliases,none, "typealias underlying type %kind0 is imported via %1" "%select{, which reexports definition from %2|}3", (const Decl *, ModuleDecl *, ModuleDecl *, bool)) REMARK(macro_loaded,none, "loaded macro implementation module %0 from " "%select{shared library '%2'|executable '%2'|" "compiler plugin server '%2' with shared library '%3'}1", (Identifier, unsigned, StringRef, StringRef)) ERROR(resolved_macro_changed,none, "resolved macro library '%0' failed verification: %1", (StringRef, StringRef)) REMARK(transitive_dependency_behavior,none, "%1 has %select{a required|an optional|an ignored}2 " "transitive dependency on '%0'", (StringRef, Identifier, unsigned)) REMARK(explicit_interface_build_skipped,none, "Skipped rebuilding module at %0 - up-to-date", (StringRef)) GROUPED_WARNING(cannot_find_module_version,ModuleVersionMissing,none, "cannot find user version number for%select{| Clang}1 module '%0';" " version number ignored", (StringRef, bool)) // Operator decls ERROR(ambiguous_operator_decls,none, "ambiguous operator declarations found for operator", ()) NOTE(found_this_operator_decl,none, "found this matching operator declaration", ()) ERROR(operator_redeclared,none, "operator redeclared", ()) NOTE(previous_operator_decl,none, "previous operator declaration here", ()) ERROR(declared_operator_without_operator_decl,none, "operator implementation without matching operator declaration", ()) ERROR(declared_unary_op_without_attribute,none, "unary operator implementation must have a 'prefix' or 'postfix' modifier", ()) ERROR(unary_op_missing_prepos_attribute,none, "%select{prefix|postfix}0 unary operator missing " "'%select{prefix|postfix}0' modifier", (bool)) NOTE(unary_operator_declaration_here,none, "%select{prefix|postfix}0 operator found here", (bool)) ERROR(invalid_arg_count_for_operator,none, "operators must have one or two arguments", ()) ERROR(operator_in_local_scope,none, "operator functions can only be declared at global or in type scope", ()) ERROR(nonstatic_operator_in_nominal,none, "operator %0 declared in type %1 must be 'static'", (Identifier, const NominalTypeDecl *)) ERROR(nonstatic_operator_in_extension,none, "operator %0 declared in extension%select{| of %2}1 must be 'static'", (Identifier, bool, TypeRepr*)) ERROR(nonfinal_operator_in_class,none, "operator %0 declared in non-final class %1 must be 'final'", (Identifier, Type)) ERROR(operator_in_unrelated_type,none, "member operator %2%select{| of protocol %0}1 must have at least one " "argument of type %select{%0|'Self'}1", (Type, bool, const FuncDecl *)) // Precedence groups ERROR(ambiguous_precedence_groups,none, "multiple precedence groups found", ()) NOTE(found_this_precedence_group,none, "found this matching precedence group", ()) ERROR(unknown_precedence_group,none, "unknown precedence group %0", (Identifier)) ERROR(precedence_group_cycle,none, "cycle in '%select{lowerThan|higherThan}0' relation", (bool)) ERROR(higher_than_precedence_group_cycle,none, "cycle in higherThan relation: %0", (StringRef)) ERROR(precedence_group_lower_within_module,none, "precedence group cannot be given lower precedence than group in same" " module; make the other precedence group higher than this one instead", ()) ERROR(precedence_group_redeclared,none, "precedence group redeclared", ()) NOTE(previous_precedence_group_decl,none, "previous precedence group declaration here", ()) NOTE(circular_reference_through_precedence_group, none, "through reference to precedence group %0 here", (Identifier)) //------------------------------------------------------------------------------ // MARK: Expression Type Checking Errors //------------------------------------------------------------------------------ ERROR(tuple_types_not_convertible_nelts,none, "%0 is not convertible to %1, " "tuples have a different number of elements", (Type, Type)) ERROR(tuple_types_not_convertible,none, "tuple type %0 is not convertible to tuple type %1", (Type, Type)) ERROR(invalid_force_unwrap,none, "cannot force unwrap value of non-optional type %0", (Type)) ERROR(invalid_optional_chain,none, "cannot use optional chaining on non-optional value of type %0", (Type)) ERROR(ternary_expr_cases_mismatch,none, "result values in '? :' expression have mismatching types %0 and %1", (Type, Type)) // Statements as expressions ERROR(single_value_stmt_branches_mismatch,none, "branches have mismatching types %0 and %1", (Type, Type)) ERROR(single_value_stmt_out_of_place,none, "'%0' may only be used as expression in return, throw, or as the source " "of an assignment", (StmtKind)) ERROR(single_value_stmt_must_be_unlabeled,none, "'%0' cannot have a jump label when used as expression", (StmtKind)) ERROR(if_expr_must_be_syntactically_exhaustive,none, "'if' must have an unconditional 'else' to be used as expression", ()) ERROR(do_catch_expr_must_be_syntactically_exhaustive,none, "'do catch' must have an unconditional 'catch' to be used as expression", ()) ERROR(single_value_stmt_branch_empty,none, "expected expression in branch of '%0' expression", (StmtKind)) ERROR(single_value_stmt_branch_must_end_in_result,none, "non-expression branch of '%0' expression may only end with a 'throw'" "%select{| or 'fallthrough'}1", (StmtKind, bool)) ERROR(cannot_jump_in_single_value_stmt,none, "cannot use '%0' to transfer control out of '%1' expression", (StmtKind, StmtKind)) WARNING(effect_marker_on_single_value_stmt,none, "'%0' has no effect on '%1' expression", (StringRef, StmtKind)) ERROR(out_of_place_then_stmt,none, "'then' may only appear as the last statement in an 'if', 'switch', or " "'do' expression", ()) ERROR(did_not_call_function_value,none, "function value was used as a property; add () to call it", ()) ERROR(did_not_call_function,none, "function %0 was used as a property; add () to call it", (DeclBaseName)) ERROR(did_not_call_method,none, "method %0 was used as a property; add () to call it", (DeclBaseName)) ERROR(init_not_instance_member_use_assignment,none, "'init' is a member of the type; use assignment " "to initialize the value instead", ()) ERROR(init_not_instance_member,none, "'init' is a member of the type; use 'type(of: ...)' to initialize " "a new object of the same dynamic type", ()) ERROR(super_initializer_not_in_initializer,none, "'super.init' cannot be called outside of an initializer", ()) WARNING(isa_is_always_true,none, "'%0' test is always true", (StringRef)) WARNING(isa_is_foreign_check,none, "'is' test is always true because %0 is a Core Foundation type", (Type)) WARNING(checked_cast_not_supported,none, "runtime conversion from %0 to %1 is not supported; " "%select{'is' test|cast}2 always fails", (Type, Type, unsigned)) NOTE(checked_cast_not_supported_coerce_instead,none, "consider using 'as' coercion instead", ()) WARNING(conditional_downcast_coercion,none, "conditional cast from %0 to %1 always succeeds", (Type, Type)) WARNING(literal_conditional_downcast_to_coercion,none, "cast from literal of inferred type %0 to unrelated type %1 always fails; " "consider using 'as' coercion", (Type, Type)) WARNING(forced_downcast_noop,none, "forced cast of %0 to same type has no effect", (Type)) WARNING(forced_downcast_coercion,none, "forced cast from %0 to %1 always succeeds; did you mean to use 'as'?", (Type, Type)) // Note: the Boolean at the end indicates whether bridging is required after // the cast. WARNING(downcast_same_type,none, "forced cast from %0 to %1 %select{only unwraps optionals|only unwraps " "and bridges}3; did you mean to use '%2'%select{| with 'as'}3?", (Type, Type, StringRef, bool)) // The unsigned value can be 0 (types are equal), 1 (types implicitly convert), // or 2 (types bridge). WARNING(conditional_downcast_same_type,none, "conditional downcast from %0 to %1 %select{does nothing|" "is equivalent to an implicit conversion to an optional %1|is a " "bridging conversion; did you mean to use 'as'?}2", (Type, Type, unsigned)) WARNING(is_expr_same_type,none, "checking a value with optional type %0 against type %1 " "succeeds whenever the value is non-nil; did you mean to use " "'!= nil'?", (Type, Type)) WARNING(downcast_to_unrelated,none, "cast from %0 to unrelated type %1 always fails", (Type, Type)) NOTE(downcast_to_unrelated_fixit,none, "did you mean to call %0 with '()'?", (Identifier)) ERROR(optional_chain_noop,none, "optional chain has no effect, expression already produces %0", (Type)) ERROR(optional_chain_isnt_chaining,none, "'?' must be followed by a call, member lookup, or subscript", ()) ERROR(pattern_in_expr,none, "%0 cannot appear in an expression", (DescriptivePatternKind)) ERROR(conditional_cast_in_type_casting_pattern,none, "cannot conditionally downcast in a type-casting pattern", ()) ERROR(force_cast_in_type_casting_pattern,none, "cannot force downcast in a type-casting pattern", ()) ERROR(cannot_bind_value_with_is,none, "use 'as' keyword to bind a matched value", ()) NOTE(note_call_to_operator,none, "in call to operator %0", (const ValueDecl *)) NOTE(note_call_to_func,none, "in call to function %0", (const ValueDecl *)) NOTE(note_call_to_subscript,none, "in call to %0", (const ValueDecl *)) NOTE(note_call_to_initializer,none, "in call to initializer", ()) ERROR(missing_nullary_call,none, "function produces expected type %0; did you mean to call it with '()'?", (Type)) ERROR(optional_not_unwrapped,none, "value of optional type %0 must be unwrapped to a value of type %1", (Type, Type)) NOTE(unwrap_with_default_value,none, "coalesce using '?" "?' to provide a default when the optional value " "contains 'nil'", ()) NOTE(unwrap_with_force_value,none, "force-unwrap using '!' to abort execution if the optional value contains " "'nil'", ()) NOTE(unwrap_iuo_initializer,none, "value inferred to be type %0 when initialized with an implicitly " "unwrapped value", (Type)) NOTE(unwrap_with_guard,none, "short-circuit using 'guard' to exit this function early " "if the optional value contains 'nil'", ()) NOTE(perform_optional_chain_on_function_type, none, "use optional chaining to call this value of function type when optional " "is non-'nil'", ()) ERROR(optional_base_not_unwrapped,none, "value of optional type %0 must be unwrapped to refer to member %1 of " "wrapped base type %2", (Type, DeclNameRef, Type)) ERROR(invalid_optional_inferred_keypath_root, none, "key path root inferred as optional type %0 must be unwrapped to refer to member %1 " "of unwrapped type %2", (Type, DeclNameRef, Type)) NOTE(optional_base_chain,none, "chain the optional using '?' to access member %0 only for non-'nil' " "base values", (DeclNameRef)) NOTE(optional_base_remove_optional_for_keypath_root, none, "use unwrapped type %0 as key path root", (Type)) NOTE(optional_keypath_application_base, none, "use '?' to access key path subscript only for non-'nil' base values", ()) ERROR(optional_self_not_unwrapped,none, "explicit use of 'self' is required when 'self' is optional, " "to make control flow explicit", ()) NOTE(optional_self_chain,none, "reference 'self?.' explicitly", ()) ERROR(missing_unwrap_optional_try,none, "value of optional type %0 not unwrapped; did you mean to use 'try!' " "or chain with '?'?", (Type)) ERROR(cannot_coerce_to_type, none, "%0 is not convertible to %1", (Type, Type)) NOTE(missing_forced_downcast, none, "did you mean to use 'as!' to force downcast?", ()) NOTE(missing_optional_downcast, none, "did you mean to use 'as?' to conditionally downcast?", ()) WARNING(coercion_may_fail_warning,none, "coercion from %0 to %1 may fail; use 'as?' or 'as!' instead", (Type, Type)) WARNING(tuple_label_mismatch_warning,none, "tuple conversion from %0 to %1 mismatches labels", (Type, Type)) ERROR(missing_explicit_conversion,none, "%0 is not implicitly convertible to %1; " "did you mean to use 'as' to explicitly convert?", (Type, Type)) ERROR(missing_address_of,none, "passing value of type %0 to an inout parameter requires explicit '&'", (Type)) ERROR(missing_address_of_yield,none, "yielding mutable value of type %0 requires explicit '&'", (Type)) ERROR(missing_address_of_return,none, "returning mutable value from a mutate accessor requires explicit '&'", ()) ERROR(extraneous_address_of,none, "'&' may only be used to pass an argument to inout parameter", ()) ERROR(extra_address_of,none, "'&' used with non-inout argument of type %0", (Type)) ERROR(extra_address_of_unsafepointer,none, "'&' is not allowed passing array value as %0 argument", (Type)) ERROR(cannot_pass_inout_arg_to_subscript,none, "cannot pass an inout argument to a subscript; use " "'withUnsafeMutablePointer' to explicitly convert argument " "to a pointer", ()) ERROR(cannot_pass_inout_arg_to_keypath_method,none, "cannot pass an inout argument to a keypath method", ()) ERROR(incorrect_property_wrapper_reference,none, "cannot convert value %0 of type %1 to expected type %2, " "use %select{wrapper|wrapped value}3 instead", (Identifier, Type, Type, bool)) ERROR(incorrect_property_wrapper_reference_member,none, "referencing %kind0 requires %select{wrapper|wrapped value of type}1 %2", (const ValueDecl *, bool, Type)) ERROR(missing_init_on_metatype_initialization,none, "initializing from a metatype value must reference 'init' explicitly", ()) ERROR(extra_argument_labels,none, "extraneous argument label%select{|s}0 '%1' in " "%select{call|subscript|macro expansion}2", (bool, StringRef, unsigned)) ERROR(missing_argument_labels,none, "missing argument label%select{|s}0 '%1' in " "%select{call|subscript|macro expansion}2", (bool, StringRef, unsigned)) ERROR(wrong_argument_labels,none, "incorrect argument label%select{|s}0 in " "%select{call|subscript|macro expansion}3 " "(have '%1', expected '%2')", (bool, StringRef, StringRef, unsigned)) ERROR(argument_out_of_order_named_named,none, "argument %0 must precede argument %1", (Identifier, Identifier)) ERROR(argument_out_of_order_named_unnamed,none, "argument %0 must precede unnamed argument #%1", (Identifier, unsigned)) ERROR(argument_out_of_order_unnamed_named,none, "unnamed argument #%0 must precede argument %1", (unsigned, Identifier)) ERROR(argument_out_of_order_unnamed_unnamed,none, "unnamed argument #%0 must precede unnamed argument #%1", (unsigned, unsigned)) ERROR(argument_out_of_order_binary_op,none, "operator argument #%0 must precede operator argument #%1", (unsigned, unsigned)) NOTE(candidate_expected_different_labels,none, "incorrect labels for candidate (have: '%0', expected: '%1')", (StringRef, StringRef)) ERROR(member_shadows_function,none, "use of %0 refers to %1 rather than %kind2", (DeclNameRef, DescriptiveDeclKind, const ValueDecl *)) ERROR(member_shadows_global_function,none, "use of %0 refers to %1 rather than %kind2 in module %3", (DeclNameRef, DescriptiveDeclKind, const ValueDecl *, DeclName)) ERROR(instance_member_use_on_type,none, "instance member %1 cannot be used on type %0; " "did you mean to use a value of this type instead?", (Type, DeclNameRef)) ERROR(instance_member_in_initializer,none, "cannot use instance member %0 within property initializer; " "property initializers run before 'self' is available", (DeclNameRef)) ERROR(instance_member_in_default_parameter,none, "cannot use instance member %0 as a default parameter", (DeclNameRef)) ERROR(missing_argument_named,none, "missing argument for parameter %0 in " "%select{call|subscript|macro expansion}1", (Identifier, unsigned)) ERROR(missing_argument_positional,none, "missing argument for parameter #%0 in " "%select{call|subscript|macro expansion}1", (unsigned, unsigned)) ERROR(missing_arguments_in_call,none, "missing arguments for parameters %0 in " "%select{call|subscript|macro expansion}1", (StringRef, unsigned)) ERROR(extra_argument_named,none, "extra argument %0 in %select{call|subscript|macro expansion}1", (Identifier, unsigned)) ERROR(extra_argument_positional,none, "extra argument in %select{call|subscript|macro expansion}0", (unsigned)) ERROR(extra_arguments_in_call,none, "extra %select{arguments|trailing closures}0 at positions %1 in call", (bool, StringRef)) ERROR(extra_argument_to_nullary_call,none, "argument passed to %select{call|subscript|macro expansion}0 " "that takes no arguments", (unsigned)) ERROR(extra_trailing_closure_in_call,none, "extra trailing closure passed in " "%select{call|subscript|macro expansion}0", (unsigned)) ERROR(closure_bad_param,none, "%select{|trailing }1closure passed to parameter of type %0 that does not " "accept a closure", (Type, bool)) GROUPED_WARNING(unlabeled_trailing_closure_deprecated, TrailingClosureMatching,Deprecation, "backward matching of the unlabeled trailing closure is deprecated; label the argument with %0 to suppress this warning", (Identifier)) NOTE(candidate_with_extraneous_args_closure,none, "candidate %0 requires %1 argument%s1, " "but %2 %select{were|was}3 used in closure body", (Type, unsigned, unsigned, bool)) NOTE(candidate_with_extraneous_args,none, "candidate %0 has %1 parameter%s1, but context %2 has %3", (Type, unsigned, Type, unsigned)) ERROR(result_builder_missing_element,none, "expected expression in result builder %0", (DeclName)) ERROR(result_builder_missing_element_of_type,none, "expected expression of type %0 in result builder %1", (Type, DeclName)) ERROR(no_accessible_initializers,none, "%0 cannot be constructed because it has no accessible initializers", (Type)) ERROR(unbound_generic_parameter,none, "generic parameter %0 could not be inferred", (Type)) ERROR(unbound_generic_parameter_cast,none, "generic parameter %0 could not be inferred in cast to %1", (Type, Type)) NOTE(archetype_declared_in_type,none, "%0 declared as parameter to type %1", (Type, Type)) NOTE(unbound_generic_parameter_explicit_fix,none, "explicitly specify the generic arguments to fix this issue", ()) GROUPED_ERROR(invalid_dynamic_callable_type,DynamicCallable,none, "'@dynamicCallable' requires %0 to have either a valid " "'dynamicallyCall(withArguments:)' method or " "'dynamicallyCall(withKeywordArguments:)' method", (Type)) GROUPED_ERROR(missing_dynamic_callable_kwargs_method,DynamicCallable,none, "'@dynamicCallable' type %0 cannot be applied with keyword arguments; " "missing 'dynamicCall(withKeywordArguments:)' method", (Type)) ERROR(invalid_dynamic_member_lookup_type,none, "'@dynamicMemberLookup' requires %0 to have a " "'subscript(dynamicMember:)' method that accepts either " "'ExpressibleByStringLiteral' or a key path", (Type)) NOTE(invalid_dynamic_member_subscript, none, "add an explicit argument label to this subscript to satisfy " "the '@dynamicMemberLookup' requirement", ()) ERROR(dynamic_member_lookup_candidate_inaccessible,none, "'@dynamicMemberLookup' requires %0 to be as accessible as its " "enclosing type", (ValueDecl *)) ERROR(too_many_dynamic_member_lookups,none, "could not find member %0; exceeded the maximum number of nested " "dynamic member lookups", (DeclNameRef)) ERROR(string_index_not_integer,none, "String must not be indexed with %0, it has variable size elements", (Type)) NOTE(string_index_not_integer_note,none, "consider using an existing high level algorithm, " "str.startIndex.advanced(by: n), or a projection like str.utf8", ()) ERROR(invalid_c_function_pointer_conversion_expr,none, "a C function pointer can only be formed from a reference to a 'func' or " "a literal closure", ()) ERROR(c_function_pointer_from_method,none, "a C function pointer cannot be formed from a method", ()) ERROR(c_function_pointer_from_generic_function,none, "a C function pointer cannot be formed from a reference to a generic " "function", ()) ERROR(invalid_autoclosure_forwarding,none, "add () to forward '@autoclosure' parameter", ()) ERROR(invalid_differentiable_function_conversion_expr,none, "a '@differentiable' function can only be formed from " "a reference to a 'func' or 'init' or a literal closure", ()) NOTE(invalid_differentiable_function_conversion_parameter,none, "did you mean to take a '%0' closure?", (StringRef)) ERROR(invalid_autoclosure_pointer_conversion,none, "cannot perform pointer conversion of value of type %0 to autoclosure " "result type %1", (Type, Type)) //------------------------------------------------------------------------------ // MARK: Type Check Declarations //------------------------------------------------------------------------------ ERROR(missing_initializer_def,PointsToFirstBadToken, "initializer requires a body", ()) // Attributes ERROR(operator_not_func,none, "operators must be declared with 'func'", ()) ERROR(redefining_builtin_operator,none, "cannot declare a custom %0 '%1' operator", (DeclAttribute, StringRef)) ERROR(attribute_requires_operator_identifier,none, "%0 requires a function with an operator identifier", (DeclAttribute)) ERROR(attribute_requires_single_argument,none, "%0 requires a function with one argument", (DeclAttribute)) ERROR(nominal_type_not_attribute,none, "%kind0 cannot be used as an attribute", (const ValueDecl *)) ERROR(mutating_invalid_global_scope,none, "%0 is only valid on methods", (SelfAccessKind)) ERROR(mutating_invalid_classes,none, "%0 is not valid on %kindonly1s in " "%select{classes|class-bound protocols}2", (SelfAccessKind, const FuncDecl *, bool)) ERROR(functions_mutating_and_not,none, "method must not be declared both %0 and %1", (SelfAccessKind, SelfAccessKind)) ERROR(static_functions_not_mutating,none, "static functions must not be declared mutating", ()) ERROR(readwriter_mutatingness_differs_from_reader_or_writer_mutatingness,none, "%0 cannot be %1 when " "%select{both the %3 is %4 and the %5 is not %6|either the %3 is not %4 or the %5 is %6|the %3 is not %4|the %5 is %6}2", (StringRef, SelfAccessKind, unsigned, StringRef, SelfAccessKind, StringRef, SelfAccessKind)) ERROR(transparent_in_protocols_not_supported,none, "'@_transparent' attribute is not supported on declarations within protocols", ()) ERROR(transparent_in_classes_not_supported,none, "'@_transparent' attribute is not supported on declarations within classes", ()) ERROR(iboutlet_nonobjc_class,none, "'@IBOutlet' property cannot %select{have|be an array of}0 " "non-'@objc' class type %1", (bool, Type)) ERROR(iboutlet_nonobjc_protocol,none, "'@IBOutlet' property cannot %select{have|be an array of}0 " "non-'@objc' protocol type %1", (bool, Type)) ERROR(iboutlet_nonobject_type,none, "'@IBOutlet' property cannot %select{have|be an array of}0 " "non-object type %1", (bool, Type)) ERROR(iboutlet_only_mutable,none, "'@IBOutlet' requires property to be mutable", ()) ERROR(iboutlet_non_optional,none, "'@IBOutlet' property has non-optional type %0", (Type)) NOTE(note_make_optional,none, "add '?' to form the optional type %0", (Type)) NOTE(note_make_implicitly_unwrapped_optional,none, "add '!' to form an implicitly unwrapped optional", ()) ERROR(invalid_ibdesignable_extension,none, "'@IBDesignable' can only be applied to classes and extensions " "of classes", ()) ERROR(attr_must_be_used_on_class_instance,none, "only class instance properties can be declared %0", (DeclAttribute)) ERROR(invalid_ibaction_decl,none, "only instance methods can be declared %0", (DeclAttribute)) ERROR(invalid_ibaction_result,none, "methods declared %0 must %select{|not }1return a value", (DeclAttribute, bool)) ERROR(invalid_ibaction_argument_count,none, "%0 methods must have %1 to %2 arguments", (DeclAttribute, int, int)) ERROR(invalid_ibaction_argument_count_exact,none, "%0 methods must have %2 argument%s2", (DeclAttribute, int, int)) ERROR(invalid_ibaction_argument_count_max,none, "%0 methods must have at most %2 argument%s2", (DeclAttribute, int, int)) ERROR(ibsegueaction_objc_method_family,none, "%0 method cannot have selector %1 because it has special memory " "management behavior", (DeclAttribute, ObjCSelector)) NOTE(fixit_rename_in_swift,none, "change Swift name to %0", (DeclName)) NOTE(fixit_rename_in_objc,none, "change Objective-C selector to %0", (ObjCSelector)) NOTE(remove_async_add_task,none, "remove 'async' and wrap in 'Task' to use concurrency in %0", (const FuncDecl *)) ERROR(no_objc_tagged_pointer_not_class_protocol,none, "'@unsafe_no_objc_tagged_pointer' can only be applied to class protocols", ()) ERROR(swift_native_objc_runtime_base_not_on_root_class,none, "'@_swift_native_objc_runtime_base_not_on_root_class' can only be " "applied to root classes", ()) WARNING(objc_implementation_early_spelling_deprecated,none, "'@_objcImplementation' is deprecated; use '@implementation' instead", ()) ERROR(attr_objc_implementation_must_be_unconditional,none, "only unconditional extensions can implement an Objective-C '@interface'", ()) ERROR(attr_objc_implementation_must_be_imported,none, "'@objc @implementation' cannot be used to extend %kind0 because it was " "defined by a Swift 'class' declaration, not an imported Objective-C " "'@interface' declaration", (ValueDecl *)) ERROR(attr_objc_implementation_must_have_super,none, "'@objc @implementation' cannot be used to implement root %kind0; " "declare its superclass in the header", (ValueDecl *)) ERROR(objc_implementation_cannot_have_generics,none, "'@objc @implementation' cannot be used to implement %kind0", (ValueDecl *)) ERROR(attr_objc_implementation_category_not_found,none, "could not find category %0 on Objective-C class %1; make sure your " "umbrella or bridging header imports the header that declares it", (Identifier, ValueDecl*)) ERROR(attr_objc_implementation_func_not_found,none, "could not find imported function '%0' matching %kind1; make sure your " "umbrella or bridging header imports the header that declares it", (StringRef, ValueDecl*)) NOTE(attr_objc_implementation_fixit_remove_category_name,none, "remove arguments to implement the main '@interface' for this class", ()) ERROR(attr_objc_implementation_no_category_for_func,none, "%kind0 does not belong to an Objective-C category; remove the category " "name from this attribute", (ValueDecl*)) ERROR(attr_objc_implementation_no_conformance,none, "'@objc @implementation' extension cannot add conformance to %0; " "add this conformance %select{with an ordinary extension|" "in the Objective-C header}1", (Type, bool)) ERROR(attr_objc_implementation_raise_minimum_deployment_target,none, "'@implementation' of an Objective-C class requires a minimum deployment " "target of at least %0 %1", (AvailabilityDomain, AvailabilityRange)) ERROR(attr_implementation_requires_language,none, "'@implementation' used without specifying the language being " "implemented", ()) ERROR(attr_implementation_category_goes_on_objc_attr,none, "Objective-C category should be specified on '@objc', not " "'@implementation'", ()) ERROR(attr_not_allowed_in_c_functions,none, "attribute %0 is not allowed in C function conventions", (StringRef)) WARNING(objc_implementation_will_become_objc,none, "%kind0 will become implicitly '@objc' after adopting '@objc " "@implementation'; add '%select{@nonobjc|final}1' to keep the current " "behavior", (const ValueDecl *, /*suggestFinal=*/bool)) WARNING(objc_implementation_will_become_nonobjc,none, "%kind0 will no longer be implicitly '@objc' after adopting '@objc " "@implementation'; add '@objc' to keep the current " "behavior", (const ValueDecl *)) ERROR(member_of_objc_implementation_not_objc_or_final,none, "%kind0 does not match any %kindonly0 declared in the headers for %1; " "did you use the %kindonly0's Swift name?", (ValueDecl *, ValueDecl *)) NOTE(fixit_add_private_for_objc_implementation,none, "add 'private' or 'fileprivate' to define an Objective-C-compatible " "%kindonly0 not declared in the header", (const ValueDecl *)) NOTE(fixit_add_nonobjc_or_final_for_objc_implementation,none, "add '%select{@nonobjc|final}1' to define a Swift-only %kindonly0" "%select{| that cannot be overridden}1", (const ValueDecl *, /*suggestFinal=*/bool)) ERROR(objc_implementation_wrong_category,none, "%kind0 should be implemented in extension for " "%select{main class interface|category %1}1, not " "%select{main class interface|category %2}2", (ValueDecl *, Identifier, Identifier)) ERROR(objc_implementation_wrong_decl_kind,none, "%kind0 does not match the %kindonly1 declared by the header", (const ValueDecl *, const ValueDecl *)) ERROR(objc_implementation_must_be_settable,none, "%kind0 should be settable to match the settable %kindonly1 declared by " "the header", (const ValueDecl *, const ValueDecl *)) ERROR(objc_implementation_type_mismatch,none, "%kind0 of type %1 does not match type %2 declared by the header", (ValueDecl *, Type, Type)) ERROR(objc_implementation_sendability_mismatch,none, "sendability of function types in %kind0 of type %1 does not match " "type %2 declared by the header", (ValueDecl *, Type, Type)) ERROR(objc_implementation_required_attr_mismatch,none, "%kind0 should%select{ not|}2 be 'required' to match %kindonly1 declared " "by the header", (const ValueDecl *, const ValueDecl *, bool)) ERROR(objc_implementation_candidate_has_error_convention,none, "%kind0 does not match the declaration in the header because it throws an " "error", (const ValueDecl *)) ERROR(objc_implementation_candidate_lacks_error_convention,none, "%kind0 does not match the declaration in the header because it does not " "throw an error", (const ValueDecl *)) #define SELECT_FOREIGN_ERROR_CONVENTION_KIND \ "select{returning zero|returning non-zero|returning zero or a result|" \ "returning nil|setting the error parameter|%error}" ERROR(objc_implementation_mismatched_error_convention_kind,none, "%kind0 does not match the declaration in the header because it indicates " "an error by %" SELECT_FOREIGN_ERROR_CONVENTION_KIND "1, rather than by " "%" SELECT_FOREIGN_ERROR_CONVENTION_KIND "2", (const ValueDecl *, unsigned, unsigned)) ERROR(objc_implementation_mismatched_error_convention_index,none, "%kind0 does not match the declaration in the header because it uses " "parameter #%1 for the error, not parameter #%2; a selector part called " "'error:' can control which parameter to use", (const ValueDecl *, unsigned, unsigned)) ERROR(objc_implementation_mismatched_error_convention_void_param,none, "%kind0 does not match the declaration in the header because it " "%select{removes the error parameter|makes the error parameter 'Void'}1 " "rather than %select{making it 'Void'|removing it}1", (const ValueDecl *, bool)) ERROR(objc_implementation_mismatched_error_convention_ownership,none, "%kind0 does not match the declaration in the header because it " "%select{does not own|owns}1 the error parameter", (const ValueDecl *, bool)) ERROR(objc_implementation_mismatched_error_convention_other,none, "%kind0 does not match the declaration in the header because it uses a " "different Objective-C error convention; please file a bug report with a " "sample project, as the compiler should be able to describe the mismatch", (const ValueDecl *)) ERROR(objc_implementation_wrong_objc_name,none, "selector %0 for %kind1 not found in header; did you mean %2?", (ObjCSelector, ValueDecl *, ObjCSelector)) ERROR(objc_implementation_wrong_swift_name,none, "selector %0 used in header by %kindonly1 with a different name; did " "you mean %1?", (ObjCSelector, const ValueDecl *)) ERROR(objc_implementation_missing_impls,none, "extension for %select{main class interface|category %0}0 does not " "provide all required implementations", (Identifier)) NOTE(objc_implementation_missing_impls_fixit,none, "add stub%s0 for missing '@implementation' requirement%s0", (unsigned)) NOTE(objc_implementation_missing_impl,none, "missing %kind0", (ValueDecl *)) NOTE(objc_implementation_missing_impl_either,none, "missing %kind0 or %1", (ValueDecl *, ValueDecl *)) ERROR(objc_implementation_class_or_instance_mismatch,none, "%kind0 does not match %kindonly1 declared in header", (const ValueDecl *, const ValueDecl *)) ERROR(objc_implementation_multiple_matching_candidates,none, "found multiple implementations that could match %kind0 with selector %1", (ValueDecl *, ObjCSelector)) NOTE(objc_implementation_candidate_impl_here,none, "%kind0 is a potential match%select{|; insert '@objc(%2)' to use it}1", (ValueDecl *, bool, StringRef)) NOTE(objc_implementation_requirement_here,none, "%kind0 declared in header here", (ValueDecl *)) ERROR(objc_implementation_init_must_be_convenience, none, "%kind0 is not valid in an '@objc @implementation' extension because " "Objective-C subclasses must be able to override " "%select{designated|required}1 initializers", (const ValueDecl *, /*isRequired=*/bool)) NOTE(objc_implementation_init_turn_designated_to_convenience, none, "add 'convenience' keyword to make this a convenience initializer", ()) NOTE(objc_implementation_init_turn_required_to_convenience, none, "replace 'required' keyword with 'convenience' to make this a convenience " "initializer", ()) // Fallback diagnostic; super-general by nature. ERROR(objc_implementation_member_requires_vtable, none, "%kind0 is not valid in an '@objc @implementation' extension because it " "is an overridable Swift-only %kindonly0", (const ValueDecl *)) ERROR(objc_implementation_multiple_matching_requirements,none, "%kind0 could match several different members declared in the header", (ValueDecl *)) NOTE(objc_implementation_one_matched_requirement,none, "%kind0 (with selector %1) is a potential match%select{|; insert " "'@objc(%3)' to use it}2", (ValueDecl *, ObjCSelector, bool, StringRef)) WARNING(wrap_objc_implementation_will_become_error,none, "%0; this will become an error after adopting '@implementation'", (DiagnosticInfo *)) ERROR(cdecl_not_at_top_level,none, "%0 can only be applied to global functions", (DeclAttribute)) ERROR(cdecl_empty_name,none, "%0 symbol name cannot be empty", (DeclAttribute)) ERROR(cdecl_throws,none, "raising errors from %0 functions is not supported", (DeclAttribute)) ERROR(cdecl_incompatible_with_objc,none, "cannot apply both '@cdecl' and '@objc' to %kindonly0", (const Decl *)) ERROR(cdecl_feature_required,none, "'@cdecl' requires '-enable-experimental-feature CDecl'", ()) // @_used and @_section ERROR(section_linkage_markers_disabled,none, "attribute requires '-enable-experimental-feature SymbolLinkageMarkers'", ()) ERROR(section_empty_name,none, "'@_section' section name cannot be empty", ()) // @_silgen_name and friends WARNING(reserved_runtime_symbol_name,none, "symbol name '%0' is reserved for the Swift runtime and cannot be " "directly referenced without causing unpredictable behavior; " "this will become an error", (StringRef)) // @_extern ERROR(attr_extern_experimental,none, "'@_extern' requires '-enable-experimental-feature Extern'", ()) ERROR(extern_not_at_top_level_func,none, "'@_extern' can only be applied to global functions", ()) ERROR(extern_empty_c_name,none, "expected non-empty C name in '@_extern'", ()) ERROR(extern_only_non_other_attr,none, "'@_extern' cannot be applied to an %0 declaration", (DeclAttribute)) WARNING(extern_c_maybe_invalid_name, none, "C name '%0' may be invalid; explicitly specify the name in " "'@_extern(c)' to suppress this warning", (StringRef)) // @_staticExclusiveOnly ERROR(attr_static_exclusive_only_disabled,none, "attribute requires '-enable-experimental feature StaticExclusiveOnly'", ()) ERROR(attr_static_exclusive_only_noncopyable,none, "'@_staticExclusiveOnly' can only be applied to noncopyable types", ()) ERROR(attr_static_exclusive_only_let_only,none, "variable of type %0 must be declared with a 'let'", (Type)) NOTE(attr_static_exclusive_only_type_nonmutating,none, "%0 is a non-mutable type", (Type)) ERROR(attr_static_exclusive_only_let_only_param,none, "parameter of type %0 must be declared as either 'borrowing' or 'consuming'", (Type)) ERROR(attr_static_exclusive_only_mutating,none, "type %0 cannot have mutating function %1", (Type, ValueDecl *)) ERROR(attr_static_exclusive_no_setters,none, "variable of type %0 must not have a setter", (Type)) // @extractConstantsFromMembers ERROR(attr_extractConstantsFromMembers_experimental,none, "'@extractConstantsFromMembers' requires " "'-enable-experimental-feature ExtractConstantsFromMembers'", ()) // @sensitive ERROR(attr_sensitive_experimental,none, "'@sensitive' requires '-enable-experimental-feature Sensitive'", ()) ERROR(c_func_variadic, none, "cannot declare variadic argument %0 in %kind1", (DeclName, const ValueDecl *)) ERROR(c_func_unsupported_specifier, none, "cannot declare '%0' argument %1 in %kind2", (StringRef, DeclName, const ValueDecl *)) ERROR(c_func_unsupported_type, none, "%0 cannot be represented in C", (Type)) ERROR(c_func_async,none, "async functions cannot be represented in C", ()) ERROR(c_func_throws,none, "raising errors from C functions is not supported", ()) ERROR(expose_wasm_not_at_top_level_func,none, "'@_expose' with 'wasm' can only be applied to global " "functions", ()) ERROR(expose_only_non_other_attr,none, "'@_expose' cannot be applied to an '%0' declaration", (StringRef)) ERROR(expose_inside_unexposed_decl,none, "'@_expose' cannot be applied inside of unexposed declaration %0", (const ValueDecl *)) ERROR(expose_redundant_name_provided, none, "'@_expose(!Cxx)' does not accept a name argument", ()) ERROR(expose_invalid_name_pattern_init,none, "invalid declaration name '%0' specified in '@_expose'; " "exposed initializer name must start with 'init'", (StringRef)) ERROR(expose_unsupported_objc_decl_to_cxx,none, "'@objc' %kind0 can not yet be exposed to C++", (ValueDecl *)) ERROR(expose_unsupported_async_decl_to_cxx,none, "async %kind0 can not be exposed to C++", (ValueDecl *)) ERROR(expose_unsupported_actor_isolated_to_cxx,none, "actor-isolated %kind0 can not be exposed to C++", (ValueDecl *)) ERROR(expose_unsupported_client_emission_to_cxx,none, "%kind0 can not be exposed to C++ as it requires code to be emitted into client", (ValueDecl *)) ERROR(expose_generic_decl_to_cxx,none, "generic %kind0 can not yet be exposed to C++", (ValueDecl *)) ERROR(expose_generic_requirement_to_cxx,none, "generic requirements for %kind0 can not yet be represented in C++", (ValueDecl *)) ERROR(expose_throwing_to_cxx,none, "%kind0 can not yet be represented in C++ as it may throw an error", (ValueDecl *)) ERROR(expose_indirect_enum_cxx,none, "indirect enum %0 can not yet be represented in C++", (ValueDecl *)) ERROR(expose_enum_case_type_to_cxx,none, "enum %0 can not be represented in C++ as one of its cases has an associated value with type that can't be represented in C++", (ValueDecl *)) ERROR(expose_enum_case_tuple_to_cxx,none, "enum %0 can not yet be represented in C++ as one of its cases has multiple associated values", (ValueDecl *)) ERROR(expose_protocol_to_cxx_unsupported,none, "protocol %0 can not yet be represented in C++", (ValueDecl *)) ERROR(expose_move_only_to_cxx,none, "noncopyable %kind0 can not yet be represented in C++", (ValueDecl *)) ERROR(expose_nested_type_to_cxx,none, "nested %kind0 can not yet be represented in C++", (ValueDecl *)) ERROR(expose_macro_to_cxx,none, "Swift macro can not yet be represented in C++", (ValueDecl *)) WARNING(warn_unannotated_cxx_func_returning_frt, none, "cannot infer the ownership of the returned value, annotate %0 with " "either SWIFT_RETURNS_RETAINED or SWIFT_RETURNS_UNRETAINED", (const ValueDecl *)) NOTE(note_unannotated_cxx_func_returning_frt, none, "%0 is defined here", (const ValueDecl *)) ERROR(unexposed_other_decl_in_cxx,none, "%kind0 is not yet exposed to C++", (ValueDecl *)) ERROR(unsupported_other_decl_in_cxx,none, "Swift %kind0 cannot be represented in C++", (ValueDecl *)) ERROR(expose_zero_size_to_cxx,none, "%0 is a zero sized value type, it cannot be exposed to C++ yet", (ValueDecl *)) ERROR(attr_methods_only,none, "only methods can be declared %0", (DeclAttribute)) ERROR(attr_decl_async,none, "%0 %kindonly1 cannot be asynchronous", (DeclAttribute, const FuncDecl *)) ERROR(attr_only_at_non_local_scope, none, "attribute %0 can only be used in a non-local scope", (DeclAttribute)) ERROR(attr_name_only_at_non_local_scope, none, "attribute '%0' can only be used in a non-local scope", (StringRef)) ERROR(attr_only_at_non_generic_scope, none, "attribute %0 cannot be used in a generic context", (DeclAttribute)) ERROR(attr_only_on_static_properties, none, "properties with attribute %0 must be static", (DeclAttribute)) ERROR(access_control_in_protocol,none, "%0 modifier cannot be used in protocols", (DeclAttribute)) NOTE(access_control_in_protocol_detail,none, "protocol requirements implicitly have the same access as the " "protocol itself", ()) ERROR(access_control_setter,none, "'%select{private|fileprivate|internal|package|public|open}0(set)' modifier can only " "be applied to variables and subscripts", (AccessLevel)) ERROR(access_control_setter_read_only,none, "'%select{private|fileprivate|internal|package|public|%error}0(set)' modifier cannot be " "applied to %select{constants|read-only variables|read-only properties" "|read-only subscripts}1", (AccessLevel, unsigned)) ERROR(access_control_setter_more,none, "%select{private|fileprivate|internal|package|public|%error}0 " "%select{variable|property|subscript}1 cannot have " "%select{%error|a fileprivate|an internal|a package|a public|an open}2 setter", (AccessLevel, unsigned, AccessLevel)) WARNING(access_control_setter_redundant,none, "'%select{private|fileprivate|internal|package|public|open}0(set)' modifier is " "redundant for %select{a private|a fileprivate|an internal|a package|a public|an open}2 " "%kindonly1", (AccessLevel, const Decl *, AccessLevel)) WARNING(access_control_ext_member_more,none, "'%select{%error|fileprivate|internal|package|public|open}0' modifier conflicts " "with extension's default access of " "'%select{private|fileprivate|internal|package|public|%error}1'", (AccessLevel, AccessLevel)) WARNING(access_control_ext_member_redundant,none, "'%select{%error|fileprivate|internal|package|public|%error}0' modifier is redundant " "for %kindonly1 declared in %select{a private (equivalent to fileprivate)|a fileprivate" "|an internal|a package|a public|%error}2 extension", (AccessLevel, const Decl *, AccessLevel)) ERROR(access_control_ext_requirement_member_more,none, "cannot declare %select{%error|a fileprivate|an internal|a package|a public|an open}0 %kindonly1 " "in an extension with %select{private|fileprivate|internal|package|public|%error}2 " "requirements", (AccessLevel, const Decl *, AccessLevel)) ERROR(access_control_extension_more,none, "extension of %select{private|fileprivate|internal|package|%error|%error}0 %kindonly1 cannot " "be declared %select{%error|fileprivate|internal|package|public|%error}2", (AccessLevel, const NominalTypeDecl *, AccessLevel)) ERROR(access_control_extension_open,none, "extensions cannot be declared 'open'; declare individual members as 'open' instead", ()) ERROR(access_control_open_bad_decl,none, "only classes and overridable class members can be declared 'open';" " use 'public'", ()) ERROR(access_control_non_objc_open_member,none, "non-'@objc' %kindonly0 declared in extension cannot be overridden; use " "'public' instead", (const ValueDecl *)) ERROR(access_control_requires_package_name, none, "the package access level %select{|used on %1 }0" "requires a package name; set it with the compiler flag -package-name", (bool, const Decl*)) ERROR(invalid_decl_attribute,none, "'%0' attribute cannot be applied to this declaration", (DeclAttribute)) ERROR(attr_invalid_on_decl_kind,none, "'%0' attribute cannot be applied to %kindonly1 declarations", (DeclAttribute, const Decl *)) ERROR(attr_invalid_in_context,none, "'%0' attribute cannot be applied to declaration in %kindonly1", (DeclAttribute, const Decl *)) ERROR(invalid_decl_modifier,none, "%0 modifier cannot be applied to this declaration", (DeclAttribute)) ERROR(attribute_does_not_apply_to_type,none, "attribute does not apply to type", ()) ERROR(optional_attribute_non_protocol,none, "'optional' can only be applied to protocol members", ()) ERROR(optional_attribute_non_objc_protocol,none, "'optional' can only be applied to members of an '@objc' protocol", ()) ERROR(optional_attribute_missing_explicit_objc,none, "'optional' requirements are an Objective-C compatibility feature; add '@objc'", ()) ERROR(objcmembers_attribute_nonclass,none, "'@objcMembers' attribute can only be applied to a class", ()) ERROR(optional_attribute_initializer,none, "'optional' cannot be applied to an initializer", ()) ERROR(unavailable_method_non_objc_protocol,none, "protocol members can only be marked unavailable in an '@objc' protocol", ()) ERROR(spi_available_malformed,none, "SPI available only supports introducing version on specific platform", ()) ERROR(missing_in_class_init_1,none, "stored property %0 requires an initial value%select{| or should be " "'@NSManaged'}1", (Identifier, bool)) ERROR(missing_in_class_init_2,none, "stored properties %0 and %1 require initial values%select{| or should " "be '@NSManaged'}2", (Identifier, Identifier, bool)) ERROR(missing_in_class_init_3plus,none, "stored properties %0, %1, %select{and %2|%2, and others}3 " "require initial values%select{| or should be '@NSManaged'}4", (Identifier, Identifier, Identifier, bool, bool)) NOTE(requires_stored_property_inits_here,none, "%select{superclass|class}1 %0 requires all stored properties to have " "initial values%select{| or use '@NSManaged'}2", (Type, bool, bool)) ERROR(class_without_init,none, "%select{class|actor}0 %1 has no initializers", (bool, Type)) NOTE(note_no_in_class_init_1,none, "stored property %0 without initial value prevents synthesized " "initializers", (Identifier)) NOTE(note_no_in_class_init_2,none, "stored properties %0 and %1 without initial values prevent synthesized " "initializers", (Identifier, Identifier)) NOTE(note_no_in_class_init_3plus,none, "stored properties %0, %1, %select{and %2|%2, and others}3 " "without initial values prevent synthesized initializers", (Identifier, Identifier, Identifier, bool)) ERROR(missing_unimplemented_init_runtime,none, "standard library error: missing _unimplementedInitializer", ()) ERROR(missing_undefined_runtime,none, "standard library error: missing _undefined", ()) ERROR(inherited_default_value_not_in_designated_constructor,none, "default value inheritance via 'super' is only valid on the parameters of " "designated initializers", ()) ERROR(inherited_default_value_used_in_non_overriding_constructor,none, "default value inheritance via 'super' can only be used when " "overriding a designated initializer", ()) ERROR(corresponding_param_not_defaulted,none, "default value inheritance via 'super' requires that the corresponding " "parameter of the overridden designated initializer has a default value", ()) NOTE(inherited_default_param_here,none, "corresponding parameter declared here", ()) WARNING(option_set_zero_constant,none, "static property %0 produces an empty option set", (Identifier)) NOTE(option_set_empty_set_init,none, "use [] to silence this warning", ()) ERROR(originally_definedin_topleve_decl,none, "'%0' is only applicable to top-level decl", (DeclAttribute)) ERROR(originally_definedin_must_not_before_available_version,none, "symbols are moved to the current module before they were available in " "the OSs", ()) WARNING(spi_preferred_over_spi_available,none, "symbols that are '@_spi_available' on all platforms should use " "'@_spi' instead", ()) // Alignment attribute ERROR(alignment_not_power_of_two,none, "alignment value must be a power of two", ()) // Dependency Scanning ERROR(dependency_scan_module_not_found, none, "unable to resolve module dependency: '%0'", (StringRef)) GROUPED_ERROR(dependency_scan_module_not_found_on_specified_search_paths, MissingModuleOnKnownPaths, none, "compilation search paths unable to resolve module dependency: '%0'", (StringRef)) NOTE(unresolved_import_location,none, "also imported here", ()) NOTE(dependency_as_imported_by_main_module,none, "a dependency of main module '%0'", (StringRef)) NOTE(dependency_as_imported_by, none, "a dependency of %select{Swift|Clang}2 module '%0': '%1'", (StringRef, StringRef, bool)) NOTE(inherited_search_path_resolves_module,none, "'%0' can be found using a search path that was specified when building module '%1' ('%2'). " "This search path was not explicitly specified on the current compilation", (StringRef, StringRef, StringRef)) ERROR(dependency_scan_compatible_swift_module_not_found, none, "unable to resolve Swift module dependency to a compatible module: '%0'", (StringRef)) NOTE(dependency_scan_incompatible_module_found,none, "found incompatible module '%0': %1", (StringRef, StringRef)) WARNING(dependency_scan_module_incompatible, none, "module file '%0' is incompatible with this Swift compiler: %1", (StringRef, StringRef)) ERROR(clang_dependency_scan_error, none, "clang dependency scanning failure: %0", (StringRef)) ERROR(clang_header_dependency_scan_error, none, "bridging header dependency scanning failure: %0", (StringRef)) // Enum annotations ERROR(indirect_case_without_payload,none, "enum case %0 without associated value cannot be 'indirect'", (Identifier)) ERROR(indirect_case_in_indirect_enum,none, "enum case in 'indirect' enum cannot also be 'indirect'", ()) WARNING(enum_frozen_nonpublic,none, "%0 has no effect on non-public enums", (DeclAttribute)) // Variables (var and let). ERROR(getset_init,none, "variable with getter/setter cannot have an initial value", ()) ERROR(effectful_not_representable_objc,none, "%kindonly0 with 'throws' or 'async' is not representable in Objective-C", (const AbstractStorageDecl *)) ERROR(unimplemented_static_var,none, "%select{ERROR|static|class}1 stored properties not supported" "%select{ in this context| in generic types| in classes| in protocol extensions}0" "%select{|; did you mean 'static'?}2", (unsigned, StaticSpellingKind, unsigned)) ERROR(observingprop_requires_initializer,none, "non-member observing properties require an initializer", ()) ERROR(global_requires_initializer,none, "global '%select{var|let}0' declaration requires an initializer expression" "%select{ or an explicitly stated getter|}0", (bool)) ERROR(static_requires_initializer,none, "'%select{ERROR|static|class|}0 %select{var|let}1' declaration requires " "an initializer expression or an explicitly stated getter", (StaticSpellingKind, bool)) NOTE(static_requires_initializer_add_init,none, "add an initializer to silence this error", ()) ERROR(pattern_type_access,none, "%select{%select{variable|constant}0|property}1 " "%select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}3|private or fileprivate}4" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}3}2 " "because its type uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}5 type", (bool, bool, bool, AccessLevel, bool, AccessLevel)) WARNING(pattern_type_access_warn,none, "%select{%select{variable|constant}0|property}1 " "%select{should be declared %select{private|fileprivate|internal|package|%error|%error}5" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}3}2 " "because its type uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}5 type", (bool, bool, bool, AccessLevel, bool, AccessLevel)) ERROR(pattern_type_access_inferred,none, "%select{%select{variable|constant}0|property}1 " "%select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}3|private or fileprivate}4" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}3}2 " "because its type %6 uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}5 type", (bool, bool, bool, AccessLevel, bool, AccessLevel, Type)) WARNING(pattern_type_access_inferred_warn,none, "%select{%select{variable|constant}0|property}1 " "%select{should be declared %select{private|fileprivate|internal|package|%error|%error}5" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}3}2 " "because its type %6 uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}5 type", (bool, bool, bool, AccessLevel, bool, AccessLevel, Type)) ERROR(pattern_type_not_usable_from_inline,none, "type referenced from a '@usableFromInline' " "%select{%select{variable|constant}0|property}1 " "must be '@usableFromInline' or public", (bool, bool)) WARNING(pattern_type_not_usable_from_inline_warn,none, "type referenced from a '@usableFromInline' " "%select{%select{variable|constant}0|property}1 " "should be '@usableFromInline' or public", (bool, bool)) ERROR(pattern_type_not_usable_from_inline_frozen,none, "type referenced from a stored property in a '@frozen' struct must " "be '@usableFromInline' or public", (/*ignored*/bool, /*ignored*/bool)) ERROR(pattern_type_not_usable_from_inline_inferred,none, "type referenced from a '@usableFromInline' " "%select{%select{variable|constant}0|property}1 " "with inferred type %2 " "must be '@usableFromInline' or public", (bool, bool, Type)) WARNING(pattern_type_not_usable_from_inline_inferred_warn,none, "type referenced from a '@usableFromInline' " "%select{%select{variable|constant}0|property}1 " "with inferred type %2 " "should be '@usableFromInline' or public", (bool, bool, Type)) ERROR(pattern_type_not_usable_from_inline_inferred_frozen,none, "type referenced from a stored property with inferred type %2 in a " "'@frozen' struct must be '@usableFromInline' or public", (/*ignored*/bool, /*ignored*/bool, Type)) ERROR(pattern_binds_no_variables,none, "%select{property|global variable}0 declaration does not bind any " "variables", (unsigned)) ERROR(variable_bound_by_no_pattern,none, "variable %0 is not bound by any pattern", (const VarDecl *)) ERROR(destructuring_let_struct_stored_property_unsupported,none, "binding multiple 'let' stored properties from a single initializer expression in a struct is unsupported", ()) WARNING(optional_ambiguous_case_ref,none, "assuming you mean '%0.%2'; did you mean '%1.%2' instead?", (StringRef, StringRef, StringRef)) NOTE(optional_fixit_ambiguous_case_ref,none, "explicitly specify 'Optional' to silence this warning", ()) NOTE(optional_fixit_ambiguous_case_ref_switch,none, "use 'nil' to silence this warning", ()) NOTE(type_fixit_optional_ambiguous_case_ref,none, "use '%0.%1' instead", (StringRef, StringRef)) NOTE(type_fixit_optional_ambiguous_case_ref_switch,none, "use '%0' instead", (StringRef)) ERROR(nscoding_unstable_mangled_name,none, "%select{private|fileprivate|nested|local}0 class %1 has an " "unstable name when archiving via 'NSCoding'", (unsigned, Type)) NOTE(unstable_mangled_name_add_objc_new,none, "for new classes, use '@objc' to specify a unique, prefixed Objective-C " "runtime name", ()) NOTE(unstable_mangled_name_add_objc,none, "for compatibility with existing archives, use '@objc' " "to record the Swift 3 runtime name", ()) // Generic declarations ERROR(unsupported_type_nested_in_generic_function,none, "type %0 cannot be nested in generic function %1", (const NominalTypeDecl *, const AbstractFunctionDecl *)) ERROR(unsupported_type_nested_in_generic_closure,none, "type %0 cannot be nested in closure in generic context", (const NominalTypeDecl *)) ERROR(unsupported_type_nested_in_protocol,none, "type %0 cannot be nested in protocol %1", (const NominalTypeDecl *, const ProtocolDecl *)) ERROR(unsupported_type_nested_in_protocol_extension,none, "type %0 cannot be nested in protocol extension of %1", (const NominalTypeDecl *, const ProtocolDecl *)) ERROR(unsupported_nested_protocol_in_generic,none, "protocol %0 cannot be nested in a generic context", (const NominalTypeDecl *)) ERROR(unsupported_nested_protocol_in_protocol,none, "protocol %0 cannot be nested in protocol %1", (const NominalTypeDecl *, const NominalTypeDecl *)) ERROR(where_nongeneric_ctx,none, "'where' clause on non-generic member declaration requires a " "generic context", ()) ERROR(where_nongeneric_toplevel,none, "'where' clause cannot be applied to a non-generic top-level " "declaration", ()) ERROR(unable_to_convert_generic_swift_types,none, "could not generate C++ types from the generic Swift types provided; " "the following Swift type(s) provided to '%0' could not be " "converted: %1", (StringRef, StringRef)) ERROR(unable_to_substitute_cxx_function_template,none, "could not substitute parameters for C++ function template '%0': %1", (StringRef, StringRef)) // Type aliases ERROR(type_alias_underlying_type_access,none, "type alias %select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}1|private or fileprivate}3" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}1}0 " "because its underlying type uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) WARNING(type_alias_underlying_type_access_warn,none, "type alias %select{should be declared " "%select{private|fileprivate|internal|package|%error|%error}1" "|should not be declared " "%select{in this context|fileprivate|internal|package|public|open}1}0 " "because its underlying type uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) ERROR(type_alias_underlying_type_not_usable_from_inline,none, "type referenced from the underlying type of a " "'@usableFromInline' type alias " "must be '@usableFromInline' or public", ()) WARNING(type_alias_underlying_type_not_usable_from_inline_warn,none, "type referenced from the underlying type of a " "'@usableFromInline' type alias " "should be '@usableFromInline' or public", ()) // Subscripts ERROR(subscript_type_access,none, "subscript %select{must be declared " "%select{private|fileprivate|internal|package|%error|%error}1" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}1}0 " "because its %select{index|element type}3 uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) WARNING(subscript_type_access_warn,none, "subscript %select{should be declared " "%select{private|fileprivate|internal|package|%error|%error}1" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}1}0 " "because its %select{index|element type}3 uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) ERROR(subscript_type_usable_from_inline,none, "%select{index type|element type}0 of a '@usableFromInline' subscript " "must be '@usableFromInline' or public", (bool)) WARNING(subscript_type_usable_from_inline_warn,none, "%select{index type|element type}0 of a '@usableFromInline' subscript " "should be '@usableFromInline' or public", (bool)) // Functions ERROR(function_type_access,none, "%select{function|method|initializer}4 " "%select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}1|private or fileprivate}2" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}1}0 " "because its %select{parameter|thrown error|result}5 uses " "%select{a private|a fileprivate|an internal|a package|an '@_spi'|an '@_spi'}3" "%select{| API wrapper}6 type", (bool, AccessLevel, bool, AccessLevel, unsigned, unsigned, bool)) WARNING(function_type_access_warn,none, "%select{function|method|initializer}4 " "%select{should be declared %select{private|fileprivate|internal|package|%error|%error}1" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}1}0 " "because its %select{parameter|thrown error|result}5 uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}3 " "%select{|API wrapper}6 type", (bool, AccessLevel, bool, AccessLevel, unsigned, unsigned, bool)) ERROR(function_type_usable_from_inline,none, "the %select{parameter|result}1%select{| API wrapper}2 of a " "'@usableFromInline' %select{function|method|initializer}0 " "must be '@usableFromInline' or public", (unsigned, bool, bool)) WARNING(function_type_usable_from_inline_warn,none, "the %select{parameter|result}1%select{| API wrapper}2 of a " "'@usableFromInline' %select{function|method|initializer}0 " "should be '@usableFromInline' or public", (unsigned, bool, bool)) ERROR(spi_attribute_on_non_public,none, "%select{private|fileprivate|internal|package|%error|%error}0 %kindonly1 " "cannot be declared '@_spi' because only public and open " "declarations can be '@_spi'", (AccessLevel, const ValueDecl *)) ERROR(spi_attribute_on_protocol_requirement,none, "protocol requirement %0 cannot be declared '@_spi' without " "a default implementation in a protocol extension", (const ValueDecl *)) ERROR(spi_attribute_on_frozen_stored_properties,none, "stored property %0 cannot be declared '@_spi' in a '@frozen' struct", (const ValueDecl *)) ERROR(spi_attribute_on_frozen_enum_case,none, "%kind0 cannot be declared '@_spi' in a '@frozen' enum", (const ValueDecl *)) WARNING(spi_attribute_on_import_of_public_module,none, "'@_spi' import of %0 will not include any SPI symbols; " "%0 was built from the public interface at %1", (DeclName, StringRef)) ERROR(spi_only_imports_not_enabled, none, "'@_spiOnly' requires setting the frontend flag '-experimental-spi-only-imports'", ()) // Access level on imports ERROR(access_level_on_import_unsupported, none, "The access level %0 is unsupported on imports: " "only 'public', 'package', 'internal', 'fileprivate' and 'private' " "are accepted", (DeclAttribute)) ERROR(access_level_conflict_with_exported,none, "'%0' is incompatible with %1; it can only be applied to public imports", (DeclAttribute, DeclAttribute)) NOTE(module_imported_here,none, "module %0 imported as '%select{private|fileprivate|internal|package|%ERROR|%ERROR}1' here", (const ModuleDecl*, AccessLevel)) NOTE(decl_import_via_here,none, "%kind0 imported as " "'%select{private|fileprivate|internal|package|%ERROR|%ERROR}1' " "from %2 here", (const Decl *, AccessLevel, const ModuleDecl*)) NOTE(decl_import_via_local,none, "%kind0 is imported by this file as " "'%select{private|fileprivate|internal|package|%ERROR|%ERROR}1' " "from %2", (const Decl *, AccessLevel, const ModuleDecl*)) // Opaque return types ERROR(opaque_type_invalid_constraint,none, "a 'some' type must specify only 'Any', 'AnyObject', protocols, " "and/or a base class", ()) NOTE(opaque_of_optional_rewrite,none, "did you mean to write an optional of an 'some' type?", ()) ERROR(inferred_opaque_type,none, "property definition has inferred type %0, involving the 'some' " "return type of another declaration", (Type)) // Inverse Constraints ERROR(inverse_type_not_invertible,none, "type %0 cannot be suppressed", (Type)) // Extensions GROUPED_ERROR(non_nominal_extension,NominalTypes,none, "non-nominal type %0 cannot be extended", (Type)) WARNING(composition_in_extended_type,none, "extending a protocol composition is not supported; extending %0 " "instead", (Type)) NOTE(composition_in_extended_type_alternative,none, "did you mean to extend the most specific type %0 instead?", (Type)) ERROR(extension_access_with_conformances,none, "%0 modifier cannot be used with extensions that declare " "protocol conformances", (DeclAttribute)) ERROR(experimental_tuple_extension,none, "tuple extensions are experimental", ()) ERROR(tuple_extension_wrong_type,none, "tuple extension must be written as extension of %0", (Type)) ERROR(tuple_extension_one_conformance,none, "tuple extension must declare conformance to exactly one protocol", ()) ERROR(tuple_extension_extra_requirement,none, "tuple extension cannot require that %0 " "%select{conforms to|subclasses|is the same type as|%error|%error}1 %2", (Type, unsigned, Type)) ERROR(tuple_extension_missing_requirement,none, "tuple extension must require that %0 conforms to %1", (Type, Type)) ERROR(tuple_extension_nested_type,none, "type %0 cannot be nested in tuple extension", (const NominalTypeDecl *)) ERROR(extension_metatype,none, "cannot extend a metatype %0", (Type)) ERROR(extension_placeholder,none, "cannot extend a type that contains placeholders", ()) ERROR(extension_stored_property,none, "extensions must not contain stored properties", ()) NOTE(extension_stored_property_fixit,none, "Remove '=' to make %0 a computed property", (Identifier)) ERROR(extension_nongeneric_trailing_where,none, "trailing 'where' clause for extension of non-generic type %0", (Type)) ERROR(extension_protocol_inheritance,none, "extension of protocol %0 cannot have an inheritance clause", (Identifier)) ERROR(objc_generic_extension_using_type_parameter,none, "extension of a generic Objective-C class cannot access the class's " "generic parameters at runtime", ()) NOTE(objc_generic_extension_using_type_parameter_here,none, "generic parameter used here", ()) NOTE(objc_generic_extension_using_type_parameter_try_objc,none, "add '@objc' to allow uses of 'self' within the function body", ()) ERROR(unsupported_existential_extension,none, "extension of existential type %0 is not supported", (Type)) ERROR(invalid_nominal_extension,none, "extension of type %0 must be declared as an extension of %1", (Type, Type)) NOTE(invalid_extension_rewrite,none, "did you mean to extend %0 instead?", (Type)) ERROR(cannot_extend_nominal,none, "cannot extend %kind0", (const NominalTypeDecl *)) ERROR(retroactive_attr_does_not_apply,none, "'retroactive' attribute does not apply; %0 is declared in " "%select{the same package|this module}1", (const ValueDecl *, bool)) WARNING(extension_retroactive_conformance,none, "extension declares a conformance of imported type %0 to imported " "%select{protocols|protocol}1 %2; this will not behave correctly if " "the owners of %3 introduce this conformance in the future", (Identifier, bool, StringRef, Identifier)) NOTE(extension_retroactive_conformance_silence,none, "add '@retroactive' to silence this warning", ()) // Protocols ERROR(type_does_not_conform,none, "type %0 does not conform to protocol %1", (Type, Type)) ERROR(non_final_class_cannot_conform_to_self_same_type,none, "non-final class %0 cannot safely conform to protocol %1, " "which requires that %2 %select{is exactly equal to|inherit from}3 %4", (Type, Type, Type, unsigned, Type)) ERROR(cannot_use_nil_with_this_type,none, "'nil' cannot be used in context expecting type %0", (Type)) ERROR(type_cannot_conform_to_nsobject,none, "cannot declare conformance to 'NSObjectProtocol' in Swift; %0 should " "inherit 'NSObject' instead", (Type)) ERROR(use_of_equal_instead_of_equality,none, "use of '=' in a boolean context, did you mean '=='?", ()) GROUPED_ERROR(type_cannot_conform, ProtocolTypeNonConformance, none, "type %0 cannot conform to %1", (Type, Type)) NOTE(only_concrete_types_conform_to_protocols,none, "only concrete types such as structs, enums and classes can conform to protocols", ()) NOTE(nonsendable_function_type,none, "a function type must be marked '@Sendable' to conform to 'Sendable'", ()) NOTE(nonsendable_tuple_type,none, "a tuple type must be composed of 'Sendable' elements to conform to " "'Sendable'", ()) NOTE(non_sendable_nominal,none, "%kind0 does not conform to the 'Sendable' protocol", (const ValueDecl *)) NOTE(add_nominal_sendable_conformance,none, "consider making %kind0 conform to the 'Sendable' protocol", (const ValueDecl *)) NOTE(add_generic_parameter_conformance,none, "consider making generic parameter %0 conform to the %1 protocol", (Type, ProtocolDecl *)) WARNING(add_predates_concurrency_import,none, "add '@preconcurrency' to %select{suppress|treat}0 " "'Sendable'-related %select{warnings|errors}0 from module %1" "%select{| as warnings}0", (bool, Identifier)) GROUPED_WARNING(remove_predates_concurrency_import,PreconcurrencyImport, DefaultIgnore, "'@preconcurrency' on module %0 has no effect", (Identifier)) WARNING(remove_public_import,none, "public import of %0 was not used in public declarations or inlinable code", (Identifier)) WARNING(remove_package_import,none, "package import of %0 was not used in package declarations", (Identifier)) WARNING(public_decl_needs_sendable,none, "public %kind0 does not specify whether it is 'Sendable' or not", (const ValueDecl *)) NOTE(explicit_disable_sendable,none, "make %kind0 explicitly non-Sendable to suppress this warning", (const ValueDecl *)) NOTE(required_by_opaque_return,none, "required by opaque return type of %kind0", (const ValueDecl *)) NOTE(required_by_decl,none, "required by %kind0 where %1 = %2", (const ValueDecl *, Type, Type)) NOTE(required_by_decl_ref,none, "required by referencing %kind0 on %1 where %2 = %3", (const ValueDecl *, Type, Type, Type)) ERROR(protocol_does_not_conform_static,none, "%0 cannot be used as a type conforming to protocol %1 because %1 " "has static requirements", (Type, Type)) ERROR(protocol_derivation_is_broken,none, "protocol %0 is broken; cannot derive conformance for type %1", (Type, Type)) ERROR(type_does_not_inherit,none, "%0 requires that %1 inherit from %2", (Type, Type, Type)) NOTE(type_does_not_inherit_or_conform_requirement,none, "requirement specified as %0 : %1%2", (Type, Type, StringRef)) ERROR(types_not_equal,none, "%0 requires the types %1 and %2 be equivalent", (Type, Type, Type)) ERROR(types_not_same_shape,none, "%0 requires the type packs %1 and %2 have the same shape", (Type, Type, Type)) ERROR(type_does_not_conform_owner,none, "%0 requires that %1 conform to %2", (Type, Type, Type)) ERROR(type_does_not_conform_in_decl_ref,none, "referencing %kind0 on %1 requires that %2 conform to %3", (const ValueDecl *, Type, Type, Type)) ERROR(contextual_member_ref_on_protocol_requires_self_requirement,none, "contextual member reference to %kind0 requires " "'Self' constraint in the protocol extension", (const ValueDecl *)) NOTE(missing_sametype_requirement_on_self,none, "missing same-type requirement on 'Self'", ()) ERROR(type_does_not_conform_anyobject_in_decl_ref,none, "referencing %kind0 on %1 requires that %2 be a class type", (const ValueDecl *, Type, Type, Type)) ERROR(type_does_not_conform_decl_owner,none, "%kind0 requires that %1 conform to %2", (const ValueDecl *, Type, Type)) ERROR(type_does_not_conform_anyobject_decl_owner,none, "%kind0 requires that %1 be a class type", (const ValueDecl *, Type, Type)) ERROR(type_does_not_conform_in_opaque_return,none, "return type of %kind0 requires that %1 %select{conform to %2|be a class type}3", (const ValueDecl *, Type, Type, bool)) ERROR(type_is_not_equal_in_opaque_return,none, "return type of %kind0 requires the types %1 and %2 be equivalent", (const ValueDecl *, Type, Type)) ERROR(types_not_inherited_in_opaque_return,none, "return type of %kind0 requires that %1 inherit from %2", (const ValueDecl *, Type, Type)) ERROR(types_not_equal_decl,none, "%kind0 requires the types %1 and %2 be equivalent", (const ValueDecl *, Type, Type)) ERROR(types_not_equal_in_decl_ref,none, "referencing %kind0 on %1 requires the types %2 and %3 be equivalent", (const ValueDecl *, Type, Type, Type)) ERROR(types_not_same_shape_decl,none, "%kind0 requires the type packs %1 and %2 have the same shape", (const ValueDecl *, Type, Type)) ERROR(types_not_same_shape_in_decl_ref,none, "referencing %kind0 on %1 requires the type packs %2 and %3 have the same shape", (const ValueDecl *, Type, Type, Type)) ERROR(types_not_inherited_decl,none, "%kind0 requires that %1 inherit from %2", (const ValueDecl *, Type, Type)) ERROR(types_not_inherited_in_decl_ref,none, "referencing %kind0 on %1 requires that %2 inherit from %3", (const ValueDecl *, Type, Type, Type)) ERROR(cannot_reference_conditional_member_on_base_multiple_mismatches,none, "cannot reference %kind0 on %1", (const ValueDecl *, Type)) NOTE(where_requirement_failure_one_subst,none, "where %0 = %1", (Type, Type)) NOTE(where_requirement_failure_both_subst,none, "where %0 = %1, %2 = %3", (Type, Type, Type, Type)) NOTE(requirement_implied_by_conditional_conformance,none, "requirement from conditional conformance of %0 to %1", (Type, Type)) NOTE(wrapped_type_satisfies_requirement,none, "wrapped type %0 satisfies this requirement; did you mean to unwrap?", (Type)) NOTE(candidate_types_conformance_requirement,none, "candidate requires that %0 conform to %1 " "(requirement specified as %2 : %3)", (Type, Type, Type, Type)) NOTE(candidate_types_equal_requirement,none, "candidate requires that the types %0 and %1 be equivalent " "(requirement specified as %2 == %3)", (Type, Type, Type, Type)) NOTE(candidate_types_same_shape_requirement,none, "candidate requires that the type packs %0 and %1 have the same shape " "(same-shape requirement inferred between %2 and %3)", (Type, Type, Type, Type)) NOTE(candidate_types_inheritance_requirement,none, "candidate requires that %1 inherit from %2 " "(requirement specified as %2 : %3)", (Type, Type, Type, Type)) NOTE(same_shape_requirement,none, "same-shape requirement inferred between %0 and %1%2", (Type, Type, StringRef)) NOTE(types_not_equal_requirement,none, "requirement specified as %0 == %1%2", (Type, Type, StringRef)) ERROR(type_is_not_a_class,none, "%0 requires that %1 be a class type", (Type, Type, Type)) NOTE(anyobject_requirement,none, "requirement specified as %0 : 'AnyObject'%2", (Type, Type, StringRef)) ERROR(non_class_cannot_conform_to_class_protocol,none, "non-class type %0 cannot conform to class protocol %1", (Type, Type)) ERROR(cf_class_cannot_conform_to_objc_protocol,none, "Core Foundation class %0 cannot conform to '@objc' protocol %1 because " "Core Foundation types are not classes in Objective-C", (Type, Type)) ERROR(objc_runtime_visible_cannot_conform_to_objc_protocol,none, "class %0 cannot conform to '@objc' protocol %1 because " "the class is only visible via the Objective-C runtime", (Type, Type)) ERROR(objc_generics_cannot_conditionally_conform,none, "type %0 cannot conditionally conform to protocol %1 because " "the type uses the Objective-C generics model", (Type, Type)) ERROR(objc_protocol_cannot_have_conditional_conformance,none, "type %0 cannot conditionally conform to '@objc' protocol %1 because " "Objective-C does not support conditional conformances", (Type, Type)) ERROR(objc_protocol_in_generic_extension,none, "conformance of " "%select{class from generic context|generic class}0 " "%1 to '@objc' protocol %2 cannot be in an extension", (bool, Type, Type)) ERROR(conditional_conformances_cannot_imply_conformances,none, "conditional conformance of type %0 to protocol %1 does not imply conformance to " "inherited protocol %2", (Type, Type, Type)) NOTE(note_explicitly_state_conditional_conformance_different,none, "did you mean to explicitly state the conformance with different bounds?", ()) NOTE(note_explicitly_state_conditional_conformance_relaxed,none, "did you mean to explicitly state the conformance with relaxed bounds using '%0'?", (StringRef)) NOTE(note_explicitly_state_conditional_conformance_same,none, "did you mean to explicitly state the conformance with the same bounds using '%0'?", (StringRef)) ERROR(protocol_has_missing_requirements,none, "type %0 cannot conform to protocol %1 because it has requirements that " "cannot be satisfied", (Type, Type)) ERROR(protocol_has_missing_requirements_versioned,none, "type %0 cannot conform to protocol %1 (compiled with Swift %2) because " "it has requirements that could not be loaded in Swift %3", (Type, Type, llvm::VersionTuple, llvm::VersionTuple)) ERROR(requirement_restricts_self,none, "%kindonly0 requirement %0 cannot add constraint " "'%1%select{:|:| ==|:| has same shape as|}2 %3' on 'Self'", (const ValueDecl *, StringRef, unsigned, StringRef)) ERROR(witness_argument_name_mismatch,none, "%kind0 has different argument labels " "from those required by protocol %1 (%2)", (const ValueDecl *, Type, const ValueDecl *)) ERROR(witness_initializer_not_required,none, "initializer requirement %0 can only be satisfied by a 'required' " "initializer in%select{| the definition of}1 non-final class %2", (const ValueDecl *, bool, Type)) ERROR(witness_initializer_failability,none, "non-failable initializer requirement %0" "%select{| in Objective-C protocol}1 cannot be satisfied by a " "failable initializer ('init%select{?|!}1')", (const ValueDecl *, bool)) ERROR(witness_self_non_subtype,none, "protocol %0 requirement %1 cannot be satisfied by a non-final class " "(%2) because it uses 'Self' in a non-parameter, non-result type " "position", (Type, const ValueDecl *, Type)) ERROR(witness_self_same_type,none, "%kind0 in non-final class %1 cannot be used to satisfy requirement %kind2" " (in protocol %3) due to same-type requirement involving 'Self'", (const ValueDecl *, Type, const ValueDecl *, Type)) NOTE(witness_self_weaken_same_type,none, "consider weakening the same-type requirement %0 == %1 to a superclass " "requirement", (Type, Type)) ERROR(witness_requires_dynamic_self,none, "%select{%error|method|property|subscript}0 %1 in non-final class %2 " "must %select{%error|return|specify type|return}0 'Self' " "to conform to protocol %3", (RequirementKind, const ValueDecl *, Type, Type)) ERROR(witness_requires_class_implementation,none, "%select{%error|method|%error|subscript}0 %1 in non-final class %2 " "cannot be implemented in a protocol extension because it returns 'Self' " "and has associated type requirements", (RequirementKind, const ValueDecl *, Type)) ERROR(witness_not_accessible_proto,none, "%select{initializer %1|method %1|%select{|setter for }2property %1" "|subscript%select{| setter}2}0 must be declared " "%select{%error|fileprivate|internal|package|public|%error}3 because it matches a " "requirement in %select{private|fileprivate|internal|package|public|%error}4 protocol " "%5", (RequirementKind, const ValueDecl *, bool, AccessLevel, AccessLevel, const ProtocolDecl *)) ERROR(witness_not_as_sendable,none, "sendability of function types in %kind0 does not match requirement in " "protocol %1", (const ValueDecl *, const ProtocolDecl *)) NOTE(less_sendable_reqt_here,none, "expected sendability to match requirement here", ()) ERROR(witness_not_accessible_type,none, "%select{initializer %1|method %1|%select{|setter for }2property %1" "|subscript%select{| setter}2}0 must be as accessible as its enclosing " "type because it matches a requirement in protocol %5", (RequirementKind, const ValueDecl *, bool, AccessLevel, AccessLevel, const ProtocolDecl *)) ERROR(type_witness_not_accessible_proto,none, "%kind0 must be declared %select{%error|fileprivate|internal|package|public|%error}1 " "because it matches a requirement in " "%select{%error|fileprivate|internal|package|public|%error}1 protocol %2", (const ValueDecl *, AccessLevel, const ProtocolDecl *)) ERROR(type_witness_not_accessible_type,none, "%kind0 must be as accessible as its enclosing type because it " "matches a requirement in protocol %2", (const ValueDecl *, AccessLevel, const ProtocolDecl *)) ERROR(witness_not_usable_from_inline,none, "%kind0 must be declared '@usableFromInline' " "because it matches a requirement in protocol %1", (const ValueDecl *, const ProtocolDecl *)) ERROR(type_witness_objc_generic_parameter,none, "type %0 involving Objective-C type parameter%select{| %1}2 cannot be " "used for associated type %3 of protocol %4", (Type, Type, bool, const AssociatedTypeDecl *, const ProtocolDecl *)) NOTE(witness_fix_access,none, "mark the %kindonly0 as " "'%select{%error|fileprivate|internal|package|public|%error}1' to " "satisfy the requirement", (const ValueDecl *, AccessLevel)) NOTE(witness_move_to_another_extension,none, "move the %kindonly0 to another extension where it can be declared " "'%select{%error|%error|internal|package|public|%error}1' to " "satisfy the requirement", (const ValueDecl *, AccessLevel)) WARNING(assoc_type_default_conformance_failed,none, "default type %0 for associated type %1 does not satisfy constraint " "%2: %3", (Type, const AssociatedTypeDecl *, Type, Type)) NOTE(assoc_type_default_here,none, "associated type %0 has default type %1 written here", (const AssociatedTypeDecl *, Type)) ERROR(protocol_access,none, "%select{protocol must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}1" "|private or fileprivate}4 because %select{it refines|its 'where' clause uses}2" "|%select{in this context|fileprivate|internal|package|public|%error}1 " "%select{protocol cannot refine|protocol's 'where' clause cannot use}2}0 " "%select{a private|a fileprivate|an internal|a package|%error|%error}3 %5", (bool, AccessLevel, bool, AccessLevel, bool, DescriptiveDeclKind)) WARNING(protocol_access_warn,none, "%select{protocol should be declared " "%select{private|fileprivate|internal|package|%error|%error}1 because " "%select{it refines|its 'where' clause uses}2" "|%select{in this context|fileprivate|internal|package|public|%error}1 " "%select{protocol should not refine|protocol's 'where' clause should not use}2}0 " "%select{a private|a fileprivate|an internal|a package|%error|%error}3 %5", (bool, AccessLevel, bool, AccessLevel, bool, DescriptiveDeclKind)) ERROR(protocol_usable_from_inline,none, "protocol %select{refined|used}0 by '@usableFromInline' protocol " "must be '@usableFromInline' or public", (bool)) WARNING(protocol_usable_from_inline_warn,none, "protocol %select{refined|used}0 by '@usableFromInline' protocol " "should be '@usableFromInline' or public", (bool)) ERROR(protocol_property_must_be_computed_var,none, "protocols cannot require properties to be immutable; declare read-only " "properties by using 'var' with a '{ get }' specifier", ()) ERROR(protocol_property_must_be_computed,none, "property in protocol must have explicit { get } or { get set } specifier", ()) NOTE(inherited_protocol_does_not_conform,none, "type %0 does not conform to inherited protocol %1", (Type, Type)) NOTE(no_witnesses,none, "protocol requires " "%select{initializer %1|function %1|property %1|subscript}0 with type %2", (RequirementKind, const ValueDecl *, WitnessType)) NOTE(missing_witnesses_general,none, "add stubs for conformance", ()) NOTE(ambiguous_witnesses,none, "multiple matching " "%select{initializers named %1|functions named %1|properties named %1|" "subscript operators}0 with type %2", (RequirementKind, const ValueDecl *, WitnessType)) NOTE(ambiguous_witnesses_wrong_name,none, "multiple matching " "%select{initializers named %1|functions named %1|properties named %1|" "subscript operators}0 with type %2", (RequirementKind, const ValueDecl *, WitnessType)) NOTE(no_witnesses_type,none, "protocol requires nested type %0", (const AssociatedTypeDecl *)) NOTE(no_witnesses_type_tuple,none, "protocol requires nested type %0", (const AssociatedTypeDecl *, Type)) NOTE(default_associated_type_unsatisfied_conformance,none, "default type %0 for associated type %1 (from protocol %2) " "does not conform to %3", (Type, const AssociatedTypeDecl *, Type, Type)) NOTE(default_associated_type_unsatisfied_superclass,none, "default type %0 for associated type %1 (from protocol %2) " "does not inherit from %3", (Type, const AssociatedTypeDecl *, Type, Type)) ERROR(associated_type_access,none, "associated type in " "%select{a private|a fileprivate|an internal|a package|a public|%error}0 protocol " "uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}1 type in its " "%select{default definition|requirement}2 ", (AccessLevel, AccessLevel, unsigned)) WARNING(associated_type_access_warn,none, "associated type in " "%select{a private|a fileprivate|an internal|a package|a public|%error}0 protocol uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}1 type in its " "%select{default definition|requirement}2 ", (AccessLevel, AccessLevel, unsigned)) ERROR(associated_type_not_usable_from_inline,none, "type referenced from a " "%select{default definition|requirement}0 of an associated type in a " "'@usableFromInline' protocol must be '@usableFromInline' or public", (unsigned)) WARNING(associated_type_not_usable_from_inline_warn,none, "type referenced from a " "%select{default definition|requirement}0 of an associated type in a " "'@usableFromInline' protocol should be '@usableFromInline' or public", (unsigned)) NOTE(bad_associated_type_deduction,none, "unable to infer associated type %0 for protocol %1", (const AssociatedTypeDecl *, const ProtocolDecl *)) NOTE(associated_type_deduction_unsatisfied_conformance,none, "candidate would match and infer %0 = %1 if %1 " "conformed to %2", (const AssociatedTypeDecl *, Type, Type)) NOTE(associated_type_deduction_unsatisfied_superclass,none, "candidate would match and infer %0 = %1 if %1 " "inherited from %2", (const AssociatedTypeDecl *, Type, Type)) NOTE(associated_type_witness_conform_impossible,none, "candidate can not infer %0 = %1 because %1 " "is not a nominal type and so can't conform to %2", (const AssociatedTypeDecl *, Type, Type)) NOTE(suggest_opaque_type_witness,none, "cannot infer %0 = %1 because %1 as a type cannot " "conform to protocols; did you mean to use an opaque " "result type?", (const AssociatedTypeDecl *, Type, Type)) NOTE(associated_type_witness_inherit_impossible,none, "candidate can not infer %0 = %1 because %1 " "is not a class type and so can't inherit from %2", (const AssociatedTypeDecl *, Type, Type)) NOTE(ambiguous_associated_type_deduction,none, "ambiguous inference of associated type %0: %1 vs. %2", (const AssociatedTypeDecl *, Type, Type)) NOTE(associated_type_deduction_witness,none, "matching requirement %0 to this declaration inferred associated type to " "%1", (const ValueDecl *, Type)) NOTE(associated_type_deduction_default,none, "using associated type default %0", (Type)) NOTE(ambiguous_witnesses_type,none, "multiple matching types named %0", (Identifier)) NOTE(protocol_witness_exact_match,none, "candidate exactly matches%0", (StringRef)) NOTE(protocol_witness_non_sendable,none, "candidate matches except for closure sendability%0%select{; this will be " "an error in Swift 6|}1", (StringRef, bool)) NOTE(protocol_witness_renamed,none, "rename to %0 to satisfy this requirement%1", (DeclName, StringRef)) NOTE(protocol_witness_kind_conflict,none, "candidate is not %select{an initializer|a function|a variable|" "a subscript}0", (RequirementKind)) NOTE(protocol_witness_type_conflict,none, "candidate has non-matching type %0%1", (WitnessType, StringRef)) NOTE(protocol_witness_missing_requirement,none, "candidate would match if %0 %select{conformed to|subclassed|" "was the same type as|%error|%error}2 %1", (Type, Type, unsigned)) NOTE(protocol_witness_optionality_conflict,none, "candidate %select{type has|result type has|parameter type has|" "parameter types have|result and parameter types have}0 incorrect " "optionality%1", (unsigned, StringRef)) ERROR(err_protocol_witness_optionality,none, "%select{type|result|parameter|parameters|" "result and parameters}0 of %1 %select{has|has|has|have|have|}0" " different optionality than required by protocol %2", (unsigned, const ValueDecl *, const ProtocolDecl *)) WARNING(warn_protocol_witness_optionality,none, "%select{type|result|parameter|parameters|" "result and parameters}0 of %1 %select{has|has|has|have|have|}0" " different optionality than expected by protocol %2", (unsigned, const ValueDecl *, const ProtocolDecl *)) NOTE(protocol_witness_static_conflict,none, "candidate operates on %select{a type|an instance}0, not " "%select{an instance|a type}0 as required", (bool)) NOTE(protocol_witness_const_conflict,none, "candidate operates as %select{const|non-const}0, not " "%select{non-const|const}0 as required", (bool)) NOTE(protocol_witness_prefix_postfix_conflict,none, "candidate is %select{|prefix, |postfix, }1not " "%select{prefix|postfix}0 as required", (bool, unsigned)) NOTE(protocol_witness_mutation_modifier_conflict,none, "candidate is marked %0 but protocol does not allow it", (SelfAccessKind)) NOTE(protocol_witness_settable_conflict,none, "candidate is not settable, but protocol requires it", ()) NOTE(protocol_witness_rethrows_conflict,none, "candidate is not 'rethrows', but protocol requires it", ()) NOTE(protocol_witness_rethrows_by_conformance_conflict,none, "candidate is 'rethrows' via a conformance, " "but the protocol requirement is not from a '@rethrows' protocol", ()) NOTE(protocol_witness_throws_conflict,none, "candidate throws, but protocol does not allow it", ()) NOTE(protocol_witness_not_objc,none, "candidate is explicitly '@nonobjc'", ()) NOTE(protocol_witness_enum_case_payload, none, "candidate is an enum case with associated values, " "but protocol does not allow it", ()) NOTE(protocol_witness_type,none, "possibly intended match", ()) NOTE(protocol_type_witness_unsatisfied_conformance,none, "possibly intended match %0 does not " "conform to %1", (Type, Type)) NOTE(protocol_type_witness_unsatisfied_superclass,none, "possibly intended match %0 does not " "inherit from %1", (Type, Type)) NOTE(protocol_type_witness_tuple,none, "possibly intended match %0 is unsuitable for tuple conformance; " "the associated type requirement must be fulfilled by a type alias " "with underlying type %1", (Type, Type)) NOTE(protocol_witness_circularity,none, "candidate references itself", ()) NOTE(protocol_conformance_here,none, "%select{|class }0%1 declares conformance to protocol %2 here", (bool, Identifier, Identifier)) NOTE(declared_protocol_conformance_here,none, "%select{%0 inherits conformance to protocol %2 from superclass|" "%0 declares conformance to protocol %2|" "conformance to %2 generated by macro|" "%0 implicitly conforms to protocol %2|" "%0 implicitly conforms to protocol %2 (via conformance to %3)}1 here", (Type, unsigned, Identifier, Identifier)) ERROR(witness_unavailable,none, "unavailable %kind0 was used to satisfy a requirement of protocol %1%select{|: %2}2", (const ValueDecl *, const ProtocolDecl *, StringRef)) GROUPED_WARNING( witness_deprecated, DeprecatedDeclaration, none, "deprecated default implementation is used to satisfy %kind0 required by " "protocol %1%select{|: %2}2", (const ValueDecl *, Identifier, StringRef)) WARNING(unavailable_conformance,none, "conformance of %0 to protocol %1 is already unavailable", (Type, Identifier)) ERROR(redundant_conformance,none, "redundant conformance of %0 to protocol %1", (Type, Identifier)) ERROR(redundant_conformance_conditional,none, "conflicting conformance of %0 to protocol %1; there cannot be more " "than one conformance, even with different conditional bounds", (Type, Identifier)) WARNING(redundant_conformance_adhoc,none, "conformance of %0 to protocol %1 was already stated in " "%select{the protocol's|the type's}2 module %3", (Type, Identifier, bool, Identifier)) WARNING(redundant_conformance_adhoc_conditional,none, "conformance of %0 to protocol %1 conflicts with that stated in " "%select{the protocol's|the type's}2 module %3 and will be ignored; " "there cannot be more than one conformance, even with different conditional bounds", (Type, Identifier, bool, Identifier)) NOTE(redundant_conformance_witness_ignored,none, "%kind0 will not be used to satisfy the conformance to %1", (const ValueDecl *, Identifier)) // "Near matches" WARNING(req_near_match,none, "%kind0 nearly matches %select{defaulted|optional}1 requirement %2 " "of protocol %3", (const ValueDecl *, bool, DeclName, Identifier)) NOTE(optional_req_nonobjc_near_match_add_objc,none, "add '@objc' to provide an Objective-C entrypoint", ()) NOTE(req_near_match_move,none, "move %0 to %select{an|another}1 extension to silence this warning", (DeclName, unsigned)) NOTE(req_near_match_nonobjc,none, "add '@nonobjc' to silence this %select{warning|error}0", (bool)) NOTE(req_near_match_access,none, "make %0 %select{ERROR|private|private|non-public|non-public}1 to silence this " "warning", (DeclName, AccessLevel)) // appendInterpolation methods GROUPED_ERROR(missing_append_interpolation,StringInterpolationConformance,none, "type conforming to 'StringInterpolationProtocol' does not implement " "a valid 'appendInterpolation' method", ()) GROUPED_WARNING(append_interpolation_static,StringInterpolationConformance,none, "'appendInterpolation' method will never be used because it is static", ()) GROUPED_WARNING(append_interpolation_void_or_discardable, StringInterpolationConformance,none, "'appendInterpolation' method does not return 'Void' or have a " "discardable result", ()) GROUPED_WARNING(append_interpolation_access_control, StringInterpolationConformance,none, "'appendInterpolation' method is %select{private|fileprivate|internal|package|" "public|open}0, but %1 is %select{private|fileprivate|internal|package|public|" "open}2", (AccessLevel, DeclName, AccessLevel)) // Protocols and existentials ERROR(assoc_type_outside_of_protocol,none, "cannot access associated type %0 from %1; use a concrete type or " "generic parameter base instead", (DeclNameRef, Type)) ERROR(typealias_outside_of_protocol,none, "cannot access type alias %0 from %1; use a concrete type or " "generic parameter base instead", (DeclNameRef, Type)) ERROR(objc_protocol_inherits_non_objc_protocol,none, "'@objc' protocol %0 cannot refine non-'@objc' protocol %1", (Type, Type)) ERROR(protocol_where_clause_self_requirement,none, "constraint with subject type of 'Self' is not supported; " "consider adding requirement to protocol inheritance clause instead", ()) ERROR(invalid_protocol_composition_member,none, "non-protocol, non-class type %0 cannot be used within a " "protocol-constrained type", (Type)) ERROR(protocol_composition_one_class,none, "protocol-constrained type cannot contain class %0 because it already " "contains class %1", (Type, Type)) ERROR(requires_conformance_nonprotocol,none, "type %0 constrained to non-protocol, non-class type %1", (Type, Type)) NOTE(requires_conformance_nonprotocol_fixit,none, "use '%0 == %1' to require '%0' to be '%1'", (StringRef, StringRef)) ERROR(requires_not_suitable_archetype,none, "type %0 in conformance requirement does not refer to a " "generic parameter or associated type", (Type)) ERROR(requires_not_suitable_inverse_subject,none, "cannot suppress '~%1' on type %0", (Type, StringRef)) ERROR(requires_not_suitable_inverse_outer_subject,none, "cannot suppress '~%1' on generic parameter '%0' defined in outer scope", (StringRef, StringRef)) ERROR(invalid_shape_requirement,none, "invalid same-shape requirement between %0 and %1", (Type, Type)) ERROR(unsupported_same_element,none, "same-element requirements are not yet supported", ()) ERROR(unsupported_pack_same_type,none, "same-type requirements between packs and concrete types are not yet supported", ()) ERROR(requires_generic_params_made_equal,none, "same-type requirement makes generic parameters %0 and %1 equivalent", (Type, Type)) ERROR(requires_generic_param_made_equal_to_concrete,none, "same-type requirement makes generic parameter %0 non-generic", (Type)) ERROR(shadowed_generic_param,none, "generic parameter %0 shadows generic parameter from outer scope with the same name", (const GenericTypeParamDecl *)) ERROR(recursive_decl_reference,none, "%kind0 references itself", (const ValueDecl *)) ERROR(recursive_generic_signature,none, "%kind0 has self-referential generic requirements", (const ValueDecl *)) ERROR(recursive_generic_signature_extension,none, "extension of %kind0 has self-referential generic requirements", (const ValueDecl *)) ERROR(recursive_same_type_constraint,none, "same-type constraint %0 == %1 is recursive", (Type, Type)) ERROR(recursive_superclass_constraint,none, "superclass constraint %0 : %1 is recursive", (Type, Type)) ERROR(requires_same_concrete_type,none, "generic signature requires types %0 and %1 to be the same", (Type, Type)) WARNING(missing_protocol_refinement, none, "protocol %0 should be declared to refine %1 due to a same-type constraint on 'Self'", (ProtocolDecl *, ProtocolDecl *)) ERROR(requirement_conflict,none, "no type for %0 can satisfy both %1", (Type, StringRef)) WARNING(inherited_associated_type_redecl,none, "redeclaration of associated type %0 from protocol %1 is better " "expressed as a 'where' clause on the protocol", (Identifier, Type)) WARNING(typealias_override_associated_type,none, "typealias overriding associated type %0 from protocol %1 is better " "expressed as same-type constraint on the protocol", (Identifier, Type)) WARNING(associated_type_override_typealias,none, "associated type %0 is redundant with type %0 declared in inherited " "%kind1", (Identifier, const NominalTypeDecl *)) ERROR(requirement_machine_completion_failed,none, "cannot build rewrite system for %select{generic signature|protocol}0; " "%select{%error|rule count|rule length|concrete type nesting|concrete type size|concrete type difference}1 limit exceeded", (unsigned, unsigned)) NOTE(requirement_machine_completion_rule,none, "failed rewrite rule is %0", (StringRef)) ERROR(associated_type_objc,none, "associated type %0 cannot be declared inside '@objc' protocol %1", (Identifier, Identifier)) ERROR(generic_param_access,none, "%kindonly0 %select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}3|private or fileprivate}4" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}2}1 " "because its generic %select{parameter|requirement}5 uses " "%select{a private|a fileprivate|an internal|a package|an '@_spi'|an '@_spi'}3 type", (const Decl *, bool, AccessLevel, AccessLevel, bool, bool)) WARNING(generic_param_access_warn,none, "%kindonly0 %select{should be declared " "%select{private|fileprivate|internal|package|%error|%error}3" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}2}1 " "because its generic %select{parameter|requirement}5 uses " "%select{a private|a fileprivate|an internal|a package|an '@_spi'|an '@_spi'}3 type", (const Decl *, bool, AccessLevel, AccessLevel, bool, bool)) ERROR(generic_param_usable_from_inline,none, "type referenced from a " "generic %select{parameter|requirement}1 of a '@usableFromInline' " "%kindonly0 must be '@usableFromInline' or public", (const Decl *, bool)) WARNING(generic_param_usable_from_inline_warn,none, "type referenced from a " "generic %select{parameter|requirement}1 of a '@usableFromInline' " "%kindonly0 should be '@usableFromInline' or public", (const Decl *, bool)) ERROR(override_multiple_decls_base,none, "declaration %0 cannot override more than one superclass declaration", (DeclName)) ERROR(override_sendability_mismatch,none, "declaration %0 has a type with different sendability from any potential " "overrides", (DeclName)) ERROR(override_global_actor_isolation_mismatch,none, "declaration %0 has a type with different global actor isolation from any potential " "overrides", (DeclName)) ERROR(override_multiple_decls_arg_mismatch,none, "declaration %0 has different argument labels from any potential " "overrides", (DeclName)) NOTE(overridden_near_match_here,none, "potential overridden %kind0 here", (const ValueDecl *)) ERROR(override_decl_extension,none, "%select{|non-'@objc'}0 %kind2 %select{" "is declared in extension of %3 and cannot be overridden|" "declared in %3 cannot be overridden from extension}1", (bool, bool, const ValueDecl *, DeclName)) NOTE(overridden_here,none, "overridden declaration is here", ()) NOTE(overridden_here_can_be_objc,none, "add '@objc' to make this declaration overridable", ()) ERROR(missing_override,none, "overriding declaration requires an 'override' keyword", ()) WARNING(missing_override_warn,none, "implicit override should be marked with 'override' or suppressed " "with '@_nonoverride'", ()) ERROR(multiple_override,none, "%0 has already been overridden", (DeclName)) NOTE(multiple_override_prev,none, "%0 previously overridden here", (DeclName)) ERROR(cannot_override_unavailable, none, "cannot override %base0 which has been marked unavailable%select{|: %1}1", (ValueDecl *, StringRef)) NOTE(suggest_removing_override, none, "remove 'override' modifier to declare a new %0", (DeclBaseName)) ERROR(override_unavailable, none, "cannot override %base0 with a declaration that is marked unavailable", (ValueDecl *)) ERROR(override_less_available,none, "overriding %base0 must be as available as declaration it overrides", (ValueDecl *)) ERROR(override_let_property,none, "cannot override immutable 'let' property %0 with the getter of a 'var'", (Identifier)) ERROR(override_not_accessible,none, "%select{|setter of }0overriding %kindonly1 must be as accessible as " "%select{its enclosing type|the declaration it overrides}2", (bool, const ValueDecl *, bool)) ERROR(override_of_non_open,none, "overriding non-open %kindonly0 outside of its defining module", (const ValueDecl *)) ERROR(method_does_not_override,none, "method does not override any method from its %select{parent protocol|superclass}0", (bool)) ERROR(property_does_not_override,none, "property does not override any property from its %select{parent protocol|superclass}0", (bool)) ERROR(subscript_does_not_override,none, "subscript does not override any subscript from its %select{parent protocol|superclass}0", (bool)) ERROR(initializer_does_not_override,none, "initializer does not override a designated initializer from its " "%select{parent protocol|superclass}0", (bool)) ERROR(failable_initializer_override,none, "failable initializer %0 cannot override a non-failable initializer", (DeclName)) NOTE(nonfailable_initializer_override_here,none, "non-failable initializer %0 overridden here", (DeclName)) NOTE(property_override_here,none, "attempt to override property here", ()) NOTE(subscript_override_here,none, "attempt to override subscript here", ()) NOTE(convenience_init_override_here,none, "attempt to override convenience initializer here", ()) NOTE(override_type_mismatch_with_fixits,none, "type does not match superclass %kindonly0 with type %1", (const ValueDecl *, Type)) NOTE(override_type_mismatch_with_fixits_init,none, "type does not match superclass initializer with %select{no arguments|argument %1|arguments %1}0", (unsigned, Type)) ERROR(override_nonclass_decl,none, "'override' can only be specified on class members", ()) ERROR(nonoverride_wrong_decl_context,none, "'@_nonoverride' can only be specified on class or protocol members", ()) ERROR(nonoverride_and_override_attr,none, "'override' cannot be combined with '@_nonoverride'", ()) ERROR(override_property_type_mismatch,none, "property %0 with type %1 cannot override a property with type %2", (Identifier, Type, Type)) ERROR(override_with_stored_property,none, "cannot override with a stored property %0", (Identifier)) WARNING(override_with_stored_property_warn,none, "cannot override with a stored property %0", (Identifier)) ERROR(observing_readonly_property,none, "cannot observe read-only property %0; it can't change", (Identifier)) ERROR(override_mutable_with_readonly_property,none, "cannot override mutable property with read-only property %0", (Identifier)) ERROR(override_argument_name_mismatch,none, "argument labels for %select{method|initializer}0 %1 do not match those " "of overridden %select{method|initializer}0 %2", (bool, DeclName, DeclName)) ERROR(override_ownership_mismatch,none, "cannot override %0 property with %1 property", (ReferenceOwnership, ReferenceOwnership)) ERROR(override_dynamic_self_mismatch,none, "cannot override a Self return type with a non-Self return type", ()) ERROR(override_class_declaration_in_extension,none, "cannot override a non-dynamic class declaration from an extension", ()) ERROR(override_with_more_effects,none, "cannot override non-%1 %kindonly0 with %1 %kindonly0", (const ValueDecl *, StringRef)) ERROR(override_typed_throws,none, "%kindonly0 that throws %1 cannot override one that throws %2", (const AbstractFunctionDecl *, Type, Type)) ERROR(override_throws_objc,none, "overriding a throwing '@objc' %select{method|initializer}0 with " "a non-throwing %select{method|initializer}0 is not supported", (bool)) ERROR(satisfy_throws_objc,none, "satisfying a throwing '@objc' %select{method|initializer}0 with " "a non-throwing %select{method|initializer}0 is not supported", (bool)) ERROR(override_optional_mismatch,none, "cannot override %kindonly0 %select{parameter|index}1 of type %2 with " "non-optional type %3", (const ValueDecl *, bool, Type, Type)) ERROR(override_optional_result_mismatch,none, "cannot override %kindonly0 %select{result|element}1 type %2 with " "optional type %3", (const ValueDecl *, bool, Type, Type)) WARNING(override_unnecessary_IUO,none, "overriding %kindonly0 parameter of type %1 with implicitly unwrapped " "optional type %2", (const ValueDecl *, Type, Type)) WARNING(override_unnecessary_result_IUO,none, "overriding %kindonly0 optional result type %1 with implicitly unwrapped " "optional type %2", (const ValueDecl *, Type, Type)) NOTE(override_unnecessary_IUO_remove,none, "remove '!' to make the parameter required", ()) NOTE(override_unnecessary_IUO_use_strict,none, "use '?' to make the result optional", ()) NOTE(override_unnecessary_IUO_silence,none, "add parentheses to silence this warning", ()) ERROR(override_mutable_covariant_property,none, "cannot override mutable property %0 of type %1 with covariant type %2", (Identifier, Type, Type)) ERROR(override_mutable_covariant_subscript,none, "cannot override mutable subscript of type %0 with covariant type %1", (Type, Type)) ERROR(static_decl_already_final,none, "static declarations are already final", ()) ERROR(open_decl_cannot_be_final,none, "%kindonly0 cannot be declared both 'final' and 'open'", (const Decl *)) ERROR(implicitly_final_cannot_be_open,none, "%select{'let' properties|members of 'final' classes|" "static declarations}0 are implicitly 'final'; use 'public' instead of " "'open'", (unsigned)) WARNING(implicitly_final_cannot_be_open_swift4,none, "%select{'let' properties|members of 'final' classes|" "static declarations}0 are implicitly 'final'; use 'public' instead of " "'open'", (unsigned)) // Inheritance ERROR(duplicate_inheritance,none, "duplicate inheritance from %0", (Type)) WARNING(duplicate_anyobject_class_inheritance,none, "redundant inheritance from 'AnyObject' and Swift 3 'class' keyword", ()) ERROR(inheritance_from_protocol_with_superclass,none, "inheritance from class-constrained protocol composition type %0", (Type)) WARNING(anyobject_class_inheritance_deprecated,Deprecation, "using 'class' keyword to define a class-constrained protocol is deprecated; " "use 'AnyObject' instead", ()) GROUPED_ERROR(multiple_inheritance,MultipleInheritance,none, "multiple inheritance from classes %0 and %1", (Type, Type)) ERROR(inheritance_from_non_protocol_or_class,none, "inheritance from non-protocol, non-class type %0", (Type)) ERROR(inheritance_from_non_protocol,none, "inheritance from non-protocol type %0", (Type)) ERROR(inheritance_from_anyobject,none, "only protocols can inherit from 'AnyObject'", ()) ERROR(superclass_not_first,none, "superclass %0 must appear first in the inheritance clause", (Type)) ERROR(superclass_not_open,none, "cannot inherit from non-open class %0 outside of its defining module", (Type)) NOTE(superclass_here,none,"superclass is declared here", ()) ERROR(superclass_of_open_not_open,none, "superclass %0 of open class must be open", (Type)) ERROR(inheritance_from_final_class,none, "inheritance from a final class %0", (Type)) ERROR(inheritance_from_unspecialized_objc_generic_class,none, "inheritance from a generic Objective-C class %0 must bind " "type parameters of %0 to specific concrete types", (Identifier)) ERROR(inheritance_from_class_with_missing_vtable_entries,none, "cannot inherit from class %0 because it has overridable members that " "could not be loaded", (Identifier)) NOTE(inheritance_from_class_with_missing_vtable_entry, none, "could not deserialize %0", (DeclName)) ERROR(inheritance_from_class_with_missing_vtable_entries_versioned,none, "cannot inherit from class %0 (compiled with Swift %1) because it has " "overridable members that could not be loaded in Swift %2", (Identifier, llvm::VersionTuple, llvm::VersionTuple)) ERROR(inheritance_from_cf_class,none, "cannot inherit from Core Foundation type %0", (Identifier)) ERROR(inheritance_from_objc_runtime_visible_class,none, "cannot inherit from class %0 because it is only visible via the " "Objective-C runtime", (Identifier)) // Enums ERROR(enum_case_access,none, "enum case in %select{a private|a fileprivate|an internal|a package|a public|%error}0 enum " "uses %select{a private|a fileprivate|an internal|a package|%error|%error}1 type", (AccessLevel, AccessLevel)) WARNING(enum_case_access_warn,none, "enum case in %select{a private|a fileprivate|an internal|a package|a public|%error}0 enum " "uses %select{a private|a fileprivate|an internal|a package|%error|%error}1 type", (AccessLevel, AccessLevel)) ERROR(enum_case_usable_from_inline,none, "type of enum case in '@usableFromInline' enum " "must be '@usableFromInline' or public", ()) WARNING(enum_case_usable_from_inline_warn,none, "type of enum case in '@usableFromInline' enum " "should be '@usableFromInline' or public", ()) ERROR(enum_stored_property,none, "enums must not contain stored properties", ()) // Enum raw types ERROR(multiple_enum_raw_types,none, "multiple enum raw types %0 and %1", (Type, Type)) ERROR(raw_type_not_first,none, "raw type %0 must appear first in the enum inheritance clause", (Type)) ERROR(raw_type_not_literal_convertible,none, "raw type %0 is not expressible by a string, integer, or floating-point literal", (Type)) ERROR(enum_raw_type_not_equatable,none, "RawRepresentable conformance cannot be synthesized because raw type %0 is not " "Equatable", (Type)) ERROR(enum_raw_type_nonconforming_and_nonsynthable,none, "%0 declares raw type %1, but does not conform to RawRepresentable " "and conformance could not be synthesized", (Type, Type)) NOTE(enum_declares_rawrep_with_raw_type,none, "%0 declares raw type %1, which implies RawRepresentable", (Type, Type)) ERROR(enum_raw_type_nonconforming_and_noncopyable,none, "%0 declares raw type %1, but cannot yet conform to RawRepresentable " "because it is noncopyable", (Type, Type)) ERROR(enum_raw_type_access,none, "enum %select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}1|private or fileprivate}3" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}1}0 " "because its raw type uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) WARNING(enum_raw_type_access_warn,none, "enum %select{should be declared " "%select{private|fileprivate|internal|package|%error|%error}1" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}1}0 " "because its raw type uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) ERROR(enum_raw_type_not_usable_from_inline,none, "type referenced from the raw type of a " "'@usableFromInline' enum " "must be '@usableFromInline' or public", ()) WARNING(enum_raw_type_not_usable_from_inline_warn,none, "type referenced from the raw type of a " "'@usableFromInline' enum " "should be '@usableFromInline' or public", ()) ERROR(empty_enum_raw_type,none, "an enum with no cases cannot declare a raw type", ()) ERROR(enum_raw_value_without_raw_type,none, "enum case cannot have a raw value if the enum does not have a raw type", ()) ERROR(enum_with_raw_type_case_with_argument,none, "enum with raw type cannot have cases with arguments", ()) NOTE(enum_raw_type_here,none, "declared raw type %0 here", (Type)) ERROR(objc_enum_no_raw_type,none, "'%0' enum must declare an integer raw type", (DeclAttribute)) ERROR(objc_enum_raw_type_not_integer,none, "'%0' enum raw type %1 is not an integer type", (DeclAttribute, Type)) ERROR(enum_non_integer_raw_value_auto_increment,none, "enum case must declare a raw value when the preceding raw value is not an integer", ()) ERROR(enum_non_integer_convertible_raw_type_no_value,none, "enum cases require explicit raw values when the raw type is not " "expressible by integer or string literal", ()) ERROR(enum_raw_value_not_unique,none, "raw value for enum case is not unique", ()) NOTE(enum_raw_value_used_here,none, "raw value previously used here", ()) NOTE(enum_raw_value_incrementing_from_here,none, "raw value auto-incremented from here",()) NOTE(enum_raw_value_incrementing_from_zero,none, "raw value implicitly auto-incremented from zero",()) NOTE(construct_raw_representable_from_unwrapped_value,none, "construct %0 from unwrapped %1 value", (Type, Type)) ERROR(decl_from_hidden_module,none, "cannot use %kind0 %select{here|as property wrapper here|" "as result builder here|" "in an extension with public or '@usableFromInline' members|" "in an extension with conditional conformances|" "in a public or '@usableFromInline' conformance|" "in an '@available' attribute here}1; " "%select{%2 has been imported as implementation-only|" "it is an SPI imported from %2|" "it is SPI|" "%2 was imported for SPI only|" "%2 was not imported by this file|" "C++ types from imported module %2 do not support library evolution|" "%2 was not imported publicly}3", (const Decl *, unsigned, Identifier, unsigned)) ERROR(typealias_desugars_to_type_from_hidden_module,none, "%0 aliases '%1.%2' and cannot be used %select{here|" "as property wrapper here|" "as result builder here|" "in an extension with public or '@usableFromInline' members|" "in an extension with conditional conformance|" "in a public or '@usableFromInline' conformance|" "<>}3 " "because %select{%4 has been imported as implementation-only|" "it is an SPI imported from %4|" "<>|" "%4 was imported for SPI only|" "%4 was not imported by this file|" "C++ types from imported module %4 do not support library evolution|" "%4 was not imported publicly}5", (const TypeAliasDecl *, StringRef, StringRef, unsigned, Identifier, unsigned)) ERROR(conformance_from_implementation_only_module,none, "cannot use conformance of %0 to %1 %select{here|as property wrapper here|" "as result builder here|" "in an extension with public or '@usableFromInline' members|" "in an extension with conditional conformances|" "<>|<>}2; " "%select{%3 has been imported as implementation-only|" "the conformance is declared as SPI in %3|" "the conformance is declared as SPI|" "%3 was imported for SPI only|" "%3 was not imported by this file|" "C++ types from imported module %3 do not support library evolution|" "%3 was not imported publicly}4", (Type, Identifier, unsigned, Identifier, unsigned)) NOTE(assoc_conformance_from_implementation_only_module,none, "in associated type %0 (inferred as %1)", (Type, Type)) ERROR(unexportable_clang_function_type,none, "cannot export the underlying C type of the function type %0; " "it may use anonymous types or types defined outside of a module", (Type)) ERROR(cxx_class_instantiation_failed,none, "couldn't instantiate a C++ class template", ()) WARNING(warn_implementation_only_conflict,none, "%0 inconsistently imported as implementation-only", (Identifier)) NOTE(implementation_only_conflict_here,none, "imported as implementation-only here", ()) ERROR(spi_only_import_conflict,none, "%0 inconsistently imported for SPI only", (Identifier)) NOTE(spi_only_import_conflict_here,none, "imported for SPI only here", ()) ERROR(error_public_import_of_private_module,none, "private module %0 is imported publicly from the public module %1", (Identifier, Identifier)) ERROR(inconsistent_implicit_access_level_on_import,none, "ambiguous implicit access level for import of %0; it is imported as " "'%select{private|fileprivate|internal|package|public|%error}1' elsewhere", (Identifier, AccessLevel)) NOTE(inconsistent_implicit_access_level_on_import_silence,none, "silence these warnings by adopting the upcoming feature " "'InternalImportsByDefault'", ()) NOTE(inconsistent_implicit_access_level_on_import_here,none, "imported " "'%select{private|fileprivate|internal|package|public|%error}0' here", (AccessLevel)) FIXIT(inconsistent_implicit_access_level_on_import_fixit, "%select{private|fileprivate|internal|package|public|%error}0 ", (AccessLevel)) WARNING(inconsistent_import_access_levels,none, "module %0 is imported as " "'%select{private|fileprivate|internal|package|public|%error}1' " "from the same file; " "this '%select{private|fileprivate|internal|package|public|%error}2' " "access level will be ignored", (const ModuleDecl *, AccessLevel, AccessLevel)) ERROR(implementation_only_decl_non_override,none, "'@_implementationOnly' can only be used on overrides", ()) ERROR(implementation_only_override_changed_type,none, "'@_implementationOnly' override must have the same type as the " "declaration it overrides (%0)", (Type)) ERROR(implementation_only_override_without_attr,none, "override of '@_implementationOnly' %kindonly0 should also be declared " "'@_implementationOnly'", (const ValueDecl *)) ERROR(implementation_only_override_import_without_attr,none, "override of %kindonly0 imported as implementation-only must be declared " "'@_implementationOnly'", (const ValueDecl *)) ERROR(import_attr_conflict,none, "%0 inconsistently imported with %1", (Identifier, DeclAttribute)) NOTE(import_attr_conflict_here,none, "imported with %0 here", (DeclAttribute)) // Derived conformances ERROR(cannot_synthesize_init_in_extension_of_nonfinal,none, "implementation of %0 for non-final class cannot be automatically " "synthesized in extension because initializer requirement %1 can only " "be satisfied by a 'required' initializer in the class definition", (Type, DeclName)) ERROR(cannot_synthesize_in_crossfile_extension,none, "extension outside of file declaring %kind0 prevents automatic synthesis " "of %1 for protocol %2", (const ValueDecl *, DeclName, Type)) ERROR(broken_additive_arithmetic_requirement,none, "AdditiveArithmetic protocol is broken: unexpected requirement", ()) ERROR(broken_case_iterable_requirement,none, "CaseIterable protocol is broken: unexpected requirement", ()) ERROR(broken_raw_representable_requirement,none, "RawRepresentable protocol is broken: unexpected requirement", ()) ERROR(broken_comparable_requirement,none, "Comparable protocol is broken: unexpected requirement", ()) ERROR(broken_equatable_requirement,none, "Equatable protocol is broken: unexpected requirement", ()) ERROR(broken_hashable_requirement,none, "Hashable protocol is broken: unexpected requirement", ()) ERROR(broken_hashable_no_hasher,none, "Hashable protocol is broken: Hasher type not found", ()) ERROR(broken_errortype_requirement,none, "Error protocol is broken: unexpected requirement", ()) ERROR(broken_int_hashable_conformance,none, "Int type is broken: does not conform to Hashable", ()) ERROR(broken_int_integer_literal_convertible_conformance,none, "Int type is broken: does not conform to ExpressibleByIntegerLiteral", ()) ERROR(no_less_than_overload_for_int,none, "no overload of '<' for Int", ()) ERROR(no_equal_overload_for_int,none, "no overload of '==' for Int", ()) ERROR(broken_coding_key_requirement,none, "CodingKey protocol is broken: unexpected requirement", ()) ERROR(broken_encodable_requirement,none, "Encodable protocol is broken: unexpected requirement", ()) ERROR(broken_decodable_requirement,none, "Decodable protocol is broken: unexpected requirement", ()) ERROR(codable_synthesis_empty_enum_not_supported,none, "cannot automatically synthesize %0 conformance for empty enum %1", (Type, Identifier)) ERROR(broken_differentiable_requirement,none, "Differentiable protocol is broken: unexpected requirement", ()) WARNING(differentiable_nondiff_type_implicit_noderivative_fixit,none, "stored property %0 has no derivative because %1 does not conform to " "'Differentiable'; add an explicit '@noDerivative' attribute" "%select{|, or conform %2 to 'AdditiveArithmetic'}3", (/*propName*/ Identifier, /*propType*/ Type, /*nominalName*/ Identifier, /*nominalCanDeriveAdditiveArithmetic*/ bool)) WARNING(differentiable_immutable_wrapper_implicit_noderivative_fixit,none, "synthesis of the 'Differentiable.move(by:)' requirement for %1 " "requires 'wrappedValue' in property wrapper %0 to be mutable or have a " "non-mutating 'move(by:)'; add an explicit '@noDerivative' attribute" "%select{|, or conform %1 to 'AdditiveArithmetic'}2", (/*wrapperType*/ Identifier, /*nominalName*/ Identifier, /*nominalCanDeriveAdditiveArithmetic*/ bool)) WARNING(differentiable_let_property_implicit_noderivative_fixit,none, "synthesis of the 'Differentiable.move(by:)' requirement for %0 " "requires all stored properties not marked with '@noDerivative' to be " "mutable or have a non-mutating 'move(by:)'; use 'var' instead, or " "add an explicit '@noDerivative' attribute " "%select{|, or conform %0 to 'AdditiveArithmetic'}1", (/*nominalName*/ Identifier, /*nominalCanDeriveAdditiveArithmetic*/ bool)) NOTE(codable_extraneous_codingkey_case_here,none, "CodingKey case %0 does not match any stored properties", (Identifier)) NOTE(codable_non_conforming_property_here,none, "cannot automatically synthesize %0 because %1 does not conform to %0", (Type, TypeLoc)) NOTE(codable_non_decoded_property_here,none, "cannot automatically synthesize %0 because %1 does not have a matching " "CodingKey and does not have a default value", (Type, Identifier)) NOTE(codable_codingkeys_type_is_not_an_enum_here,none, "cannot automatically synthesize %0 because 'CodingKeys' is not an enum", (Type)) NOTE(codable_codingkeys_type_does_not_conform_here,none, "cannot automatically synthesize %0 because 'CodingKeys' does not conform to CodingKey", (Type)) NOTE(decodable_no_super_init_here,none, "cannot automatically synthesize %0 because superclass does not have a callable %1", (DeclName, DeclName)) NOTE(decodable_super_init_not_designated_here,none, "cannot automatically synthesize %0 because implementation would need to call %1, which is not designated", (DeclName, DeclName)) NOTE(decodable_inaccessible_super_init_here,none, "cannot automatically synthesize %0 because implementation would need to call %1, which is inaccessible due to " "'%select{private|fileprivate|internal|package|%error|%error}2' protection level", (DeclName, DeclName, AccessLevel)) NOTE(decodable_super_init_is_failable_here,none, "cannot automatically synthesize %0 because implementation would need to call %1, which is failable", (DeclName, DeclName)) NOTE(decodable_suggest_overriding_init_here,none, "did you mean to override 'init(from:)'?", ()) NOTE(codable_suggest_overriding_init_here,none, "did you mean to override 'init(from:)' and 'encode(to:)'?", ()) NOTE(codable_enum_duplicate_case_name_here,none, "cannot automatically synthesize %0 because %1 has duplicate " "case name %2", (Type, Type, Identifier)) NOTE(codable_enum_duplicate_parameter_name_here,none, "cannot automatically synthesize %0 for %1 because " "user defined parameter name %2 in %3 conflicts with " "automatically generated parameter name", (Type, Type, Identifier, Identifier)) WARNING(decodable_property_will_not_be_decoded, none, "immutable property will not be decoded because it is declared with " "an initial value which cannot be overwritten", ()) NOTE(decodable_property_init_or_codingkeys_implicit, none, "set the initial value via the initializer or explicitly define a " "CodingKeys enum %select{including|without}0 a %1 case to silence " "this warning", (unsigned, DeclName)) NOTE(decodable_property_init_or_codingkeys_explicit, none, "set the initial value via the initializer or remove the %0 case from " "the CodingKeys enum to silence this warning", (DeclName)) NOTE(decodable_make_property_mutable, none, "make the property mutable instead", ()) NOTE(missing_member_type_conformance_prevents_synthesis, none, "%select{associated value|stored property}0 type %1 does not conform to " "protocol %2, preventing synthesized conformance " "of %3 to %2", (unsigned, Type, Type, Type)) NOTE(automatic_protocol_synthesis_unsupported,none, "automatic synthesis of %0 is not supported for %kindonly1 declarations", (const ProtocolDecl *, const NominalTypeDecl *)) NOTE(comparable_synthesis_raw_value_not_allowed, none, "enum declares raw type %0, preventing synthesized conformance of %1 to %2", (Type, Type, Type)) // Dynamic Self ERROR(dynamic_self_non_method,none, "%select{global|local}0 function cannot return 'Self'", (bool)) ERROR(dynamic_self_invalid,none, "covariant 'Self' or 'Self?' can only appear as the type of a " "property, subscript or method result; did you mean '%0'?", (StringRef)) ERROR(dynamic_self_in_mutable_property,none, "mutable property cannot have covariant 'Self' type", ()) ERROR(dynamic_self_in_stored_property,none, "stored property cannot have covariant 'Self' type", ()) ERROR(dynamic_self_in_mutable_subscript,none, "mutable subscript cannot have covariant 'Self' type", ()) ERROR(dynamic_self_invalid_property,none, "covariant 'Self' or 'Self?' can only appear at the top level of " "property type", ()) ERROR(dynamic_self_invalid_subscript,none, "covariant 'Self' or 'Self?' can only appear at the top level of " "subscript element type", ()) ERROR(dynamic_self_invalid_method,none, "covariant 'Self' or 'Self?' can only appear at the top level of " "method result type", ()) ERROR(dynamic_self_stored_property_init,none, "covariant 'Self' type cannot be referenced from a stored property initializer", ()) ERROR(dynamic_self_default_arg,none, "covariant 'Self' type cannot be referenced from a default argument expression", ()) //------------------------------------------------------------------------------ // MARK: Type Check Attributes //------------------------------------------------------------------------------ ERROR(attr_only_one_decl_kind,none, "%0 may only be used on '%1' declarations", (DeclAttribute,StringRef)) ERROR(attr_only_valid_on_func_or_init_params,none, "'%0' may only be used on function or initializer parameters", (StringRef)) ERROR(attr_not_on_variadic_parameters,none, "'%0' must not be used on variadic parameters", (StringRef)) ERROR(attr_not_on_stored_properties,none, "'%0' must not be used on stored properties", (DeclAttribute)) ERROR(attr_not_on_computed_properties,none, "'%0' must not be used on computed properties", (DeclAttribute)) WARNING(attr_has_no_effect_on_decl_with_access_level,none, "'%0' does not have any effect on " "%select{private|fileprivate|internal|package|%error|%error}1 declarations", (DeclAttribute, AccessLevel)) ERROR(attr_not_on_decl_with_invalid_access_level,none, "'%0' may not be used on " "%select{private|fileprivate|internal|package|%error|%error}1 declarations", (DeclAttribute, AccessLevel)) ERROR(attr_has_no_effect_decl_not_available_before,none, "'%0' has no effect because %1 is not " "available before %2 %3", (DeclAttribute, const ValueDecl *, AvailabilityDomain, AvailabilityRange)) ERROR(attr_has_no_effect_on_unavailable_decl,none, "'%0' has no effect because %1 is unavailable on %2", (DeclAttribute, const ValueDecl *, AvailabilityDomain)) ERROR(attr_ambiguous_reference_to_decl,none, "ambiguous reference to %0 in %1 attribute", (DeclNameRef, DeclAttribute)) ERROR(attr_contains_multiple_versions_for_platform,none, "'%0' contains multiple versions for %1", (DeclAttribute, StringRef)) ERROR(override_final,none, "%kindonly0 overrides a 'final' %kindonly1", (const ValueDecl *, const ValueDecl *)) ERROR(override_static,none, "cannot override %kindonly0", (const ValueDecl *)) ERROR(member_cannot_be_final,none, "only classes and class members may be marked with 'final'", ()) ERROR(final_not_allowed_here,none, "'final' may only be applied to classes, properties, methods, and " "subscripts", ()) ERROR(attr_incompatible_with_non_final,none, "'%0' cannot be applied to a non-final %kindonly1", (DeclAttribute, const ValueDecl *)) ERROR(attr_incompatible_with_override,none, "'%0' cannot be combined with 'override'", (DeclAttribute)) ERROR(attr_incompatible_with_objc,none, "'%0' must not be used on an '@objc' %kindonly1", (DeclAttribute, const ValueDecl *)) ERROR(attr_unusable_in_protocol,none, "'%0' cannot be used inside a protocol declaration", (DeclAttribute)) ERROR(final_not_on_accessors,none, "only the %select{property|subscript}0 itself can be marked as 'final'" ,(bool)) ERROR(override_rethrows_with_non_rethrows,none, "override of 'rethrows' %select{method|initializer}0 should also " "be 'rethrows'", (bool)) ERROR(rethrows_without_throwing_parameter,none, "'rethrows' function must take a throwing function argument", ()) ERROR(override_reasync_with_non_reasync,none, "override of 'reasync' %select{method|initializer}0 should also " "be 'reasync'", (bool)) ERROR(reasync_without_async_parameter,none, "'reasync' function must take an 'async' function argument", ()) ERROR(inherits_executor_without_async,none, "non-async functions cannot inherit an executor", ()) ERROR(isolation_in_inherits_executor,none, "#isolation%select{| (introduced by a default argument)}0 cannot be used " "within an '@_unsafeInheritExecutor' function", (bool)) ERROR(unsafe_inherits_executor_deprecated,none, "'@_unsafeInheritExecutor' is deprecated; consider an " "'isolated' parameter defaulted to '#isolation' instead", ()) ERROR(lifetime_invalid_global_scope,none, "%0 is only valid on methods", (DeclAttribute)) ERROR(eagermove_and_lexical_combined,none, "'@_eagerMove' and '@_noEagerMove' are alternate styles of lifetimes " "and can't be combined", ()) ERROR(eagermove_and_noncopyable_combined,none, "'@_eagerMove' cannot be applied to NonCopyable types", ()) ERROR(autoclosure_function_type,none, "'@autoclosure' only applies to function types", ()) ERROR(invalid_autoclosure_and_convention_attributes,none, "'@convention(%0)' attribute is not allowed on '@autoclosure' types", (StringRef)) ERROR(autoclosure_function_input_nonunit,none, "argument type of '@autoclosure' parameter must be '()'", ()) ERROR(escaping_non_function_parameter,none, "'@escaping' may only be used in function parameter position", ()) ERROR(escaping_inout_parameter,none, "inout expression is implicitly escaping", ()) ERROR(escaping_optional_type_argument, none, "closure is already escaping in optional type argument", ()) // @_compilerInitialized attribute ERROR(incompatible_compilerinitialized_var,none, "'@_compilerInitialized' attribute only applies to " "let-bound stored properties without a default value", ()) ERROR(protocol_compilerinitialized,none, "'@_compilerInitialized' is not currently supported in protocols", ()) ERROR(optional_compilerinitialized,none, "'@_compilerInitialized' cannot be applied to an Optional let", ()) ERROR(instancemember_compilerinitialized,none, "'@_compilerInitialized' can only be applied to a non-static class or actor member", ()) // @_nonEphemeral attribute ERROR(non_ephemeral_non_pointer_type,none, "'@_nonEphemeral' only applies to pointer types", ()) // NSManaged attribute ERROR(attr_NSManaged_not_instance_member,none, "'@NSManaged' only allowed on an instance property or method", ()) ERROR(attr_NSManaged_not_stored,none, "'@NSManaged' not allowed on %select{computed|observing|addressed}0 " "properties", (unsigned)) ERROR(attr_NSManaged_let_property,none, "'@NSManaged' not allowed on a 'let' property", ()) ERROR(attr_NSManaged_initial_value,none, "'@NSManaged' property cannot have an initial value", ()) ERROR(attr_NSManaged_NSCopying,none, "'@NSManaged' property cannot also be marked '@NSCopying'", ()) ERROR(attr_NSManaged_method_body,none, "'@NSManaged' method cannot have a body; it must be provided at runtime",()) // NSCopying attribute ERROR(nscopying_only_on_class_properties,none, "'@NSCopying' may only be used on properties in classes", ()) ERROR(nscopying_only_mutable,none, "'@NSCopying' requires property to be mutable", ()) ERROR(nscopying_only_stored_property,none, "'@NSCopying' is only valid on stored properties", ()) ERROR(nscopying_doesnt_conform,none, "'@NSCopying' is only valid with types that conform to" " the NSCopying protocol", ()) // UIApplicationMain/NSApplicationMain attribute #define SELECT_APPLICATION_MAIN "select{'UIApplicationMain'|'NSApplicationMain'|'main'}" #define SELECT_APPLICATION_DELEGATE "select{'UIApplicationDelegate'|'NSApplicationDelegate'}" #define SELECT_APPLICATION_TYPE "select{class|class|type}" #define SELECT_APPLICATION_TYPES "select{classes|classes|types}" #define SELECT_APPLICATION_MAIN_TYPES "select{() -> Void or () throws -> Void|() -> Void, () throws -> Void, () async -> Void, or () async throws -> Void}" ERROR(attr_ApplicationMain_not_ApplicationDelegate,none, "%" SELECT_APPLICATION_MAIN "0 class must conform to the %" SELECT_APPLICATION_DELEGATE "0 protocol", (unsigned)) ERROR(attr_generic_ApplicationMain_not_supported,none, "generic %" SELECT_APPLICATION_MAIN "0 %" SELECT_APPLICATION_TYPES "0 are not supported", (unsigned)) ERROR(attr_ApplicationMain_multiple,none, "%" SELECT_APPLICATION_MAIN "0 attribute can only apply to one %" SELECT_APPLICATION_TYPE "0 in a module", (unsigned)) ERROR(attr_ApplicationMain_with_script,none, "%" SELECT_APPLICATION_MAIN "0 attribute cannot be used in a module that contains " "top-level code", (unsigned)) ERROR(attr_ApplicationMain_deprecated,none, "%" SELECT_APPLICATION_MAIN "0 is deprecated", (unsigned)) NOTE(attr_ApplicationMain_deprecated_use_attr_main,none, "use '@main' instead", ()) NOTE(attr_ApplicationMain_parse_as_library,none, "pass '-parse-as-library' to compiler invocation if this is intentional", ()) NOTE(attr_ApplicationMain_script_here,none, "top-level code defined in this source file", ()) ERROR(attr_MainType_without_main,none, "%0 is annotated with '@main' and must provide a main static function " "of type %" SELECT_APPLICATION_MAIN_TYPES "1", (const ValueDecl *, bool)) NOTE(note_add_main_sync,none, "add 'static func main()'", ()) NOTE(note_add_main_sync_throws,none, "add 'static func main() throws'", ()) NOTE(note_add_main_async,none, "add 'static func main() async'", ()) NOTE(note_add_main_async_throws,none, "add 'static func main() async throws'", ()) #undef SELECT_APPLICATION_MAIN_TYPES #undef SELECT_APPLICATION_MAIN #undef SELECT_APPLICATION_DELEGATE ERROR(attr_rawlayout_experimental,none, "the '@_rawLayout' attribute is experimental", ()) ERROR(attr_rawlayout_cannot_be_copyable,none, "type with '@_rawLayout' cannot be copied and must be declared ~Copyable", ()) ERROR(attr_rawlayout_cannot_have_stored_properties,none, "type with '@_rawLayout' cannot have stored properties", ()) ERROR(attr_rawlayout_cannot_have_alignment_attr,none, "type with '@_rawLayout' cannot also have an '@_alignment' attribute", ()) ERROR(attr_rawlayout_invalid_count_type,none, "'@_rawLayout' count must either be integer literal or a generic " "argument", ()) // lazy ERROR(lazy_not_on_let,none, "'lazy' cannot be used on a let", ()) ERROR(lazy_not_on_computed,none, "'lazy' cannot be used on a computed property", ()) ERROR(lazy_on_already_lazy_global,none, "'lazy' cannot be used on an already-lazy global", ()) ERROR(lazy_not_in_protocol,none, "'lazy' cannot be used on a protocol requirement", ()) ERROR(lazy_requires_initializer,none, "lazy properties must have an initializer", ()) ERROR(lazy_requires_single_var,none, "'lazy' cannot destructure an initializer", ()) ERROR(lazy_not_strong,none, "lazy properties cannot be %0", (ReferenceOwnership)) ERROR(lazy_var_storage_access,none, "access to the underlying storage of a lazy property is not allowed", ()) // Debugger function attribute. ERROR(attr_for_debugger_support_only,none, "'@LLDBDebuggerSupport' may only be used when debugger support is on", ()) // @_implements ERROR(implements_attr_protocol_lacks_member,none, "protocol %0 has no member %1", (const ProtocolDecl *, DeclName)) ERROR(implements_attr_non_protocol_type,none, "non-protocol type in '@_implements'", ()) ERROR(implements_attr_protocol_not_conformed_to,none, "containing type %0 does not conform to protocol %1", (const NominalTypeDecl *, const ProtocolDecl *)) // @differentiable // TODO(TF-482): Change duplicate `@differentiable` attribute diagnostic to also // mention "same generic requirements". ERROR(differentiable_attr_duplicate,none, "duplicate '@differentiable' attribute with same parameters", ()) NOTE(differentiable_attr_duplicate_note,none, "other attribute declared here", ()) ERROR(differentiable_attr_protocol_req_where_clause,none, "'@differentiable' attribute on protocol requirement cannot specify " "'where' clause", ()) ERROR(differentiable_attr_class_member_dynamic_self_result_unsupported,none, "'@differentiable' attribute cannot be declared on class members " "returning 'Self'", ()) ERROR(differentiable_attr_nonfinal_class_init_unsupported,none, "'@differentiable' attribute cannot be declared on 'init' in a non-final " "class; consider making %0 final", (Type)) ERROR(differentiable_attr_empty_where_clause,none, "empty 'where' clause in '@differentiable' attribute", ()) ERROR(differentiable_attr_where_clause_for_nongeneric_original,none, "'where' clause is valid only when original function is generic %0", (const ValueDecl *)) ERROR(differentiable_attr_layout_req_unsupported,none, "'@differentiable' attribute does not yet support layout requirements", ()) ERROR(overriding_decl_missing_differentiable_attr,none, "overriding declaration is missing attribute '%0'", (StringRef)) NOTE(protocol_witness_missing_differentiable_attr_invalid_context,none, "candidate is missing explicit '%0' attribute to satisfy requirement %1 " "(in protocol %3); explicit attribute is necessary because candidate is " "declared in a different type context or file than the conformance of %2 " "to %3", (StringRef, const ValueDecl *, Type, Type)) // @derivative ERROR(derivative_attr_expected_result_tuple,none, "'@derivative(of:)' attribute requires function to return a two-element " "tuple; first element must have label 'value:' and second element must " "have label 'pullback:' or 'differential:'", ()) ERROR(derivative_attr_invalid_result_tuple_value_label,none, "'@derivative(of:)' attribute requires function to return a two-element " "tuple; first element must have label 'value:'", ()) ERROR(derivative_attr_invalid_result_tuple_func_label,none, "'@derivative(of:)' attribute requires function to return a two-element " "tuple; second element must have label 'pullback:' or 'differential:'", ()) ERROR(derivative_attr_result_func_type_mismatch,none, "function result's %0 type does not match %1", (Identifier, const ValueDecl *)) NOTE(derivative_attr_result_func_type_mismatch_note,none, "%0 does not have expected type %1", (Identifier, Type)) NOTE(derivative_attr_result_func_original_note,none, "%0 defined here", (const ValueDecl *)) ERROR(derivative_attr_original_stored_property_unsupported,none, "cannot register derivative for stored property %0", (DeclNameRef)) ERROR(derivative_attr_class_member_dynamic_self_result_unsupported,none, "cannot register derivative for class member %0 returning 'Self'", (DeclNameRef)) ERROR(derivative_attr_nonfinal_class_init_unsupported,none, "cannot register derivative for 'init' in a non-final class; consider " "making %0 final", (Type)) ERROR(derivative_attr_unsupported_accessor_kind,none, "cannot register derivative for %0", (/*accessorKind*/ DescriptiveDeclKind)) // TODO(https://github.com/apple/swift/issues/55542): Remove this temporary diagnostic. ERROR(derivative_attr_class_setter_unsupported,none, "cannot yet register derivative for class property or subscript setters", ()) // TODO(TF-982): Remove this temporary diagnostic. NOTE(derivative_attr_protocol_requirement_unsupported,none, "cannot yet register derivative default implementation for protocol " "requirements", ()) ERROR(derivative_attr_original_already_has_derivative,none, "a derivative already exists for %0", (const ValueDecl *)) NOTE(derivative_attr_duplicate_note,none, "other attribute declared here", ()) ERROR(derivative_attr_access_level_mismatch,none, "derivative function must have same access level as original function; " "derivative function %2 is " "%select{private|fileprivate|internal|package|public|open}3, " "but original function %0 is " "%select{private|fileprivate|internal|package|public|open}1", (/*original*/ const ValueDecl *, /*original*/ AccessLevel, /*derivative*/ const ValueDecl *, /*derivative*/ AccessLevel)) NOTE(derivative_attr_fix_access,none, "mark the derivative function as " "'%select{private|fileprivate|internal|package|@usableFromInline|@usableFromInline}0' " "to match the original function", (AccessLevel)) ERROR(derivative_attr_always_emit_into_client_mismatch,none, "either both or none of derivative and original function must have " "@alwaysEmitIntoClient attribute", ()) ERROR(derivative_attr_static_method_mismatch_original,none, "unexpected derivative function declaration; " "%0 requires the derivative function %1 to be %select{an instance|a 'static'}2 method", (/*original*/const ValueDecl *, /*derivative*/ const ValueDecl *, /*originalIsStatic*/bool)) NOTE(derivative_attr_static_method_mismatch_original_note,none, "original function %0 is %select{an instance|a 'static'}1 method", (/*original*/ const ValueDecl *, /*originalIsStatic*/bool)) NOTE(derivative_attr_static_method_mismatch_fix,none, "make derivative function %0 %select{an instance|a 'static'}1 method", (/*derivative*/ const ValueDecl *, /*mustBeStatic*/bool)) // @transpose ERROR(transpose_attr_invalid_linearity_parameter_or_result,none, "cannot transpose with respect to original %select{result|parameter}1 " "'%0' that does not conform to 'Differentiable' and satisfy " "'%0 == %0.TangentVector'", (StringRef, /*isParameter*/ bool)) ERROR(transpose_attr_cannot_use_named_wrt_params,none, "cannot use named 'wrt' parameters in '@transpose(of:)' attribute, found " "%0", (Identifier)) ERROR(transpose_attr_wrt_self_must_be_static,none, "the transpose of an instance method must be a 'static' method in the " "same type when 'self' is a linearity parameter", ()) NOTE(transpose_attr_wrt_self_self_type_mismatch_note,none, "the transpose is declared in %0 but the original function is declared in " "%1", (Type, Type)) ERROR(transpose_attr_static_method_mismatch_original,none, "unexpected transpose function declaration; " "%0 requires the transpose function %1 to be %select{an instance|a 'static'}2 method", (/*original*/const ValueDecl *, /*transpose*/ const ValueDecl *, /*originalIsStatic*/bool)) NOTE(transpose_attr_static_method_mismatch_original_note,none, "original function %0 is %select{an instance|a 'static'}1 method", (/*original*/ const ValueDecl *, /*originalIsStatic*/bool)) NOTE(transpose_attr_static_method_mismatch_fix,none, "make transpose function %0 %select{an instance|a 'static'}1 method", (/*transpose*/ const ValueDecl *, /*mustBeStatic*/bool)) // Automatic differentiation attributes ERROR(autodiff_attr_original_decl_ambiguous,none, "referenced declaration %0 is ambiguous", (DeclNameRef)) NOTE(autodiff_attr_original_decl_ambiguous_candidate,none, "candidate %kindonly0 found here", (const AbstractFunctionDecl *)) ERROR(autodiff_attr_original_decl_none_valid,none, "referenced declaration %0 could not be resolved", (DeclNameRef)) NOTE(autodiff_attr_original_decl_invalid_kind,none, "candidate %kindonly0 is not a 'func', 'init', 'subscript', or 'var' " "computed property declaration", (const ValueDecl *)) NOTE(autodiff_attr_original_decl_missing_accessor,none, "candidate %kindonly0 does not have a %1", (const ValueDecl *, /*accessorDeclKind*/ DescriptiveDeclKind)) NOTE(autodiff_attr_original_decl_type_mismatch,none, "candidate %kindonly0 does not have " "%select{expected type|type equal to or less constrained than}2 %1", (const ValueDecl *, Type, /*hasGenericSignature*/ bool)) NOTE(autodiff_attr_original_decl_not_same_type_context,none, "candidate %kindonly0 is not defined in the current type context", (const ValueDecl *)) ERROR(autodiff_attr_original_void_result,none, "cannot differentiate void function %0", (DeclName)) ERROR(autodiff_attr_result_not_differentiable,none, "can only differentiate functions with results that conform to " "'Differentiable', but %0 does not conform to 'Differentiable'", (Type)) ERROR(autodiff_attr_opaque_result_type_unsupported,none, "cannot differentiate functions returning opaque result types", ()) // differentiation `wrt` parameters clause ERROR(diff_function_no_parameters,none, "%0 has no parameters to differentiate with respect to", (const ValueDecl *)) ERROR(diff_params_clause_param_name_unknown,none, "unknown parameter name %0", (Identifier)) ERROR(diff_params_clause_self_instance_method_only,none, "'self' parameter is only applicable to instance methods", ()) ERROR(diff_params_clause_self_must_be_first,none, "'self' parameter must come first in the parameter list", ()) ERROR(diff_params_clause_params_not_original_order,none, "parameters must be specified in original order", ()) ERROR(diff_params_clause_param_index_out_of_range,none, "parameter index is larger than total number of parameters", ()) ERROR(diff_params_clause_no_inferred_parameters,PointsToFirstBadToken, "no differentiation parameters could be inferred; must differentiate " "with respect to at least one parameter conforming to 'Differentiable'", ()) ERROR(diff_params_clause_param_not_differentiable,none, "can only differentiate with respect to parameters that conform to " "'Differentiable', but %0 does not conform to 'Differentiable'", (Type)) // completionHanderAsync attribute WARNING(warn_use_async_alternative,none, "consider using asynchronous alternative function",()) //------------------------------------------------------------------------------ // MARK: Type Check Expressions //------------------------------------------------------------------------------ NOTE(found_candidate,none, "found this candidate", ()) NOTE(found_candidate_in_module,none, "found this candidate %select{|in module %1}0", (bool, const ModuleDecl *)) NOTE(found_candidate_type,none, "found candidate with type %0", (Type)) ERROR(no_MaxBuiltinFloatType_found,none, "standard library error: _MaxBuiltinFloatType is not properly defined", ()) ERROR(no_member_of_module,none, "module %0 has no member named %1", (Identifier, DeclNameRef)) // 'super'. ERROR(super_invalid_parent_expr,none, "'super' may be used only to access a superclass member, subscript, or " "initializer", ()) ERROR(super_no_superclass,none, "'super' cannot be used in %select{|extension of }0class %1 because it " "has no superclass", (bool, const ClassDecl *)) ERROR(super_invalid_context,none, "'super' cannot be used outside of a class computed property, method, " "initializer, deinitializer, or subscript", ()) ERROR(super_in_nonclass_type,none, "'super' cannot be used in non-class type %0", (const NominalTypeDecl *)) ERROR(super_in_closure_with_capture,none, "using 'super' in a closure where 'self' is explicitly captured is " "not yet supported", ()) NOTE(super_in_closure_with_capture_here,none, "'self' explicitly captured here", ()) ERROR(unqualified_init,none, "initializer expression requires explicit access" "%select{|; did you mean to prepend it with|; did you mean to prepend " "it with}0%select{| 'self.'?| 'super.'?}0", (unsigned)) ERROR(bad_init_ref_base, none, "'init' can only refer to the initializers of " "'self'%select{| or 'super'}0", (bool)) ERROR(init_delegation_outside_initializer,none, "initializer delegation can only occur within an initializer", ()) ERROR(init_delegates_and_chains,none, "initializer cannot both delegate ('self.init') and chain to a " "superclass initializer ('super.init')", ()) NOTE(init_delegation_or_chain,none, "previous %select{delegation|chaining}0 call is here", (bool)) ERROR(delegating_convenience_super_init,none, "convenience initializer for %0 must delegate (with 'self.init') rather " "than chaining to a superclass initializer (with 'super.init')", (Type)) ERROR(delegating_designated_init,none, "designated initializer for %0 cannot delegate (with 'self.init'); " "did you mean this to be a convenience initializer?", (Type)) ERROR(delegating_designated_init_in_extension,none, "designated initializer for %0 cannot delegate (with 'self.init')", (Type)) NOTE(delegation_here,none, "delegation occurs here", ()) ERROR(chain_convenience_init,none, "must call a designated initializer of the superclass %0", (Type)) ERROR(delegate_chain_nonoptional_to_optional,none, "a non-failable initializer cannot %select{delegate|chain}0 to " "failable initializer %1 written with 'init?'", (bool, const ConstructorDecl *)) NOTE(init_force_unwrap,none, "force potentially-failing result with '!'", ()) NOTE(init_propagate_failure,none, "propagate the failure with 'init?'", ()) ERROR(delegate_chain_nonoptional_to_optional_try,none, "a non-failable initializer cannot use 'try?' to " "%select{delegate|chain}0 to another initializer", (bool)) NOTE(init_delegate_force_try,none, "force potentially-failing result with 'try!'", ()) ERROR(init_delegation_nested,none, "%select{initializer delegation ('self.init')|" "initializer chaining ('super.init')}0 cannot be nested in another " "%select{expression|statement}1", (bool, bool)) NOTE(convenience_init_here,none, "convenience initializer is declared here", ()) ERROR(designated_init_in_extension,none, "designated initializer cannot be declared in an extension of %0; " "did you mean this to be a convenience initializer?", (const ValueDecl *)) ERROR(designated_init_in_extension_no_convenience_tip,none, "designated initializer cannot be declared in an extension of %0", (const ValueDecl *)) ERROR(no_convenience_keyword_init,none, "initializers in %0 are not marked with 'convenience'", (StringRef)) ERROR(cfclass_convenience_init,none, "convenience initializers are not supported in extensions of CF types", ()) ERROR(dynamic_construct_class,none, "constructing an object of class type %0 with a metatype value must use " "a 'required' initializer", (Type)) NOTE(note_nonrequired_initializer,none, "selected %select{non-required|implicit}0 initializer %1", (bool, const ConstructorDecl *)) ERROR(construct_protocol_value,none, "value of type %0 is a protocol; it cannot be instantiated", (Type)) ERROR(construct_protocol_by_name,none, "type %0 cannot be instantiated", (Type)) // Operators ERROR(unknown_binop,none, "operator is not a known binary operator", ()) ERROR(non_associative_adjacent_operators,none, "adjacent operators are in non-associative precedence group %0", (Identifier)) ERROR(unordered_adjacent_operators,none, "adjacent operators are in unordered precedence groups %0 and %1", (Identifier, Identifier)) ERROR(missing_builtin_precedence_group,none, "broken standard library: missing builtin precedence group %0", (Identifier)) WARNING(nan_comparison, none, "comparison with '.nan' using %0 is always %select{false|true}1, use " "'%2.isNaN' to check if '%3' %select{is not a number|is a number}1", (Identifier, bool, StringRef, StringRef)) WARNING(nan_comparison_without_isnan, none, "comparison with '.nan' using %0 is always %select{false|true}1", (Identifier, bool)) WARNING(nan_comparison_both_nan, none, "'.nan' %0 '.nan' is always %select{false|true}1", (StringRef, bool)) // If you change this, also change enum TryKindForDiagnostics. #define TRY_KIND_SELECT(SUB) "%select{try|try!|try?|await|unsafe}" #SUB ERROR(try_rhs,none, "'" TRY_KIND_SELECT(0) "' cannot appear to the right of a " "non-assignment operator", (unsigned)) ERROR(try_if_rhs_noncovering,none, "'" TRY_KIND_SELECT(0) "' following conditional operator does not cover " "everything to its right", (unsigned)) ERROR(try_assign_rhs_noncovering,none, "'" TRY_KIND_SELECT(0) "' following assignment operator does not cover " "everything to its right", (unsigned)) ERROR(broken_stdlib_type,none, "standard library type '%0' is missing or broken; this is a compiler bug", (StringRef)) WARNING(inject_forced_downcast,none, "treating a forced downcast to %0 as optional will never produce 'nil'", (Type)) NOTE(forced_to_conditional_downcast,none, "use 'as?' to perform a conditional downcast to %0", (Type)) NOTE(silence_inject_forced_downcast,none, "add parentheses around the cast to silence this warning", ()) ERROR(conditional_downcast_foreign,none, "conditional downcast to CoreFoundation type %0 will always succeed", (Type)) NOTE(note_explicitly_compare_cftypeid,none, "did you mean to explicitly compare the CFTypeIDs of %0 and %1?", (DeclBaseName, Type)) ERROR(optional_used_as_boolean,none, "optional type %0 cannot be used as a boolean; " "test for '%select{!|=}1= nil' instead", (Type, bool)) ERROR(integer_used_as_boolean,none, "type %0 cannot be used as a boolean; " "test for '%select{!|=}1= 0' instead", (Type, bool)) ERROR(integer_used_as_boolean_literal,none, "integer literal value '%0' cannot be used as a boolean; " "did you mean '%select{false|true}1'?", (StringRef, bool)) ERROR(interpolation_missing_proto,none, "string interpolation requires the protocol 'ExpressibleByStringInterpolation' to be defined", ()) ERROR(interpolation_broken_proto,none, "protocol 'ExpressibleByStringInterpolation' is broken", ()) ERROR(object_literal_broken_proto,none, "object literal protocol is broken", ()) ERROR(discard_expr_outside_of_assignment,none, "'_' can only appear in a pattern or on the left side of an assignment", ()) WARNING(discard_expr_void_result_redundant, none, "using '_' to ignore the result of a Void-returning function " "is redundant", ()) ERROR(collection_literal_heterogeneous,none, "heterogeneous collection literal could only be inferred to %0; add" " explicit type annotation if this is intentional", (Type)) ERROR(collection_literal_empty,none, "empty collection literal requires an explicit type", ()) ERROR(unresolved_member_no_inference,none, "reference to member %0 cannot be resolved without a contextual type", (DeclNameRef)) ERROR(cannot_infer_base_of_unresolved_member,none, "cannot infer contextual base in reference to member %0", (DeclNameRef)) ERROR(cannot_infer_underlying_for_opaque_result,none, "underlying type for opaque result type %0 could not be inferred from return expression", (Type)) ERROR(unresolved_nil_literal,none, "'nil' requires a contextual type", ()) ERROR(cannot_force_unwrap_nil_literal,none, "'nil' literal cannot be force unwrapped", ()) ERROR(could_not_infer_placeholder,none, "could not infer type for placeholder", ()) ERROR(could_not_infer_pack_element,none, "could not infer pack element #%0 from context", (unsigned)) NOTE(note_in_opening_pack_element,none, "in inferring pack element #%0 of '%1'", (unsigned,StringRef)) ERROR(failed_to_produce_diagnostic,none, "failed to produce diagnostic for expression; " SWIFT_BUG_REPORT_MESSAGE, ()) ERROR(missing_protocol,none, "missing protocol %0", (Identifier)) ERROR(nil_literal_broken_proto,none, "protocol 'ExpressibleByNilLiteral' is broken", ()) ERROR(builtin_integer_literal_broken_proto,none, "protocol '_ExpressibleByBuiltinIntegerLiteral' is broken", ()) ERROR(integer_literal_broken_proto,none, "protocol 'ExpressibleByIntegerLiteral' is broken", ()) ERROR(builtin_float_literal_broken_proto,none, "protocol '_ExpressibleByBuiltinFloatLiteral' is broken", ()) ERROR(float_literal_broken_proto,none, "protocol 'ExpressibleByFloatLiteral' is broken", ()) ERROR(builtin_boolean_literal_broken_proto,none, "protocol '_ExpressibleByBuiltinBooleanLiteral' is broken", ()) ERROR(boolean_literal_broken_proto,none, "protocol 'ExpressibleByBooleanLiteral' is broken", ()) ERROR(builtin_unicode_scalar_literal_broken_proto,none, "protocol '_ExpressibleByBuiltinUnicodeScalarLiteral' is broken", ()) ERROR(unicode_scalar_literal_broken_proto,none, "protocol 'ExpressibleByUnicodeScalarLiteral' is broken", ()) ERROR(builtin_extended_grapheme_cluster_literal_broken_proto,none, "protocol '_ExpressibleByBuiltinExtendedGraphemeClusterLiteral' is broken", ()) ERROR(extended_grapheme_cluster_literal_broken_proto,none, "protocol 'ExpressibleByExtendedGraphemeClusterLiteral' is broken", ()) ERROR(builtin_string_literal_broken_proto,none, "protocol '_ExpressibleByBuiltinStringLiteral' is broken", ()) ERROR(string_literal_broken_proto,none, "protocol 'ExpressibleByStringLiteral' is broken", ()) // Array literals ERROR(should_use_dictionary_literal,none, "dictionary of type %0 cannot be %select{used|initialized}1 " "with array literal", (Type, bool)) NOTE(meant_dictionary_lit,none, "did you mean to use a dictionary literal instead?", ()) ERROR(should_use_empty_dictionary_literal,none, "use [:] to get an empty dictionary literal", ()) // Dictionary literals WARNING(duplicated_literal_keys_in_dictionary_literal, none, "dictionary literal of type %0 has duplicate entries for %1 literal key%select{ %3|}2", (Type, StringRef, bool, StringRef)) NOTE(duplicated_key_declared_here, none, "duplicate key declared here", ()) // Generic specializations ERROR(cannot_explicitly_specialize_function,none, "cannot explicitly specialize %kind0", (ValueDecl *)) ERROR(not_a_generic_type,none, "cannot specialize non-generic type %0", (Type)) ERROR(invalid_generic_builtin_type,none, "invalid generic arguments to builtin type %0", (Type)) ERROR(not_a_generic_macro,none, "cannot specialize a non-generic external macro %0", (const ValueDecl *)) ERROR(protocol_declares_unknown_primary_assoc_type,none, "an associated type named %0 must be declared in the protocol %1 or a protocol it inherits", (Identifier, Type)) ERROR(protocol_declares_duplicate_primary_assoc_type,none, "duplicate primary associated type name %0", (Identifier)) ERROR(protocol_does_not_have_primary_assoc_type,none, "protocol %0 does not have primary associated types that can be " "constrained", (Type)) ERROR(parameterized_protocol_type_argument_count_mismatch,none, "protocol type %0 specialized with %select{too many|too few}3 type arguments " "(got %1, but expected %2)", (Type, unsigned, unsigned, unsigned)) ERROR(cannot_specialize_self,none, "cannot specialize 'Self'", ()) NOTE(specialize_explicit_type_instead,none, "did you mean to explicitly reference %0 instead?", (Type)) ERROR(too_few_generic_arguments,none, "generic type %0 specialized with too few type parameters " "(got %1, but expected %2)", (Identifier, unsigned, unsigned)) ERROR(too_few_generic_arguments_pack,none, "generic type %0 specialized with too few type parameters " "(got %1, but expected at least %2)", (Identifier, unsigned, unsigned)) ERROR(too_many_generic_arguments,none, "generic type %0 specialized with too many type parameters " "(got %1, but expected %2)", (Identifier, unsigned, unsigned)) ERROR(generic_argument_pack_mismatch,none, "generic type %0 specialized with mismatched type parameter pack", (Identifier)) ERROR(generic_type_requires_arguments,none, "reference to generic type %0 requires arguments in <...>", (Type)) NOTE(descriptive_generic_type_declared_here,none, "%0 declared here", (StringRef)) ERROR(placeholder_type_not_allowed,none, "type placeholder not allowed here", ()) ERROR(placeholder_type_not_allowed_in_return_type,none, "type placeholder may not appear in function return type", ()) ERROR(placeholder_type_not_allowed_in_parameter,none, "type placeholder may not appear in top-level parameter", ()) ERROR(placeholder_type_not_allowed_in_pattern,none, "placeholder type may not appear as type of a variable", ()) NOTE(replace_placeholder_with_inferred_type,none, "replace the placeholder with the inferred type %0", (Type)) WARNING(use_of_void_pointer,none, "Unsafe%0Pointer has been replaced by Unsafe%0RawPointer", (StringRef)) // Ambiguities ERROR(ambiguous_decl_ref,none, "ambiguous use of %0", (DeclNameRef)) ERROR(ambiguous_operator_ref,none, "ambiguous use of operator %0", (DeclNameRef)) NOTE(ambiguous_because_of_trailing_closure,none, "%select{use an explicit argument label instead of a trailing closure|" "avoid using a trailing closure}0 to call %1", (bool, const ValueDecl *)) // In-package resilience bypassing WARNING(cannot_bypass_resilience_due_to_missing_member_warn,none, "cannot bypass resilience due to member deserialization failure while attempting to access %select{member %0|missing member}1 of %2 in module %3 from module %4", (Identifier, bool, Identifier, Identifier, Identifier)) ERROR(cannot_bypass_resilience_due_to_missing_member,none, "cannot bypass resilience due to member deserialization failure while attempting to access %select{member %0|missing member}1 of %2 in module %3 from module %4", (Identifier, bool, Identifier, Identifier, Identifier)) // Cannot capture inout-ness of a parameter // Partial application of foreign functions not supported ERROR(partial_application_of_function_invalid,none, "cannot reference %select{" "'mutating' method|" "'super.init' initializer chain|" "'self.init' initializer delegation|" "'super' instance method with metatype base" "}0 as function value", (unsigned)) WARNING(partial_application_of_function_invalid_swift4,none, "cannot reference %select{" "'mutating' method|" "'super.init' initializer chain|" "'self.init' initializer delegation|" "'super' instance method with metatype base" "}0 as function value; calling the function has undefined behavior and will " "be an error in future Swift versions", (unsigned)) // Cannot capture `async let` ERROR(capture_async_let_not_supported,none, "capturing 'async let' variables is not supported", ()) ERROR(self_assignment_var,none, "assigning a variable to itself", ()) ERROR(self_assignment_prop,none, "assigning a property to itself", ()) ERROR(property_use_in_closure_without_explicit_self,none, "reference to property %0 in closure requires explicit use of 'self' to" " make capture semantics explicit", (Identifier)) ERROR(method_call_in_closure_without_explicit_self,none, "call to method %0 in closure requires explicit use of 'self' to make" " capture semantics explicit", (Identifier)) NOTE(note_capture_self_explicitly,none, "capture 'self' explicitly to enable implicit 'self' in this closure", ()) NOTE(note_reference_self_explicitly,none, "reference 'self.' explicitly", ()) NOTE(note_other_self_capture,none, "variable other than 'self' captured here under the name 'self' does not " "enable implicit 'self'", ()) ERROR(implicit_use_of_self_in_closure,none, "implicit use of 'self' in closure; use 'self.' to make" " capture semantics explicit", ()) WARNING(recursive_accessor_reference,none, "attempting to %select{access|modify}1 %0 within its own " "%select{getter|setter}1", (Identifier, bool)) NOTE(recursive_accessor_reference_silence,none, "access 'self' explicitly to silence this warning", ()) WARNING(store_in_willset,none, "attempting to store to property %0 within its own willSet, which is " "about to be overwritten by the new value", (Identifier)) ERROR(value_of_module_type,none, "expected module member name after module name", ()) ERROR(value_of_metatype_type,none, "expected member name or initializer call after type name%select{|; this " "will be an error in Swift 6}0", (bool)) NOTE(add_parens_to_type,none, "add arguments after the type to construct a value of the type", ()) NOTE(add_self_to_type,none, "use '.self' to reference the type object", ()) WARNING(warn_unqualified_access,none, "use of %base0 treated as a reference to %kindonly0 in %kind1", (const ValueDecl *, const ValueDecl *)) WARNING(self_refers_to_method,none, "'self' refers to the method '%0.self', which may be unexpected", (StringRef)) NOTE(fix_unqualified_access_member,none, "use 'self.' to silence this warning", ()) NOTE(fix_unqualified_access_member_named_self,none, "use '%0.self' to silence this warning", (StringRef)) NOTE(fix_unqualified_access_top_level,none, "use '%0' to reference the %kindonly1", (StringRef, const ValueDecl *, const ModuleDecl *)) NOTE(fix_unqualified_access_top_level_multi,none, "use '%0' to reference the %kindonly1 in module %2", (StringRef, const ValueDecl *, const ModuleDecl *)) WARNING(warn_deprecated_conditional_conformance_outer_access,Deprecation, "use of %0 as reference to %kindonly1 in %kind2 will change in future " "versions of Swift to reference %kindonly3 in %kind4 which comes via " "a conditional conformance", (DeclNameRef, /*current*/const ValueDecl *, const ValueDecl *, /*future*/const ValueDecl *, const ValueDecl *)) NOTE(fix_deprecated_conditional_conformance_outer_access,none, "use '%0' to continue to reference the %kindonly1", (StringRef, const ValueDecl *)) ERROR(unsupported_special_decl_ref, none, "referencing %0 as a function value is not implemented", (Identifier)) WARNING(bitcasting_away_noescape, none, "'unsafeBitCast' from non-escaping function type %0 to escaping " "function type %1 is undefined; use " "'withoutActuallyEscaping' to temporarily escape a function", (Type, Type)) WARNING(bitcasting_to_change_function_rep, none, "'unsafeBitCast' from function type %0 to %1 changes '@convention' and " "is undefined; use an implicit conversion to change conventions", (Type, Type)) WARNING(bitcasting_to_downcast, none, "'unsafeBitCast' from %0 to %1 can be replaced with 'unsafeDowncast'", (Type, Type)) WARNING(bitcasting_is_no_op, none, "'unsafeBitCast' from %0 to %1 is unnecessary and can be removed", (Type, Type)) WARNING(bitcasting_to_change_pointer_kind, none, "'unsafeBitCast' from %0 to %1 can be replaced with %2 initializer", (Type, Type, Identifier)) WARNING(bitcasting_to_change_pointee_type, none, "'unsafeBitCast' from %0 to %1 changes pointee type and may lead to " "undefined behavior; use the 'withMemoryRebound' method on %0 to " "rebind the type of memory", (Type, Type)) WARNING(bitcasting_to_give_type_to_raw_pointer, none, "'unsafeBitCast' from %0 to %1 gives a type to a raw pointer and may " "lead to undefined behavior", (Type, Type)) NOTE(bitcast_assume_memory_rebound, none, "use the 'assumingMemoryBound' method if the pointer is known to point to " "an existing value or array of type %0 in memory", (Type)) NOTE(bitcast_bind_memory, none, "use the 'bindMemory' method to assign type %0 to uninitialized raw " "memory", (Type)) WARNING(bitcasting_for_number_bit_pattern_init, none, "'unsafeBitCast' from %0 to %1 can be replaced with 'bitPattern:' " "initializer on %1", (Type, Type)) WARNING(bitcasting_for_number_bit_pattern_property, none, "'unsafeBitCast' from %0 to %1 can be replaced with 'bitPattern' " "property on %0", (Type, Type)) WARNING(bitcasting_to_change_from_unsized_to_sized_int, none, "'unsafeBitCast' from %0 to %1 can be replaced with %1 " "initializer", (Type, Type)) WARNING(use_of_qq_on_non_optional_value,none, "left side of nil coalescing operator '?""?' has non-optional type %0, " "so the right side is never used", (Type)) WARNING(nonoptional_compare_to_nil,none, "comparing non-optional value of type %0 to '%select{Optional.none|nil}1' always returns" " %select{false|true}2", (Type, bool, bool)) WARNING(optional_check_nonoptional,none, "non-optional expression of type %0 used in a check for optionals", (Type)) WARNING(optional_check_promotion,none, "explicitly specified type %0 adds an additional level of optional to" " the initializer, making the optional check always succeed", (Type)) WARNING(optional_pattern_match_promotion,none, "pattern match introduces an implicit promotion from %0 to %1", (Type, Type)) WARNING(optional_to_any_coercion,none, "expression implicitly coerced from %0 to %1", (Type, Type)) WARNING(iuo_to_any_coercion,none, "coercion of implicitly unwrappable value of type %0 to %1 does not " "unwrap optional", (Type, Type)) NOTE(iuo_to_any_coercion_note,none, "implicitly unwrapped %kind0 declared here", (const ValueDecl *)) NOTE(iuo_to_any_coercion_note_func_result,none, "%kind0 with implicitly unwrapped result type is declared here", (const ValueDecl *)) NOTE(default_optional_to_any,none, "provide a default value to avoid this warning", ()) NOTE(default_optional_parameter,none, "use a default value parameter to avoid this warning", ()) NOTE(force_optional_to_any,none, "force-unwrap the value to avoid this warning", ()) NOTE(silence_optional_to_any,none, "explicitly cast to %0 with '%1' to silence this warning", (Type, StringRef)) WARNING(debug_description_in_string_interpolation_segment,none, "string interpolation produces a debug description for %select{an optional|a function}0 " "value; did you mean to make this explicit?", (bool)) NOTE(silence_debug_description_in_interpolation_segment_call,none, "use 'String(describing:)' to silence this warning", ()) NOTE(noescape_parameter,none, "parameter %1 is implicitly %select{non-escaping|non-Sendable}0", (unsigned, Identifier)) NOTE(generic_parameters_always_escaping,none, "generic parameters are always considered '@escaping'", ()) ERROR(passing_noattrfunc_to_attrfunc,none, "passing %select{non-escaping|non-Sendable}0 parameter %1 to function " "expecting %select{an '@escaping'|a '@Sendable'}0 closure", (unsigned, Identifier)) ERROR(converting_noescape_param_to_generic_type,none, "converting non-escaping parameter %0 to generic parameter %1 may allow it to escape", (Identifier, Type)) ERROR(assigning_noattrfunc_to_attrfunc,none, "assigning %select{non-escaping|non-Sendable}0 parameter %1 to " "%select{an '@escaping'|a '@Sendable'}0 closure", (unsigned, Identifier)) ERROR(general_noattrfunc_to_attr,none, "using %select{non-escaping|non-Sendable}0 parameter %1 in a context " "expecting %select{an '@escaping'|a '@Sendable'}0 closure", (unsigned, Identifier)) ERROR(converting_noattrfunc_to_type,none, "converting %select{non-escaping|non-Sendable function}0 value to %1 " "may %select{allow it to escape|introduce data races}0", (unsigned, Type)) NOTE(escape_expected_at_parameter_position,none, "parameter #%0 expects escaping value of type %1", (unsigned, Type)) NOTE(add_explicit_escaping,none, "add explicit '@escaping' to function parameter #%0", (unsigned)) ERROR(converting_func_loses_global_actor,none, "converting function value of type %0 to %1 loses global actor %2", (Type, Type, Type)) ERROR(capture_across_type_decl,none, "%kindonly0 declaration cannot close over value %base1 defined in outer " "scope", (const NominalTypeDecl *, const ValueDecl *)) ERROR(isolated_any_conversion_to_synchronous_func,none, "converting @isolated(any) function of type %0 to synchronous function type %1 is not allowed", (Type, Type)) ERROR(reference_to_invalid_decl,none, "cannot reference invalid declaration %0", (const ValueDecl *)) //------------------------------------------------------------------------------ // MARK: Type Check Statements //------------------------------------------------------------------------------ ERROR(jump_out_of_defer,none, "'%0' cannot transfer control out of a defer statement", (StringRef)) WARNING(defer_stmt_at_block_end,none, "'defer' statement at end of scope always executes immediately; " "replace with 'do' statement to silence this warning", ()) ERROR(return_invalid_outside_func,none, "return invalid outside of a func", ()) ERROR(return_expr_missing,none, "non-void function should return a value", ()) ERROR(return_non_failable_init,none, "only a failable initializer can return 'nil'", ()) NOTE(make_init_failable,none, "use 'init?' to make the initializer %0 failable", (const ConstructorDecl *)) ERROR(return_init_non_nil,none, "'nil' is the only return value permitted in an initializer", ()) ERROR(implicit_throws_super_init,none, "missing call to superclass's initializer; " "'super.init' is a throwing initializer and requires either an explicit " "call or that this initializer is also marked as 'throws'", ()) ERROR(implicit_async_super_init,none, "missing call to superclass's initializer; " "'super.init' is 'async' and requires an explicit call", ()) WARNING(if_always_true,none, "'if' condition is always true", ()) WARNING(while_always_true,none, "'while' condition is always true", ()) WARNING(guard_always_succeeds,none, "'guard' condition is always true, body is unreachable", ()) ERROR(expression_unused_closure,NoUsage, "closure expression is unused", ()) ERROR(expression_unused_function,NoUsage, "function is unused", ()) WARNING(expression_unused_lvalue,NoUsage, "%select{" "variable|" "property is accessed but result|" "subscript is accessed but result" "}0 is unused", (unsigned)) WARNING(expression_unused_result_call,NoUsage, "result of call to %0 is unused", (const ValueDecl *)) WARNING(expression_unused_result_operator,NoUsage, "result of operator %0 is unused", (const ValueDecl *)) WARNING(expression_unused_result_operator_name,NoUsage, "result of operator %0 is unused", (DeclName)) WARNING(expression_unused_result_unknown, NoUsage, "result of call to %select{function|closure}0 returning %1 is unused", (bool, Type)) WARNING(expression_unused_result, NoUsage, "expression of type %0 is unused", (Type)) WARNING(expression_unused_init_result,NoUsage, "result of %0 initializer is unused", (Type)) WARNING(expression_unused_optional_try,NoUsage, "result of 'try?' is unused", ()) WARNING(expression_unused_selector_result, NoUsage, "result of '#selector' is unused", ()) WARNING(expression_unused_literal,NoUsage, "%0 literal is unused", (StringRef)) ERROR(assignment_lhs_not_lvalue,none, "cannot assign to immutable expression of type %0", (Type)) ERROR(assignment_lhs_is_apply_expression,none, "expression is not assignable: %0", (StringRef)) ERROR(assignment_lhs_is_immutable_variable,none, "cannot assign to value: %0", (StringRef)) ERROR(assignment_lhs_is_immutable_property,none, "cannot assign to property: %0", (StringRef)) ERROR(assignment_subscript_has_immutable_base,none, "cannot assign through subscript: %0", (StringRef)) ERROR(assignment_dynamic_property_has_immutable_base,none, "cannot assign through dynamic lookup property: %0", (StringRef)) ERROR(assignment_bang_has_immutable_subcomponent,none, "cannot assign through '!': %0", (StringRef)) NOTE(candidate_is_not_assignable,none, "candidate is not assignable: %kind0", (const ValueDecl *)) NOTE(candidate_expects_inout_argument,none, "candidate expects in-out value for parameter #%0 but argument is immutable", (unsigned)) NOTE(change_to_mutating,none, "mark %select{method|%1}0 'mutating' to make 'self' mutable", (bool, StringRef)) NOTE(masked_mutable_property,none, "add explicit '%0' to refer to mutable %kindonly1 of %2", (StringRef, const VarDecl *, Type)) ERROR(assignment_let_property_delegating_init,none, "'let' property %0 may not be initialized directly; use " "\"self.init(...)\" or \"self = ...\" instead", (DeclNameRef)) ERROR(label_shadowed, none, "label %0 cannot be reused on an inner statement", (Identifier)) ERROR(break_outside_loop,none, "'break' is only allowed inside a loop, if, do, or switch", ()) ERROR(unlabeled_break_outside_loop,none, "unlabeled 'break' is only allowed inside a loop or switch, a" " labeled break is required to exit an if or do", ()) ERROR(continue_outside_loop,none, "'continue' is only allowed inside a loop", ()) ERROR(continue_not_in_this_stmt,none, "'continue' cannot be used with %0 statements", (StringRef)) ERROR(unresolved_label,none, "cannot find label %0 in scope", (Identifier)) ERROR(unresolved_label_corrected,none, "cannot find label %0 in scope; did you mean %1?", (Identifier, Identifier)) ERROR(foreach_sequence_does_not_conform_to_expected_protocol,none, "for-in loop requires %0 to conform to %1" "%select{|; did you mean to unwrap optional?}2", (Type, Type, bool)) // Switch Stmt ERROR(fallthrough_outside_switch,none, "'fallthrough' is only allowed inside a switch", ()) ERROR(fallthrough_from_last_case,none, "'fallthrough' without a following 'case' or 'default' block", ()) ERROR(fallthrough_into_case_with_var_binding,none, "'fallthrough' from a case which doesn't bind variable %0", (Identifier)) ERROR(unnecessary_cast_over_optionset,none, "unnecessary cast over raw value of %0", (Type)) ERROR(mutability_mismatch_multiple_pattern_list,none, "'%select{var|let}0' pattern binding must match previous " "'%select{var|let}1' pattern binding", (bool, bool)) ERROR(type_mismatch_multiple_pattern_list,none, "pattern variable bound to type %0, expected type %1", (Type, Type)) ERROR(type_mismatch_fallthrough_pattern_list,none, "pattern variable bound to type %0, fallthrough case bound to type %1", (Type, Type)) ERROR(unknown_case_must_be_catchall,none, "'@unknown' is only supported for catch-all cases (\"case _\")", ()) ERROR(unknown_case_where_clause,none, "'where' cannot be used with '@unknown'", ()) ERROR(unknown_case_multiple_patterns,none, "'@unknown' cannot be applied to multiple patterns", ()) ERROR(unknown_case_must_be_last,none, "'@unknown' can only be applied to the last case in a switch", ()) WARNING(where_on_one_item, none, "'where' only applies to the second pattern match in this " "'%select{case|catch}0'", (bool)) NOTE(add_where_newline, none, "disambiguate by adding a line break between them if this is desired", ()) NOTE(duplicate_where, none, "duplicate the 'where' on both patterns to check both patterns",()) WARNING(trailing_closure_requires_parens,none, "trailing closure in this context is confusable with the body of the" " statement; pass as a parenthesized argument to silence this warning", ()) GROUPED_ERROR(opaque_type_no_underlying_type_candidates,OpaqueTypeInference,none, "function declares an opaque return type, but has no return statements " "in its body from which to infer an underlying type", ()) NOTE(opaque_type_missing_return_last_expr_note,none, "did you mean to return the last expression?", ()) GROUPED_ERROR(opaque_type_mismatched_underlying_type_candidates, OpaqueTypeInference,none, "function declares an opaque return type %0, but the return statements " "in its body do not have matching underlying types", (TypeRepr *)) GROUPED_ERROR(opaque_type_mismatched_underlying_type_candidates_named, OpaqueTypeInference,none, "function declares an opaque return type %0, but the return statements " "in its body do not have matching underlying types", (Identifier)) NOTE(opaque_type_underlying_type_candidate_here,none, "return statement has underlying type %0", (Type)) GROUPED_ERROR(opaque_type_self_referential_underlying_type, OpaqueTypeInference,none, "function opaque return type was inferred as %0, which defines the " "opaque type in terms of itself", (Type)) GROUPED_ERROR(opaque_type_cannot_contain_dynamic_self,OpaqueTypeInference,none, "function with opaque return type cannot return " "the covariant 'Self' type of a class", ()) GROUPED_ERROR(opaque_type_var_no_init,OpaqueTypeInference,none, "property declares an opaque return type, but has no initializer " "expression from which to infer an underlying type", ()) GROUPED_ERROR(opaque_type_var_no_underlying_type,OpaqueTypeInference,none, "property declares an opaque return type, but cannot infer the " "underlying type from its initializer expression", ()) GROUPED_ERROR(opaque_type_unsupported_availability,OpaqueTypeInference,none, "opaque return type cannot depend on %0 availability", (AvailabilityDomain)) //------------------------------------------------------------------------------ // MARK: Discard Statement //------------------------------------------------------------------------------ ERROR(discard_wrong_context_decl,none, "'discard' statement cannot appear in %kindonly0", (const Decl *)) ERROR(discard_no_deinit,none, "'discard' has no effect for type %0 unless it has a deinitializer", (Type)) ERROR(discard_wrong_context_closure,none, "'discard' statement cannot appear in closure", ()) ERROR(discard_wrong_context_misc,none, "'discard' statement cannot appear in this context", ()) ERROR(discard_wrong_context_copyable,none, "'discard' statement can only appear in noncopyable type's member", ()) ERROR(discard_wrong_context_nonconsuming,none, "'discard' statement can only appear in consuming %kindonly0", (const FuncDecl *)) ERROR(discard_wrong_not_self,none, "you can only discard 'self'", ()) ERROR(discard_wrong_module,none, "can only 'discard' from the same module defining type %0", (Type)) //------------------------------------------------------------------------------ // MARK: Type Check Patterns //------------------------------------------------------------------------------ ERROR(cannot_infer_type_for_pattern,none, "type annotation missing in pattern", ()) ERROR(refutable_pattern_requires_initializer,none, "pattern matching requires an initializer value to match against", ()) WARNING(var_pattern_didnt_bind_variables,none, "'%0' pattern has no effect; sub-pattern didn't bind any variables", (StringRef)) ERROR(iflet_pattern_matching,none, "pattern matching in a condition requires the 'case' keyword", ()) ERROR(iflet_implicitly_unwraps,none, "pattern matching in a condition implicitly unwraps optionals", ()) ERROR(type_pattern_missing_is,none, "'is' keyword required to pattern match against type name", ()) ERROR(pattern_type_mismatch_context,none, "type annotation does not match contextual type %0", (Type)) ERROR(tuple_pattern_in_non_tuple_context,none, "tuple pattern cannot match values of the non-tuple type %0", (Type)) WARNING(found_one_pattern_for_several_associated_values,Deprecation, "enum case '%0' has %1 associated values; matching them as a tuple " "is deprecated", (StringRef, unsigned)) WARNING(converting_tuple_into_several_associated_values,none, "enum case '%0' has %1 associated values", (StringRef, unsigned)) WARNING(converting_several_associated_values_into_tuple,none, "enum case '%0' has one associated value that is a tuple of %1 " "elements",(StringRef, unsigned)) ERROR(closure_argument_list_tuple,none, "contextual closure type %0 expects %1 argument%s1, " "but %2 %select{were|was}3 used in closure body", (Type, unsigned, unsigned, bool)) ERROR(closure_argument_list_missing,none, "contextual type for closure argument list expects %0 argument%s0, " "which cannot be implicitly ignored", (unsigned)) ERROR(closure_tuple_parameter_destructuring,none, "closure tuple parameter %0 does not support destructuring", (Type)) ERROR(closure_tuple_parameter_destructuring_implicit,none, "closure tuple parameter %0 does not support destructuring " "with implicit parameters", (Type)) ERROR(single_tuple_parameter_mismatch_special,none, "%kindonly0 expects a single parameter of type %1%2", (const ValueDecl *, Type, StringRef)) ERROR(single_tuple_parameter_mismatch_normal,none, "%kindbase0 expects a single parameter of type %1%2", (const ValueDecl *, Type, StringRef)) ERROR(cannot_convert_single_tuple_into_multiple_arguments,none, "%kindonly0 %select{%base0 |}1expects %2 separate arguments" "%select{|; remove extra parentheses to change tuple into separate arguments}3", (const ValueDecl *, bool, unsigned, bool)) ERROR(enum_element_pattern_assoc_values_mismatch,none, "pattern with associated values does not match enum case %0", (DeclNameRef)) NOTE(enum_element_pattern_assoc_values_remove,none, "remove associated values to make the pattern match", ()) ERROR(tuple_pattern_length_mismatch,none, "tuple pattern has the wrong length for tuple type %0", (Type)) ERROR(tuple_pattern_label_mismatch,none, "tuple pattern element label %0 must be %1", (Identifier, Identifier)) ERROR(enum_element_pattern_member_not_found,none, "enum case %0 not found in type %1", (DeclNameRef, Type)) ERROR(optional_element_pattern_not_valid_type,none, "'?' pattern cannot match values of type %0", (Type)) ERROR(condition_optional_element_pattern_not_valid_type,none, "initializer for conditional binding must have Optional type, not %0", (Type)) ERROR(ambiguous_enum_pattern_type,none, "generic enum type %0 is ambiguous without explicit generic parameters " "when matching value of type %1", (Type, Type)) WARNING(type_inferred_to_undesirable_type,none, "%select{variable|constant}2 %0 inferred to have type %1, " "which may be unexpected", (Identifier, Type, bool)) WARNING(type_inferred_to_uninhabited_type,none, "%select{variable|constant}2 %0 inferred to have type %1, " "which is an enum with no cases", (Identifier, Type, bool)) WARNING(type_inferred_to_uninhabited_tuple_type,none, "%select{variable|constant}2 %0 inferred to have type %1, " "which contains an enum with no cases", (Identifier, Type, bool)) NOTE(add_explicit_type_annotation_to_silence,none, "add an explicit type annotation to silence this warning", ()) WARNING(unowned_assignment_immediate_deallocation,none, "instance will be immediately deallocated because " "%select{variable|property}2 %0 is %1", (Identifier, ReferenceOwnership, /*Is Property*/unsigned)) NOTE(unowned_assignment_requires_strong,none, "a strong reference is required to prevent the instance from being " "deallocated", ()) //------------------------------------------------------------------------------ // MARK: Error-handling diagnostics //------------------------------------------------------------------------------ ERROR(try_unhandled,none, "errors thrown from here are not handled", ()) ERROR(throwing_call_unhandled,none, "%0 can throw, but the error is not handled", (StringRef)) ERROR(tryless_throwing_call_unhandled,none, "%0 can throw, but it is not marked with 'try' and " "the error is not handled", (StringRef)) ERROR(throw_in_nonthrowing_function,none, "error is not handled because the enclosing function " "is not declared 'throws'", ()) ERROR(throwing_call_in_rethrows_function,none, "%0 can throw, but the error is not handled; a function declared " "'rethrows' may only throw if its parameter does", (StringRef)) ERROR(tryless_throwing_call_in_rethrows_function,none, "%0 can throw, but it is not marked with 'try' and " "the error is not handled; a function declared " "'rethrows' may only throw if its parameter does", (StringRef)) ERROR(throw_in_rethrows_function,none, "a function declared 'rethrows' may only throw if its parameter does", ()) NOTE(because_rethrows_argument_throws,none, "call is to 'rethrows' function, but argument function can throw", ()) NOTE(because_rethrows_default_argument_throws,none, "call is to 'rethrows' function, but a defaulted argument function" " can throw", ()) NOTE(because_rethrows_conformance_throws,none, "call is to 'rethrows' function, but a conformance has a throwing witness", ()) ERROR(throwing_call_in_nonthrowing_autoclosure,none, "%0 can throw, but it is executed in a non-throwing " "autoclosure",(StringRef)) ERROR(tryless_throwing_call_in_nonthrowing_autoclosure,none, "%0 can throw, but it is not marked with 'try' and " "it is executed in a non-throwing autoclosure",(StringRef)) ERROR(throw_in_nonthrowing_autoclosure,none, "error is not handled because it is thrown in a non-throwing " "autoclosure", ()) ERROR(try_unhandled_in_nonexhaustive_catch,none, "errors thrown from here are not handled because the " "enclosing catch is not exhaustive", ()) ERROR(throwing_call_in_nonexhaustive_catch,none, "%0 can throw, but the enclosing catch is not exhaustive", (StringRef)) ERROR(tryless_throwing_call_in_nonexhaustive_catch,none, "%0 can throw, but it is not marked with 'try' and " "the enclosing catch is not exhaustive", (StringRef)) ERROR(throw_in_nonexhaustive_catch,none, "error is not handled because the enclosing catch is not exhaustive", ()) #define EFFECTS_CONTEXT_KIND \ "%select{<>|" \ "a default argument|" \ "a property wrapper initializer|" \ "a property initializer|" \ "a global variable initializer|" \ "a lazy variable initializer|" \ "an enum case raw value|" \ "a catch pattern|" \ "a catch guard expression|" \ "a defer body}" \ ERROR(throwing_op_in_illegal_context,none, "%1 can throw, but errors cannot be thrown out of " EFFECTS_CONTEXT_KIND "0", (unsigned, StringRef)) ERROR(throw_in_illegal_context,none, "errors cannot be thrown out of " EFFECTS_CONTEXT_KIND "0", (unsigned)) ERROR(throwing_operator_without_try,none, "operator can throw but expression is not marked with 'try'", ()) ERROR(throwing_interpolation_without_try,none, "interpolation can throw but is not marked with 'try'", ()) ERROR(throwing_call_without_try,none, "call can throw but is not marked with 'try'", ()) ERROR(throwing_async_let_without_try,none, "reading 'async let' can throw but is not marked with 'try'", ()) ERROR(throwing_prop_access_without_try,none, "property access can throw but is not marked with 'try'", ()) ERROR(throwing_subscript_access_without_try,none, "subscript access can throw but is not marked with 'try'", ()) NOTE(note_forgot_try,none, "did you mean to use 'try'?", ()) NOTE(note_error_to_optional,none, "did you mean to handle error as optional value?", ()) NOTE(note_disable_error_propagation,none, "did you mean to disable error propagation?", ()) WARNING(no_throw_in_try,none, "no calls to throwing functions occur within 'try' expression", ()) WARNING(no_throw_in_do_with_catch,none, "'catch' block is unreachable because no errors are thrown in 'do' block", ()) ERROR(thrown_type_not_error,none, "thrown type %0 does not conform to the 'Error' protocol", (Type)) //------------------------------------------------------------------------------ // MARK: Concurrency //------------------------------------------------------------------------------ ERROR(async_expr_without_await,none, "expression is 'async' but is not marked with 'await'", ()) NOTE(async_access_without_await,none, "%select{call|property access|subscript access|}0 is 'async'", (unsigned)) NOTE(async_call_without_await_in_autoclosure,none, "call is 'async' in an autoclosure argument", ()) NOTE(async_call_without_await_in_async_let,none, "call is 'async' in an 'async let' initializer", ()) WARNING(no_async_in_await,none, "no 'async' operations occur within 'await' expression", ()) ERROR(async_in_nonasync_function,none, "%select{'async'|'async' call|'await'|'async let'|'async' property access|'async' subscript access}0 in " "%select{a function|an autoclosure}1 that does not support concurrency", (unsigned, bool)) NOTE(note_add_async_to_function,none, "add 'async' to function %0 to make it asynchronous", (const ValueDecl *)) NOTE(note_non_distributed,none, "non-distributed %kind0", (const ValueDecl *)) ERROR(invalid_isolated_calls_in_body,none, "calls to '@%0'-isolated' code in %kind1", (StringRef, const ValueDecl *)) NOTE(add_globalactor_to_decl,none, "add '@%0' to make %kind1 part of global actor %2", (StringRef, const ValueDecl *, Type)) FIXIT(insert_globalactor_attr, "@%0 ", (Type)) ERROR(main_function_must_be_mainActor,none, "main() must be '@MainActor'", ()) // Keep aligned with enum ForeignLanguage #define FOREIGN_LANG_SELECT "select{C|Objective-C}" ERROR(not_objc_function_async,none, "'async' %kindonly0 cannot be represented in Objective-C", (const AbstractFunctionDecl *)) NOTE(not_objc_function_type_async,none, "'async' function types cannot be represented " "in %" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) ERROR(actor_isolated_objc,none, "actor-isolated %kind0 cannot be '@objc'", (const ValueDecl *)) NOTE(protocol_witness_async_conflict,none, "candidate is %select{not |}0'async', but%select{| '@objc'}1 protocol " "requirement is%select{| not}0", (bool, bool)) ERROR(async_autoclosure_nonasync_function,none, "'async' autoclosure parameter in a non-'async' function", ()) ERROR(async_not_let,none, "'async' can only be used with 'let' declarations", ()) ERROR(async_let_not_local,none, "'async let' can only be used on local declarations", ()) ERROR(async_let_not_initialized,none, "'async let' binding requires an initializer expression", ()) ERROR(async_let_no_variables,none, "'async let' requires at least one named variable", ()) NOTE(async_let_without_await,none, "reference to async let %0 is 'async'", (const ValueDecl *)) ERROR(async_call_in_illegal_context,none, "'async' call cannot occur in " EFFECTS_CONTEXT_KIND "0", (unsigned)) ERROR(await_in_illegal_context,none, "'await' operation cannot occur in " EFFECTS_CONTEXT_KIND "0", (unsigned)) ERROR(async_let_in_illegal_context,none, "async let %0 cannot be referenced in " EFFECTS_CONTEXT_KIND "1", (const ValueDecl *, unsigned)) ERROR(async_let_binding_illegal_context,none, "'async let' cannot be used on declarations in " EFFECTS_CONTEXT_KIND "0", (unsigned)) #undef EFFECTS_CONTEXT_KIND ERROR(objc_ambiguous_async_convention,none, "%0 overrides or implements protocol requirements for Objective-C " "declarations with incompatible async conventions", (const ValueDecl *)) NOTE(objc_ambiguous_async_convention_candidate,none, "%0 provides async here", (const ValueDecl *)) ERROR(async_objc_dynamic_self,none, "asynchronous method returning 'Self' cannot be '@objc'", ()) ERROR(actor_inheritance,none, "%select{actor|distributed actor}0 types do not support inheritance", (bool)) ERROR(actor_protocol_illegal_inheritance,none, "non-actor type %0 cannot conform to the %1 protocol", (DeclName, DeclName)) ERROR(distributed_actor_conformance_missing_system_type,none, "distributed actor %0 does not declare ActorSystem it can be used with", (DeclName)) NOTE(note_distributed_actor_system_can_be_defined_using_defaultdistributedactorsystem,none, "you can provide a module-wide default actor system by declaring:\n" "typealias DefaultDistributedActorSystem = <#ConcreteActorSystem#>\n", ()) ERROR(distributed_actor_protocol_illegal_inheritance,none, "non-distributed actor type %0 cannot conform to the 'DistributedActor' protocol", (DeclName)) ERROR(actor_cannot_inherit_distributed_actor_protocol,none, "actor type %0 cannot conform to the 'DistributedActor' protocol. " "Isolation rules of these actor types are not interchangeable.", (DeclName)) ERROR(broken_distributed_actor_requirement,none, "DistributedActor protocol is broken: unexpected requirement", ()) ERROR(distributed_actor_system_conformance_missing_adhoc_requirement,none, "%kind0 is missing witness for protocol requirement %1", (const ValueDecl *, DeclName)) ERROR(override_implicit_unowned_executor,none, "cannot override an actor's 'unownedExecutor' property that wasn't " "explicitly defined", ()) ERROR(actor_isolated_non_self_reference,none, "%4 %kind0 can not be " "%select{referenced|mutated|used 'inout'}1 " "%select{from outside the actor|on a different actor instance|" "on a nonisolated actor instance|" "from a Sendable function|from a Sendable closure|" "from an 'async let' initializer|from global actor %3|" "from the main actor|from a nonisolated context|" "from a nonisolated autoclosure}2", (const ValueDecl *, unsigned, unsigned, Type, ActorIsolation)) ERROR(actor_isolated_access_outside_of_actor_context,none, "%0 %kind1 cannot be %select{accessed|called}2 from outside of the actor", (ActorIsolation, const ValueDecl *, bool)) ERROR(distributed_actor_isolated_non_self_reference,none, "distributed actor-isolated %kind0 can not be accessed from a " "nonisolated context", (const ValueDecl *)) NOTE(note_consider_method_for_isolated_property_mutation,none, "consider declaring an isolated method on %0 to perform the mutation", (const NominalTypeDecl *)) ERROR(conflicting_stored_property_isolation,none, "%select{default|memberwise}0 initializer for %1 cannot be both %2 and %3", (bool, Type, ActorIsolation, ActorIsolation)) NOTE(property_requires_actor,none, "initializer for %kind0 is %1", (const VarDecl *, ActorIsolation)) ERROR(isolated_default_argument_context,none, "%0 default value in a %1 context", (ActorIsolation, ActorIsolation)) ERROR(conflicting_default_argument_isolation,none, "default argument cannot be both %0 and %1", (ActorIsolation, ActorIsolation)) ERROR(distributed_decl_needs_explicit_distributed_import,none, "%kind0 declared without importing module 'Distributed'", (const ValueDecl *)) NOTE(distributed_func_cannot_overload_on_async_only,none, "%0 previously declared here, cannot overload distributed methods on effect only", (const ValueDecl *)) ERROR(actor_isolated_inout_state,none, "actor-isolated %kind0 cannot be passed 'inout' to" "%select{| implicitly}1 'async' function call", (const ValueDecl *, bool)) ERROR(actor_isolated_mutating_func,none, "cannot call mutating async function %0 on actor-isolated %kind1", (DeclName, const ValueDecl *)) GROUPED_ERROR(actor_isolated_call,ActorIsolatedCall,none, "call to %0 function in a synchronous %1 context", (ActorIsolation, ActorIsolation)) GROUPED_ERROR(actor_isolated_call_decl,ActorIsolatedCall,none, "call to %0 %kind1 in a synchronous %2 context", (ActorIsolation, const ValueDecl *, ActorIsolation)) ERROR(actor_isolated_partial_apply,none, "actor-isolated %kind0 can not be partially applied", (const ValueDecl *)) ERROR(concurrent_access_local,none, "use of local %kind0 in concurrently-executing code", (const ValueDecl *)) ERROR(actor_isolated_keypath_component,none, "cannot form key path to %0 %kind1", (ActorIsolation, const ValueDecl *)) ERROR(effectful_keypath_component,none, "cannot form %select{key path|dynamic key path member lookup}1 to " "%kindonly0 with 'throws' or 'async'", (const ValueDecl *, bool)) ERROR(local_function_executed_concurrently,none, "concurrently-executed %kind0 must be marked as '@Sendable'", (const ValueDecl *)) ERROR(sendable_isolated_sync_function,none, "%0 synchronous %kind1 cannot be marked as '@Sendable'", (ActorIsolation, const ValueDecl *)) ERROR(nonsendable_instance_method,none, "instance method of non-Sendable type %0 cannot be marked as '@Sendable'", (Type)) GROUPED_ERROR(concurrent_access_of_local_capture,SendableClosureCaptures,none, "%select{mutation of|reference to}0 captured %kind1 in " "concurrently-executing code", (bool, const ValueDecl *)) GROUPED_ERROR(concurrent_access_of_inout_param,SendableClosureCaptures,none, "mutable capture of 'inout' parameter %0 is not allowed in " "concurrently-executing code", (DeclName)) GROUPED_ERROR(non_sendable_capture,SendableClosureCaptures,none, "capture of %1 with non-Sendable type %0 in a '@Sendable' " "%select{local function|closure}2", (Type, DeclName, bool)) ERROR(non_sendable_isolated_capture,none, "capture of %1 with non-Sendable type %0 in an isolated " "%select{local function|closure}2", (Type, DeclName, bool)) GROUPED_ERROR(non_sendable_metatype_capture,SendableMetatypes,none, "capture of non-Sendable type %0 in an isolated " "%select{local function|closure}1", (Type, bool)) ERROR(self_capture_deinit_task,none, "capture of 'self' in a closure that outlives deinit", ()) ERROR(implicit_non_sendable_capture,none, "implicit capture of %1 requires that %0 conforms to 'Sendable'", (Type, DeclName)) NOTE(actor_isolated_sync_func,none, "calls to %kind0 from outside of its actor context are " "implicitly asynchronous", (const ValueDecl *)) NOTE(actor_isolated_sync_func_value,none, "calls function of type %0 from outside of its actor context are " "implicitly asynchronous", (Type)) NOTE(actor_isolation_source,none, "%noun0 inferred from %1", (ActorIsolation, IsolationSource)) NOTE(note_distributed_actor_isolated_method,none, "distributed actor-isolated %kind0 declared here", (const ValueDecl *)) ERROR(distributed_actor_isolated_method,none, "only 'distributed' instance methods can be called on a potentially remote distributed actor", ()) ERROR(distributed_local_cannot_be_used,none, "'local' cannot be used in user-defined code currently", ()) ERROR(distributed_actor_func_param_not_codable,none, "parameter %0 of type %1 in %kindonly2 does not conform to " "serialization requirement '%3'", (Identifier, Type, const AbstractFunctionDecl *, StringRef)) ERROR(distributed_actor_target_result_not_codable,none, "result type %0 of %kindbase1 does not conform to serialization requirement '%2'", (Type, const ValueDecl *, StringRef)) ERROR(distributed_actor_system_serialization_req_must_be_protocol,none, "'SerializationRequirement' type witness %0 must be a protocol type", (Type)) ERROR(nonisolated_distributed_actor_storage,none, "'nonisolated' can not be applied to distributed actor stored properties", ()) ERROR(distributed_actor_func_nonisolated, none, "cannot declare method %0 as both 'nonisolated' and 'distributed'", (DeclName)) ERROR(distributed_actor_func_inout, none, "cannot declare 'inout' argument %0 in %kind1", (DeclName, const ValueDecl *)) ERROR(distributed_actor_func_unsupported_specifier, none, "cannot declare '%0' argument %1 in %kind2", (StringRef, DeclName, const ValueDecl *)) ERROR(distributed_actor_func_variadic, none, "cannot declare variadic argument %0 in %kind1", (DeclName, const ValueDecl *)) ERROR(conformance_missing_distributed,none, "conformance of %0 to distributed %kind1 uses non-distributed operations", (Type, const ValueDecl *)) NOTE(note_add_distributed_multi,none, "mark all declarations used in the conformance 'distributed'", ()) NOTE(actor_mutable_state,none, "mutation of this %kindonly0 is only permitted within the actor", (const ValueDecl *)) ERROR(shared_mutable_state_access,none, "reference to %kind0 is not concurrency-safe because it involves shared " "mutable state", (const ValueDecl *)) GROUPED_ERROR(shared_mutable_state_decl,MutableGlobalVariable,none, "%kind0 is not concurrency-safe because it is nonisolated global shared " "mutable state", (const ValueDecl *)) GROUPED_ERROR(shared_immutable_state_decl,MutableGlobalVariable,none, "%kind1 is not concurrency-safe because non-'Sendable' type %0 may have " "shared mutable state", (Type, const ValueDecl *)) NOTE(shared_state_make_immutable,none, "convert %0 to a 'let' constant to make 'Sendable' shared state immutable", (const ValueDecl *)) NOTE(shared_state_nonisolated_unsafe,none, "disable concurrency-safety checks if accesses are protected by an external synchronization mechanism", (const ValueDecl *)) NOTE(note_actor_isolated_witness,none, "%0 %kind1 cannot satisfy %2 requirement", (ActorIsolation, const ValueDecl *, ActorIsolation)) ERROR(actor_cannot_conform_to_global_actor_protocol,none, "actor %0 cannot conform to global-actor-isolated protocol %1", (Type, Type)) NOTE(protocol_isolated_to_global_actor_here,none, "%0 is isolated to global actor %1 here", (Type, Type)) GROUPED_ERROR(conformance_mismatched_isolation,ConformanceIsolation,none, "conformance of %0 to %kind1 involves isolation mismatches " "and can cause data races", (Type, const ValueDecl *)) GROUPED_ERROR(conformance_mismatched_isolation_common,ConformanceIsolation,none, "conformance of %0 to %kind1 crosses into %2 code and can cause " "data races", (Type, const ValueDecl *, ActorIsolation)) NOTE(note_make_conformance_preconcurrency,none, "turn data races into runtime errors with '@preconcurrency'", ()) NOTE(note_make_witnesses_nonisolated,none, "mark all declarations used in the conformance 'nonisolated'", ()) ERROR(isolated_parameter_not_actor,none, "'isolated' parameter type %0 does not conform to 'Actor' " "or 'DistributedActor'", (Type)) ERROR(isolated_parameter_duplicate,none, "cannot have more than one 'isolated' parameter", ()) ERROR(isolated_parameter_duplicate_type,none, "function type cannot have more than one 'isolated' parameter", ()) NOTE(isolated_parameter_previous_note,none, "previous 'isolated' parameter %0", (DeclName)) ERROR(isolated_parameter_combined_global_actor_attr,none, "%kindonly0 with 'isolated' parameter cannot have a global actor", (const ValueDecl *)) ERROR(isolated_parameter_closure_combined_global_actor_attr,none, "closure with 'isolated' parameter %0 cannot have a global actor", (DeclName)) ERROR(isolated_parameter_global_actor_type,none, "function type cannot have global actor and 'isolated' parameter", ()) ERROR(isolated_parameter_combined_nonisolated,none, "%kindonly0 with 'isolated' parameter cannot be 'nonisolated'", (const ValueDecl *)) ERROR(isolated_parameter_isolated_attr_type,none, "function with 'isolated' parameter cannot also be '@isolated(%0)'", (StringRef)) ERROR(isolated_attr_global_actor_type,none, "function type cannot have both a global actor and '@isolated(%0)'", (StringRef)) ERROR(isolated_attr_bad_convention,none, "'@isolated(%0)' function type cannot have %1 convention", (StringRef, StringRef)) NOTE(in_derived_conformance, none, "in derived conformance to %0", (Type)) NOTE(in_derived_witness, none, "in %kindonly0 %1 for derived conformance to %2", (const ValueDecl *, DeclName, Type)) ERROR(non_sendable_arg_into_actor,none, "non-Sendable type %0 cannot be sent into %2 context in call to %kind1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_arg_exits_actor,none, "non-Sendable type %0 cannot exit %2 context in call to nonisolated " "%kind1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_param_in_witness,none, "non-Sendable parameter type %0 cannot be sent from caller of " "protocol requirement %1 into %2 implementation", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_param_in_override,none, "non-Sendable parameter type %0 cannot be sent from caller of " "superclass %kind1 into %2 override", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_param_in_objc,none, "non-Sendable parameter type %0 of %2 '@objc' %kind1 cannot cross actor " "boundary", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_result_into_actor,none, "non-Sendable result type %0 cannot be sent from %2 context in call " "to %kind1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_result_exits_actor,none, "non-Sendable result type %0 cannot exit %2 context in call to " "nonisolated %kind1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_result_in_witness,none, "non-Sendable type %0 cannot be returned from %2 implementation " "to caller of protocol requirement %1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_result_in_override,none, "non-Sendable type %0 cannot be returned from %2 override to " "caller of superclass %kind1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_result_in_objc,none, "non-Sendable type %0 returned by %2 '@objc' %kind1 cannot cross " "actor boundary", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_call_result_type,none, "non-Sendable result type %0 cannot be sent from %1 context in call " "to async function", (Type, ActorIsolation)) ERROR(non_sendable_property_exits_actor,none, "non-Sendable type %0 of %kind1 cannot exit %2 context", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_property_into_actor,none, "non-Sendable type %0 of nonisolated %kind1 cannot be sent to " "%2 context", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_property_in_witness,none, "non-Sendable type %0 cannot be returned from %2 implementation " "to caller of protocol requirement %1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_property_in_override,none, "non-Sendable type %0 cannot be returned from %2 override to " "caller of superclass %kind1", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_property_in_objc,none, "non-Sendable type %0 returned by %2 '@objc' %kind1 cannot cross " "actor boundary", (Type, const ValueDecl *, ActorIsolation)) ERROR(non_sendable_keypath_capture,none, "cannot form key path that captures non-Sendable type %0", (Type)) ERROR(non_concurrent_type_member,none, "%select{stored property %2|associated value %2}1 of " "'Sendable'-conforming %kind3 %select{contains|has}4 non-Sendable type %0", (Type, bool, DeclName, const ValueDecl *, bool)) ERROR(concurrent_value_class_mutable_property,none, "stored property %0 of 'Sendable'-conforming %kind1 is mutable", (DeclName, const ValueDecl *)) ERROR(concurrent_value_outside_source_file,none, "conformance to 'Sendable' must occur in the same source file as " "%kind0; use '@unchecked Sendable' for retroactive conformance", (const ValueDecl *)) ERROR(concurrent_value_nonfinal_class,none, "non-final class %0 cannot conform to the 'Sendable' protocol", (DeclName)) ERROR(concurrent_value_inherit,none, "'Sendable' class %1 cannot inherit from another class" "%select{| other than 'NSObject'}0", (bool, DeclName)) ERROR(non_sendable_type,none, "type %0 does not conform to the 'Sendable' protocol", (Type)) GROUPED_ERROR(non_sendable_metatype_type,SendableMetatypes,none, "type %0 does not conform to the 'SendableMetatype' protocol", (Type)) ERROR(sendable_raw_storage,none, "struct %0 with '@_rawLayout' does not conform to the 'Sendable' " "protocol", (DeclName)) ERROR(typeattr_not_inheritance_clause,none, "%0 only applies in inheritance clauses", (const TypeAttribute *)) ERROR(typeattr_not_extension_inheritance_clause,none, "%0 only applies in inheritance clauses in extensions", (const TypeAttribute *)) ERROR(typeattr_not_existential,none, "%0 cannot apply to non-protocol type %1", (const TypeAttribute *, Type)) WARNING(unchecked_conformance_not_special,none, "'@unchecked' conformance to %0 has no meaning", (Type)) WARNING(restate_unchecked_sendable,none, "class %0 must restate inherited '@unchecked Sendable' conformance", (DeclName)) WARNING(preconcurrency_conformance_not_used,none, "'@preconcurrency' on conformance to %0 has no effect", (Type)) ERROR(redundant_any_in_existential,none, "redundant 'any' in type %0", (Type)) ERROR(any_not_existential,none, "'any' has no effect on %select{concrete type|type parameter}0 %1", (bool, Type)) ERROR(incorrect_optional_any,none, "optional 'any' type must be written %0", (Type)) GROUPED_ERROR(existential_requires_any,ExistentialAny,none, "use of %select{protocol |}2%0 as a type must be written %1", (Type, Type, bool)) GROUPED_ERROR(inverse_requires_any,ExistentialAny,none, "constraint that suppresses conformance requires 'any'", ()) ERROR(nonisolated_mutable_storage,none, "'nonisolated' cannot be applied to mutable stored properties", ()) NOTE(nonisolated_mutable_storage_note,none, "convert %0 to a 'let' constant or consider declaring it " "'nonisolated(unsafe)' if manually managing concurrency safety", (const VarDecl *)) WARNING(nonisolated_unsafe_sendable_constant,none, "'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type " "%0, consider removing it", (Type)) WARNING(unsafe_sendable_actor_constant,none, "'(unsafe)' is unnecessary for a constant public actor property with " "'Sendable' type %0, consider removing it", (Type)) WARNING(nonisolated_unsafe_sendable_actor_constant,none, "'nonisolated(unsafe)' is unnecessary for a constant actor-isolated " "property with 'Sendable' type %0, consider removing it", (Type)) WARNING(nonisolated_unsafe_uneffective_on_funcs,none, "'nonisolated(unsafe)' has no effect on %kind0, " "consider using 'nonisolated'", (const ValueDecl *)) ERROR(nonisolated_non_sendable,none, "'nonisolated' can not be applied to variable with non-'Sendable' " "type %0", (Type)) ERROR(nonisolated_local_var,none, "'nonisolated' can not be applied to local variables", ()) ERROR(nonisolated_actor_sync_init,none, "'nonisolated' on an actor's synchronous initializer is invalid", ()) ERROR(nonisolated_wrapped_property,none, "'nonisolated' is not supported on properties with property wrappers", ()) ERROR(nonisolated_lazy,none, "'nonisolated' is not supported on lazy properties", ()) ERROR(non_sendable_from_deinit,none, "cannot access %kind1 with a non-Sendable type %0 from nonisolated " "deinit", (Type, const VarDecl *)) ERROR(actor_instance_property_wrapper,none, "%0 property in property wrapper type %1 cannot be isolated to " "the actor instance; consider 'nonisolated'", (Identifier, Identifier)) ERROR(distributed_actor_property,none, "'distributed' can not be applied to local properties", ()) ERROR(distributed_actor_not_actor,none, "'distributed' can only be applied to 'actor' definitions, " "and distributed actor-isolated async functions", ()) ERROR(distributed_actor_func_static,none, "'distributed' method cannot be 'static'", ()) ERROR(distributed_actor_func_not_in_distributed_actor,none, "'distributed' method can only be declared within 'distributed actor'", ()) ERROR(distributed_actor_user_defined_special_property,none, "property %0 cannot be defined explicitly, as it conflicts with " "distributed actor synthesized stored property", (DeclName)) ERROR(distributed_property_can_only_be_computed_get_only,none, "'distributed' computed property %0 cannot have setter", (DeclName)) ERROR(distributed_property_cannot_be_static,none, "'distributed' property %0 cannot be 'static'", (DeclName)) ERROR(distributed_property_can_only_be_computed,none, "%kind0 cannot be 'distributed', only computed properties can", (const ValueDecl *)) NOTE(distributed_actor_isolated_property,none, "access to %kind0 is only permitted within distributed actor %1", (const ValueDecl *, DeclName)) NOTE(distributed_actor_synchronous_access_distributed_computed_property,none, "access to %kind0 from outside the distributed actor %1 must be asynchronous", (const ValueDecl *, DeclName)) ERROR(concurrency_lib_missing,none, "missing '%0' declaration, probably because the '_Concurrency' " "module was not imported", (StringRef)) ERROR(async_main_no_concurrency,none, "'_Concurrency' module not imported, required for async main", ()) ERROR(multiple_global_actors,none, "declaration can not have multiple global actor attributes (%0 and %1)", (Identifier, Identifier)) ERROR(global_actor_disallowed,none, "%kindonly0 cannot have a global actor", (const Decl *)) ERROR(global_actor_on_actor_class,none, "actor %0 cannot have a global actor", (Identifier)) ERROR(global_actor_on_local_variable,none, "local variable %0 cannot have a global actor", (DeclName)) ERROR(unsafe_global_actor,none, "'(unsafe)' global actors are deprecated; " "use '@preconcurrency' instead", ()) ERROR(global_actor_arg,none, "global actor attribute %0 cannot have arguments", (Type)) ERROR(global_actor_non_final_class,none, "non-final class %0 cannot be a global actor", (DeclName)) ERROR(global_actor_top_level_var,none, "top-level code variables cannot have a global actor", ()) ERROR(global_actor_access,none, "%select{private|fileprivate|internal|package|public|open}0 %kind1 " "cannot have %select{private|fileprivate|internal|package|%error|%error}2 " "global actor %3", (AccessLevel, const ValueDecl *, AccessLevel, DeclName)) ERROR(global_actor_not_usable_from_inline,none, "global actor for %kind0 must be '@usableFromInline' or public", (const ValueDecl *)) NOTE(move_global_actor_attr_to_storage_decl,none, "move global actor attribute to %kind0", (const ValueDecl *)) ERROR(actor_isolation_multiple_attr_2,none, "%kind0 has multiple actor-isolation attributes (%1 and %2)", (const Decl *, DeclAttribute, DeclAttribute)) ERROR(actor_isolation_multiple_attr_3,none, "%0 %1 has multiple actor-isolation attributes (%2, %3, and %4)", (const Decl *, DeclAttribute, DeclAttribute, DeclAttribute)) ERROR(actor_isolation_multiple_attr_4,none, "%0 %1 has multiple actor-isolation attributes (%2, %3, %4, and %5)", (const Decl *, DeclAttribute, DeclAttribute, DeclAttribute, DeclAttribute)) ERROR(actor_isolation_override_mismatch,none, "%0 %kind1 has different actor isolation from %2 overridden declaration", (ActorIsolation, const ValueDecl *, ActorIsolation)) ERROR(actor_isolation_superclass_mismatch,none, "%0 class %1 has different actor isolation from %2 superclass %3", (ActorIsolation, const ClassDecl *, ActorIsolation, const ClassDecl *)) ERROR(async_decl_must_be_available_from_async,none, "asynchronous %kindonly0 must be available from asynchronous contexts", (const Decl *)) ERROR(async_named_decl_must_be_available_from_async,none, "asynchronous %kind0 must be available from asynchronous contexts", (const ValueDecl *)) ERROR(async_unavailable_decl,none, "%kindbase0 is unavailable from asynchronous contexts%select{|; %1}1", (const ValueDecl *, StringRef)) ERROR(isolated_deinit_no_isolation,none, "deinit is marked isolated, but containing class %0 is not isolated to an actor", (DeclName)) ERROR(isolated_deinit_on_value_type,none, "only classes and actors can have isolated deinit", ()) ERROR(isolated_deinit_unavailable,none, "isolated deinit is only available in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) //------------------------------------------------------------------------------ // MARK: String Processing //------------------------------------------------------------------------------ ERROR(string_processing_lib_missing,none, "missing '%0' declaration, probably because the '_StringProcessing' " "module was not imported properly", (StringRef)) ERROR(regex_capture_types_failed_to_decode,none, "failed to decode capture types for regular expression literal; this may " "be a compiler bug", ()) ERROR(regex_feature_unavailable, none, "%0 is only available in %1 %2 or newer", (StringRef, AvailabilityDomain, AvailabilityRange)) ERROR(must_import_regex_builder_module,none, "regex builder requires the 'RegexBuilder' module be imported'", ()) //------------------------------------------------------------------------------ // MARK: Type Check Types //------------------------------------------------------------------------------ ERROR(unsupported_recursive_struct,none, "value type %0 cannot have a stored property that recursively " "contains it", (Type)) WARNING(enum_non_well_founded,none, "enum containing only recursive cases is impossible to instantiate", ()) ERROR(recursive_enum_not_indirect,none, "recursive enum %0 is not marked 'indirect'", (Type)) ERROR(unsupported_infinitely_sized_type,none, "value type %0 has infinite size", (Type)) NOTE(note_type_cycle_starts_here,none, "cycle beginning here: %0", (StringRef)) NOTE(note_recursive_enum_case_here,none, "recursive case here", ()) ERROR(sugar_type_not_found,none, "broken standard library: cannot find " "%select{Array|Optional|InlineArray|Dictionary|" "Error}0 type", (unsigned)) ERROR(optional_intrinsics_not_found,none, "broken standard library: cannot find intrinsic operations on " "Optional", ()) ERROR(pointer_argument_intrinsics_not_found,none, "broken standard library: cannot find intrinsic operations on " "UnsafeMutablePointer", ()) ERROR(array_literal_intrinsics_not_found,none, "broken standard library: cannot find intrinsic operations on " "Array", ()) ERROR(class_super_access,none, "class %select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}1|private or fileprivate}3" "|cannot be declared %select{in this context|fileprivate|internal|package|public|open}1}0 " "because its superclass " "%select{is %select{private|fileprivate|internal|package|'@_spi'|'@_spi'}2" "|uses %select{a private|a fileprivate|an internal|a package|an '@_spi'|an '@_spi'}2 " "type as a generic parameter}4", (bool, AccessLevel, AccessLevel, bool, bool)) WARNING(class_super_access_warn,none, "class %select{should be declared " "%select{private|fileprivate|internal|package|%error|%error}1" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}1}0 " "because its superclass " "%select{is %select{private|fileprivate|internal|package|'@_spi'|'@_spi'}2" "|uses %select{a private|a fileprivate|an internal|a package|an '@_spi'|an '@_spi'}2 " "type as a generic parameter}4", (bool, AccessLevel, AccessLevel, bool, bool)) ERROR(class_super_not_usable_from_inline,none, "%select{type referenced from |}0the superclass of " "a '@usableFromInline' class " "must be '@usableFromInline' or public", (bool)) WARNING(class_super_not_usable_from_inline_warn,none, "%select{type referenced from |}0the superclass of " "a '@usableFromInline' class " "should be '@usableFromInline' or public", (bool)) ERROR(dot_protocol_on_non_existential,none, "cannot use 'Protocol' with non-protocol type %0", (Type)) ERROR(tuple_single_element,none, "cannot create a single-element tuple with an element label", ()) ERROR(tuple_pack_element_label,none, "cannot use label with pack expansion tuple element", ()) ERROR(tuple_move_only_not_supported,none, "tuple with noncopyable element type %0 is not supported", (Type)) ERROR(tuple_containing_move_only_not_supported,none, "type %0 containing noncopyable element is not supported", (Type)) ERROR(vararg_not_allowed,none, "variadic parameter cannot appear outside of a function parameter list", ()) ERROR(more_than_one_pack_in_type,none, "generic type cannot declare more than one type pack", ()) ERROR(enum_with_pack,none, "enums cannot declare a type pack", ()) ERROR(superclass_with_pack,none, "cannot inherit from a generic class that declares a type pack", ()) ERROR(expansion_not_allowed,none, "pack expansion %0 can only appear in a function parameter list, " "tuple element, or generic argument of a variadic type", (Type)) ERROR(expansion_expr_not_allowed,none, "value pack expansion can only appear inside a function argument list, " "tuple element, or as the expression of a for-in loop", ()) ERROR(invalid_expansion_argument,none, "cannot pass value pack expansion to non-pack parameter of type %0", (Type)) ERROR(expansion_not_variadic,none, "pack expansion %0 must contain at least one pack reference", (Type)) ERROR(pack_reference_outside_expansion,none, "pack reference %0 can only appear in pack expansion ", (Type)) ERROR(each_non_pack,none, "'each' cannot be applied to non-pack type %0", (Type)) ERROR(pack_reference_must_be_in_expansion,none, "pack reference %0 requires expansion using keyword 'repeat'", (TypeRepr*)) ERROR(pack_type_requires_keyword_each,none, "type pack %0 must be referenced with 'each'", (TypeRepr*)) ERROR(value_pack_requires_keyword_each,none, "value pack %0 must be referenced with 'each'", (Type)) ERROR(tuple_duplicate_label,none, "cannot create a tuple with a duplicate element label", ()) ERROR(multiple_ellipsis_in_tuple,none, "only a single element can be variadic", ()) ERROR(cannot_convert_tuple_into_pack_expansion_parameter,none, "value pack expansion at parameter #%0 expects %1 separate arguments" "%select{|; remove extra parentheses to change tuple into separate arguments}2", (unsigned, unsigned, bool)) NOTE(cannot_convert_tuple_into_pack_expansion_parameter_note,none, "value pack expansion at parameter #%0 expects %1 separate arguments", (unsigned, unsigned)) ERROR(value_expansion_not_variadic,none, "value pack expansion must contain at least one pack reference", ()) ERROR(expansion_not_same_shape,none, "pack expansion %0 requires that %1 and %2 have the same shape", (Type, Type, Type)) ERROR(expansion_expr_not_same_shape,none, "pack expansion requires that %0 and %1 have the same shape", (Type, Type)) ERROR(enum_element_ellipsis,none, "variadic enum cases are not supported", ()) ERROR(unlabeled_parameter_following_variadic_parameter,none, "a parameter following a variadic parameter requires a label", ()) ERROR(closure_unlabeled_parameter_following_variadic_parameter,none, "no parameters may follow a variadic parameter in a closure", ()) ERROR(parameter_vararg_default,none, "variadic parameter cannot have a default value", ()) ERROR(iuo_invalid_here, none, "using '!' is not allowed here", ()) ERROR(iuo_deprecated_here,Deprecation, "using '!' here is deprecated", ()) NOTE(iuo_use_optional_instead,none, "use '?' instead", ()) // Ownership ERROR(invalid_ownership_type,none, "%0 may only be applied to class and class-bound protocol types, not %1", (ReferenceOwnership, Type)) ERROR(invalid_ownership_protocol_type,none, "%0 must not be applied to non-class-bound %1; " "consider adding a protocol conformance that has a class bound", (ReferenceOwnership, Type)) ERROR(invalid_ownership_incompatible_class,none, "%0 is incompatible with %1 references", (Type, ReferenceOwnership)) ERROR(invalid_ownership_incompatible_foreign_reference_type,none, "%0 is incompatible with 'weak' references, because it is a foreign reference type", (Type)) ERROR(invalid_ownership_with_optional,none, "%0 variable cannot have optional type", (ReferenceOwnership)) ERROR(invalid_ownership_not_optional,none, "%0 variable should have optional type %1", (ReferenceOwnership, Type)) ERROR(invalid_ownership_is_let,none, "%0 must be a mutable variable, because it may change at runtime", (ReferenceOwnership)) ERROR(ownership_invalid_in_protocols,none, "%0 cannot be applied to a property declaration in a protocol", (ReferenceOwnership)) // required ERROR(required_initializer_nonclass,none, "'required' initializer in non-class type %0", (Type)) ERROR(required_initializer_in_extension,none, "'required' initializer must be declared directly in class %0" " (not in an extension)", (Type)) ERROR(required_initializer_missing,none, "'required' initializer %0 must be provided by subclass of %1", (DeclName, Type)) NOTE(required_initializer_here,none, "'required' initializer is declared in superclass here", ()) ERROR(required_initializer_not_accessible,none, "'required' initializer must be accessible wherever class %0 can be " "subclassed", (Identifier)) ERROR(required_initializer_missing_keyword,none, "'required' modifier must be present on all overrides of a required " "initializer", ()) ERROR(required_initializer_override_wrong_keyword,none, "use the 'required' modifier to override a required initializer", ()) WARNING(required_initializer_override_keyword,none, "'override' is implied when overriding a required initializer", ()) NOTE(overridden_required_initializer_here,none, "overridden required initializer is here", ()) // Functions ERROR(type_attr_requires_function_type,none, "%0 only applies to function types", (const TypeAttribute *)) ERROR(generic_function_type,none, "function values cannot be generic", ()) ERROR(unsupported_convention,none, "convention '%0' not supported", (StringRef)) ERROR(invalid_isolated_and_convention_attributes,none, "'@convention(%0)' attribute is not allowed on '@isolated' types", (StringRef)) ERROR(unreferenced_generic_parameter,NoUsage, "generic parameter '%0' is not used in function signature", (StringRef)) ERROR(unexpected_ctype_for_non_c_convention,none, "convention '%0' does not support the 'cType' argument label, did you " "mean '@convention(c, cType: \"%1\")' or " "'@convention(block, cType: \"%1\")' instead?", (StringRef, StringRef)) ERROR(unable_to_parse_c_function_type,none, "unable to parse '%0'; it should be a C function pointer type or a " "block pointer type", (StringRef)) // Opaque types ERROR(unsupported_opaque_type,none, "'some' types are only permitted in properties, subscripts, and functions", ()) ERROR(unsupported_opaque_type_in_existential,none, "'some' types cannot be used in constraints on existential types", ()) ERROR(opaque_type_unsupported_pattern,none, "'some' type can only be declared on a single property declaration", ()) ERROR(opaque_type_in_protocol_requirement,none, "'some' type cannot be the return type of a protocol requirement; did you mean to add an associated type?", ()) ERROR(opaque_type_in_parameter,none, "'some' cannot appear in parameter position in %select{result|parameter}0" " type %1", (bool, Type)) // Function differentiability ERROR(attr_only_on_parameters_of_differentiable,none, "'%0' may only be used on parameters of '@differentiable' function " "types", (StringRef)) ERROR(differentiable_function_type_invalid_parameter,none, "parameter type '%0' does not conform to 'Differentiable'" "%select{| and satisfy '%0 == %0.TangentVector'}1, but the enclosing " "function type is '@differentiable%select{|(_linear)}1'" "%select{|; did you want to add '@noDerivative' to this parameter?}2", (StringRef, /*isLinear*/ bool, /*hasValidDifferentiabilityParameter*/ bool)) ERROR(differentiable_function_type_invalid_result,none, "result type '%0' does not conform to 'Differentiable'" "%select{| and satisfy '%0 == %0.TangentVector'}1, but the enclosing " "function type is '@differentiable%select{|(_linear)}1'", (StringRef, bool)) ERROR(differentiable_function_type_void_result, none, "'@differentiable' function returning Void must have at least one " "differentiable inout parameter, i.e. a non-'@noDerivative' parameter " "whose type conforms to 'Differentiable'", ()) ERROR(differentiable_function_type_no_differentiability_parameters, none, "'@differentiable' function type requires at least one differentiability " "parameter, i.e. a non-'@noDerivative' parameter whose type conforms to " "'Differentiable'%select{| with its 'TangentVector' equal to itself}0", (/*isLinear*/ bool)) // SIL ERROR(opened_bad_constraint_type,none, "'@opened' constraint type %0 is not a protocol or protocol composition", (Type)) ERROR(opened_bad_interface_type,none, "'@opened' interface type %0 is not a type parameter", (Type)) ERROR(sil_function_input_label,PointsToFirstBadToken, "SIL function types cannot have labeled inputs", ()) ERROR(sil_non_coro_yields,PointsToFirstBadToken, "non-coroutine SIL function types cannot have '@yield' results", ()) ERROR(sil_function_invalid_convention,PointsToFirstBadToken, "convention attribute isn't valid on a %select{parameter|result|callee}0", (unsigned)) ERROR(ast_subst_function_type,none, "substitutions cannot be provided on a formal function type", ()) ERROR(sil_function_multiple_error_results,PointsToFirstBadToken, "SIL function types cannot have multiple '@error' results", ()) ERROR(unsupported_sil_convention,none, "convention '%0' not supported in SIL", (StringRef)) ERROR(illegal_sil_type,none, "type %0 is not a legal SIL value type", (Type)) ERROR(sil_box_arg_mismatch,none, "SIL box type has wrong number of generic arguments for layout", ()) ERROR(sil_pack_element_uuid_not_found,none, "open_pack_element instruction not found for '@pack_element' type UUID; " "possible forward reference?", ()) // SIL Metatypes ERROR(sil_metatype_without_repr,none, "metatypes in SIL must be '@thin', '@thick', or '@objc_metatype'", ()) ERROR(sil_metatype_multiple_reprs,none, "metatypes in SIL can only be one of '@thin', '@thick', or " "'@objc_metatype'", ()) ERROR(sil_metatype_not_metatype,none, "'@thin', '@thick', or '@objc_metatype' can only apply to metatype " "types in SIL", ()) //------------------------------------------------------------------------------ // MARK: @objc and @nonobjc //------------------------------------------------------------------------------ ERROR(objc_interop_disabled,none, "Objective-C interoperability is disabled", ()) ERROR(attr_used_without_required_module, none, "%0 attribute used without importing module %1", (DeclAttribute, Identifier)) ERROR(invalid_objc_decl_context,none, "'@objc' can only be used with members of classes, '@objc' protocols, " "and concrete extensions of classes", ()) ERROR(invalid_objc_decl,none, "only classes (and their extensions), non-marker protocols, methods, " "initializers, properties, and subscript declarations can be declared" " '@objc'", ()) ERROR(invalid_objc_swift_rooted_class,none, "only classes that inherit from NSObject can be declared '@objc'", ()) NOTE(invalid_objc_swift_root_class_insert_nsobject,none, "inherit from 'NSObject' to silence this error", ()) WARNING(objc_header_sorting_arbitrary,none, "arbitrarily printing %0 before %1 in generated header; subsequent " "compilations may print them in a different order", (Decl *, Decl *)) NOTE(objc_header_sorting_arbitrary_other,none, "%1 will be printed after %0 during this compilation", (Decl *, Decl *)) NOTE(objc_header_sorting_arbitrary_please_report,none, "please report this as a bug in the Swift compiler and describe both " "declarations", ()) ERROR(invalid_nonobjc_decl,none, "only class members and extensions of classes can be declared " "'@nonobjc'", ()) ERROR(invalid_nonobjc_extension,none, "only extensions of classes can be declared '@nonobjc'", ()) ERROR(objc_in_extension_context,none, "members of constrained extensions cannot be declared '@objc'", ()) ERROR(objc_in_generic_extension,none, "extensions of %select{classes from generic context|generic classes}0 " "cannot contain '@objc' members", (bool)) ERROR(objc_in_resilient_extension,none, "'@objc' %kindonly0 in extension of subclass of %1 requires %2 %3", (const ValueDecl *, const ClassDecl *, AvailabilityDomain, AvailabilityRange)) ERROR(objc_operator, none, "operator methods cannot be declared '@objc'", ()) ERROR(objc_operator_proto, none, "'@objc' protocols must not have operator requirements", ()) ERROR(objc_for_generic_class,none, "generic subclasses of '@objc' classes cannot have an explicit '@objc' " "because they are not directly visible from Objective-C", ()) ERROR(objc_for_resilient_class,none, "explicit '@objc' on subclass of %0 requires %1 %2", (Identifier, AvailabilityDomain, AvailabilityRange)) ERROR(objc_getter_for_nonobjc_property,none, "'@objc' getter for non-'@objc' property", ()) ERROR(objc_getter_for_nonobjc_subscript,none, "'@objc' getter for non-'@objc' subscript", ()) ERROR(objc_setter_for_nonobjc_property,none, "'@objc' setter for non-'@objc' property", ()) ERROR(objc_setter_for_nonobjc_subscript,none, "'@objc' setter for non-'@objc' subscript", ()) ERROR(objc_enum_generic,none, "'@objc' enum cannot be generic", ()) ERROR(objc_name_req_nullary,none, "'@objc' %kindonly0 must have a simple name", (const Decl *)) ERROR(objc_name_subscript,none, "'@objc' subscript cannot have a name; did you mean to put " "the name on the getter or setter?", ()) ERROR(objc_name_deinit,none, "'@objc' deinitializer cannot have a name", ()) ERROR(objc_name_func_mismatch,none, "'@objc' %select{initializer|method}0 name provides " "%select{one argument name|names for %1 arguments}2, but " "%select{initializer|method}0 has %select{one parameter|%3 parameters}4" "%select{| (%select{|including }4the error parameter)}5", (bool, unsigned, bool, unsigned, bool, bool)) ERROR(objc_enum_case_req_name,none, "attribute has no effect; cases within an '@objc' enum are already " "exposed to Objective-C", ()) ERROR(objc_enum_case_req_objc_enum,none, "'@objc' enum case is not allowed outside of an '@objc' enum", ()) ERROR(objc_enum_case_multi,none, "'@objc' enum case declaration defines multiple enum cases with the same Objective-C name", ()) ERROR(objc_extension_not_class,none, "'@objc' can only be applied to an extension of a class", ()) ERROR(objc_name_not_valid_identifier,none, "'@objc' %kindonly0 name is not a valid Objective-C identifier", (const ValueDecl *)) ERROR(objc_cannot_infer_name_raw_identifier,none, "cannot infer '@objc' %kindonly0 name because the Swift name is not a " "valid Objective-C identifier; specify the name in '@objc' explicitly", (const ValueDecl *)) // If you change this, also change enum ObjCReason #define OBJC_ATTR_SELECT "select{marked '@cdecl'|marked '@_cdecl'|marked dynamic|marked '@objc'|marked '@objcMembers'|marked '@IBOutlet'|marked '@IBAction'|marked '@IBSegueAction'|marked '@NSManaged'|a member of an '@objc' protocol|implicitly '@objc'|an '@objc' override|an implementation of an '@objc' requirement|marked '@IBInspectable'|marked '@GKInspectable'|in an '@objc' extension of a class (without '@nonobjc')|in an '@objc @implementation' extension of a class (without final or '@nonobjc')|marked '@objc' by an access note}" ERROR(objc_invalid_on_var,none, "property cannot be %" OBJC_ATTR_SELECT "0 " "because its type cannot be represented in Objective-C", (unsigned)) ERROR(objc_invalid_on_subscript,none, "subscript cannot be %" OBJC_ATTR_SELECT "0 because its type " "cannot be represented in Objective-C", (unsigned)) ERROR(objc_invalid_on_static_subscript,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1", (const SubscriptDecl *, unsigned)) ERROR(objc_invalid_with_generic_params,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because it has generic " "parameters", (const ValueDecl *, unsigned)) ERROR(objc_invalid_with_generic_requirements,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because it has a 'where' " "clause", (const ValueDecl *, unsigned)) ERROR(objc_convention_invalid,none, "%0 is not representable in Objective-C, so it cannot be used" " with '@convention(%1)'", (Type, StringRef)) WARNING(paren_void_probably_void,none, "when calling this function in Swift 4 or later, you must pass a '()' tuple; did you mean for the input type to be '()'?", ()) NOTE(not_objc_empty_protocol_composition,none, "'Any' is not considered '@objc'; use 'AnyObject' instead", ()) NOTE(not_objc_protocol,none, "protocol-constrained type containing protocol %0 cannot be represented " "in Objective-C", (Type)) NOTE(not_objc_class_constraint,none, "protocol-constrained type containing class %0 cannot be represented " "in Objective-C", (Type)) NOTE(not_objc_error_protocol_composition,none, "protocol-constrained type containing 'Error' cannot be represented " "in Objective-C", ()) NOTE(not_objc_empty_tuple,none, "empty tuple type cannot be represented in %" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) NOTE(not_objc_non_trivial_cxx_class,none, "non-trivial C++ classes cannot be represented in " "%" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) NOTE(not_objc_tuple,none, "tuples cannot be represented in %" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) NOTE(not_objc_swift_class,none, "classes not annotated with '@objc' cannot be represented " "in Objective-C", ()) NOTE(not_objc_swift_struct,none, "Swift structs cannot be represented in %" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) NOTE(not_objc_swift_enum,none, "non-'@objc' enums cannot be represented in Objective-C", ()) NOTE(not_cdecl_or_objc_swift_enum,none, "Swift enums not marked '@cdecl'%select{| or '@objc'}0 cannot be " "represented in %" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) NOTE(not_objc_generic_type_param,none, "generic type parameters cannot be represented in " "%" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) NOTE(not_objc_function_type_param,none, "function types cannot be represented in %" FOREIGN_LANG_SELECT "0 " "unless their parameters and returns can be", (ForeignLanguage)) NOTE(not_objc_function_type_throwing,none, "throwing function types cannot be represented in " "%" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) NOTE(objc_inferring_on_objc_protocol_member,none, "inferring '@objc' because the declaration is a member of " "an '@objc' protocol", ()) NOTE(objc_overriding_objc_decl,none, "overriding '@objc' %kind0 here", (const ValueDecl *)) NOTE(objc_witness_objc_requirement,none, "satisfying requirement for %kind0 in protocol %1", (const ValueDecl *, const ProtocolDecl *)) NOTE(cdecl_incompatible_with_protocols,none, "protocols cannot be represented in C", ()) NOTE(cdecl_incompatible_with_classes,none, "classes cannot be represented in C", ()) ERROR(no_opaque_return_type_of,none, "unable to resolve type for _opaqueReturnTypeOf attribute", ()) ERROR(objc_observing_accessor, none, "observers (%kindonly0) are not allowed to be marked '@objc'", (const AccessorDecl *)) ERROR(objc_init_accessor, none, "init accessors cannot be marked '@objc'", ()) ERROR(objc_addressor, none, "addressors are not allowed to be marked '@objc'", ()) ERROR(objc_coroutine_accessor, none, "'read' and 'modify' accessors are not allowed to be marked '@objc'", ()) ERROR(objc_borrow_mutate_accessor, none, "borrow and mutate accessors are not allowed to be marked '@objc'", ()) ERROR(objc_invalid_on_func_variadic,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because it has a variadic " "parameter", (const AbstractFunctionDecl*, unsigned)) ERROR(objc_invalid_on_func_inout,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because inout " "parameters cannot be represented in %" FOREIGN_LANG_SELECT "2", (const AbstractFunctionDecl*, unsigned, ForeignLanguage)) ERROR(objc_invalid_on_func_param_type,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "2 because the type of the " "parameter %1 cannot be represented in %" FOREIGN_LANG_SELECT "3", (const AbstractFunctionDecl*, unsigned, unsigned, ForeignLanguage)) ERROR(objc_invalid_on_func_single_param_type,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because the type of the " "parameter cannot be represented in %" FOREIGN_LANG_SELECT "2", (const AbstractFunctionDecl*, unsigned, ForeignLanguage)) ERROR(objc_invalid_on_func_result_type,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because its result type " "cannot be represented in %" FOREIGN_LANG_SELECT "2", (const AbstractFunctionDecl*, unsigned, ForeignLanguage)) ERROR(objc_invalid_on_foreign_class,none, "method cannot be %" OBJC_ATTR_SELECT "0 because Core Foundation " "types are not classes in Objective-C", (unsigned)) ERROR(objc_invalid_on_throwing_optional_result,none, "throwing method cannot be %" OBJC_ATTR_SELECT "0 because " "it returns a value of optional type %1; 'nil' indicates failure to " "Objective-C", (unsigned, Type)) ERROR(objc_invalid_on_throwing_result,none, "throwing method cannot be %" OBJC_ATTR_SELECT "0 because " "it returns a value of type %1; return 'Void' or a type that bridges " "to an Objective-C class", (unsigned, Type)) ERROR(objc_invalid_on_failing_init,none, "a failable and throwing initializer cannot be " "%" OBJC_ATTR_SELECT "0 because 'nil' indicates failure to Objective-C", (unsigned)) ERROR(objc_in_objc_runtime_visible,none, "%kindonly0 cannot be %" OBJC_ATTR_SELECT "1 because class %2 is only " "visible via the Objective-C runtime", (const ValueDecl *, unsigned, const ClassDecl *)) ERROR(objc_override_method_selector_mismatch,none, "Objective-C method has a different selector from the " "method it overrides (%0 vs. %1)", (ObjCSelector, ObjCSelector)) ERROR(objc_override_property_name_mismatch,none, "Objective-C property has a different name from the " "property it overrides (%0 vs. %1)", (Identifier, Identifier)) ERROR(objc_ambiguous_inference,none, "ambiguous inference of Objective-C name for %kind0 (%1 vs %2)", (const ValueDecl *, ObjCSelector, ObjCSelector)) NOTE(objc_ambiguous_inference_candidate,none, "%0 (in protocol %1) provides Objective-C name %2", (const ValueDecl *, const ProtocolDecl *, ObjCSelector)) ERROR(objc_ambiguous_error_convention,none, "%0 overrides or implements protocol requirements for Objective-C " "declarations with incompatible error argument conventions", (const ValueDecl *)) NOTE(objc_ambiguous_error_convention_candidate,none, "%0 provides an error argument here", (const ValueDecl *)) ERROR(missing_bridging_function,Fatal, "missing '%select{_forceBridgeFromObjectiveC|" "_conditionallyBridgeFromObjectiveC}0'", (bool)) #define OBJC_DIAG_SELECT "%select{initializer %1|implicit initializer %1|deinitializer|implicit deinitializer|method %1|getter for %1|subscript getter|setter for %1|subscript setter}0" #define OBJC_DIAG_SELECT_2 "%select{initializer %3|implicit initializer %3|deinitializer|implicit deinitializer|method %3|getter for %3|subscript getter|setter for %3|subscript setter}2" ERROR(objc_redecl,none, OBJC_DIAG_SELECT " with Objective-C selector %4 conflicts with " OBJC_DIAG_SELECT_2 " with the same Objective-C selector", (unsigned, DeclName, unsigned, DeclName, ObjCSelector)) NOTE(objc_declared_here,none, OBJC_DIAG_SELECT " declared here", (unsigned, DeclName)) // %2 and %3 are unused to make signature match with diag::objc_redecl. ERROR(objc_redecl_same,none, OBJC_DIAG_SELECT " with Objective-C selector %4 conflicts with " "previous declaration with the same Objective-C selector", (unsigned, DeclName, unsigned, DeclName, ObjCSelector)) ERROR(objc_redecl_category_name,none, "%select{|imported }0extension with Objective-C category name %2 " "conflicts with previous %select{|imported }1extension with the same " "category name", (bool, bool, Identifier)) ERROR(objc_override_other,none, OBJC_DIAG_SELECT " with Objective-C selector %4 conflicts with " OBJC_DIAG_SELECT_2 " from superclass %5 with the same Objective-C " "selector", (unsigned, DeclName, unsigned, DeclName, ObjCSelector, Type)) ERROR(objc_class_method_not_permitted,none, OBJC_DIAG_SELECT " defines Objective-C class method %2, which is " "not permitted by Swift", (unsigned, DeclName, ObjCSelector)) ERROR(objc_witness_selector_mismatch,none, "Objective-C method %2 provided by " OBJC_DIAG_SELECT " does not match the requirement's selector (%3)", (unsigned, DeclName, ObjCSelector, ObjCSelector)) ERROR(objc_optional_requirement_conflict,none, "Objective-C method %4 provided by " OBJC_DIAG_SELECT " conflicts with optional requirement " OBJC_DIAG_SELECT_2 " in protocol %5", (unsigned, DeclName, unsigned, DeclName, ObjCSelector, Identifier)) NOTE(objc_optional_requirement_swift_rename,none, "rename %select{method|initializer|property|subscript}0 to match " "requirement %1", (bool, DeclName)) ERROR(witness_non_objc,none, "non-'@objc' " OBJC_DIAG_SELECT " does not satisfy requirement " "of '@objc' protocol %2", (unsigned, DeclName, Identifier)) WARNING(witness_non_objc_optional,none, "non-'@objc' " OBJC_DIAG_SELECT " does not satisfy optional " "requirement of '@objc' protocol %2", (unsigned, DeclName, Identifier)) ERROR(witness_non_objc_storage,none, "non-'@objc' %select{property %1|subscript}0 does not satisfy " "requirement of '@objc' protocol %2", (bool, DeclName, Identifier)) WARNING(witness_non_objc_storage_optional,none, "non-'@objc' %select{property %1|subscript}0 does not satisfy " "optional requirement of '@objc' protocol %2", (bool, DeclName, Identifier)) ERROR(nonobjc_not_allowed,none, "declaration is %" OBJC_ATTR_SELECT "0, and cannot be marked '@nonobjc'", (unsigned)) #undef OBJC_DIAG_SELECT_2 #undef OBJC_DIAG_SELECT #undef OBJC_ATTR_SELECT #undef FOREIGN_LANG_SELECT //------------------------------------------------------------------------------ // MARK: @exclusivity //------------------------------------------------------------------------------ ERROR(exclusivity_on_wrong_decl,none, "'@exclusivity' can only be used on class properties, static properties " "and global variables", ()) ERROR(exclusivity_on_computed_property,none, "'@exclusivity' can only be used on stored properties", ()) //------------------------------------------------------------------------------ // MARK: @_borrowed //------------------------------------------------------------------------------ ERROR(borrowed_with_objc_dynamic,none, "%kindonly0 cannot be '@_borrowed' if it is '@objc dynamic'", (const AbstractStorageDecl *)) ERROR(borrowed_on_objc_protocol_requirement,none, "%kindonly0 cannot be '@_borrowed' if it is an '@objc' protocol " "requirement", (const AbstractStorageDecl *)) ERROR(borrowed_with_effect,none, "%kindonly0 cannot be '@_borrowed' if it is 'async' or 'throws'", (const AccessorDecl *)) //------------------------------------------------------------------------------ // MARK: dynamic //------------------------------------------------------------------------------ ERROR(dynamic_with_transparent,none, "a declaration cannot be both '@_transparent' and 'dynamic'", ()) //------------------------------------------------------------------------------ // MARK: @_dynamicReplacement(for:) //------------------------------------------------------------------------------ ERROR(dynamic_replacement_accessor_not_dynamic, none, "replaced accessor for %0 is not marked dynamic", (DeclName)) ERROR(dynamic_replacement_accessor_not_explicit, none, "replaced %0 for %1 is not explicitly defined", (StringRef, DeclName)) ERROR(dynamic_replacement_function_not_dynamic, none, "replaced function %0 is not marked dynamic", (DeclName)) ERROR(dynamic_replacement_function_not_found, none, "replaced function %0 could not be found", (DeclNameRef)) ERROR(dynamic_replacement_accessor_not_found, none, "replaced accessor for %0 could not be found", (DeclNameRef)) ERROR(dynamic_replacement_accessor_ambiguous, none, "replaced accessor for %0 occurs in multiple places", (DeclNameRef)) NOTE(dynamic_replacement_accessor_ambiguous_candidate, none, "candidate accessor found in module %0", (Identifier)) ERROR(dynamic_replacement_function_of_type_not_found, none, "replaced function %0 of type %1 could not be found", (DeclNameRef, Type)) NOTE(dynamic_replacement_found_function_of_type, none, "found function %0 of type %1", (DeclName, Type)) ERROR(dynamic_replacement_not_in_extension, none, "dynamicReplacement(for:) of %0 is not defined in an extension or at the " "file level", (DeclName)) ERROR(dynamic_replacement_must_not_be_dynamic, none, "dynamicReplacement(for:) of %0 must not be dynamic itself", (DeclName)) ERROR(dynamic_replacement_replaced_not_objc_dynamic, none, "%0 is not marked '@objc dynamic'", (DeclName)) ERROR(dynamic_replacement_replacement_not_objc_dynamic, none, "%0 is marked '@objc dynamic'", (DeclName)) ERROR(dynamic_replacement_replaced_constructor_is_convenience, none, "replaced initializer %0 is marked as convenience", (DeclNameRef)) ERROR(dynamic_replacement_replaced_constructor_is_not_convenience, none, "replaced initializer %0 is not marked as convenience", (DeclNameRef)) //------------------------------------------------------------------------------ // MARK: @_typeEraser() //------------------------------------------------------------------------------ ERROR(non_nominal_type_eraser,none, "type eraser must be a class, struct, or enum", ()) ERROR(type_eraser_does_not_conform,none, "type eraser %0 must conform to protocol %1", (Type, Type)) ERROR(type_eraser_not_accessible,none, "%select{private|fileprivate|internal|package|public|open}0 type eraser %1 " "cannot have more restrictive access than protocol %2 " "(which is %select{private|fileprivate|internal|package|public|open}3)", (AccessLevel, Identifier, Type, AccessLevel)) ERROR(type_eraser_missing_init,none, "type eraser %0 must have an initializer of the form " "'init(erasing: T)'", (Type, StringRef)) ERROR(type_eraser_unviable_init,none, "type eraser %0 has no viable initializer of the form " "'init(erasing: T)'", (Type, StringRef)) NOTE(type_eraser_declared_here,none, "type eraser declared here",()) NOTE(type_eraser_failable_init,none, "'init(erasing:)' cannot be failable",()) NOTE(type_eraser_init_unsatisfied_requirements,none, "'init(erasing:)' cannot have unsatisfied requirements " "when %0 = 'some %1'", (Type, StringRef)) NOTE(type_eraser_init_not_accessible,none, "%select{private|fileprivate|internal|package|public|open}0 'init(erasing:)' " "cannot have more restrictive access than protocol %1 " "(which is %select{private|fileprivate|internal|package|public|open}2)", (AccessLevel, Type, AccessLevel)) NOTE(type_eraser_init_spi,none, "'init(erasing:)' is SPI, but protocol %0 is not" "%select{| in the same SPI groups as 'init(erasing:)'}1", (Type, bool)) //------------------------------------------------------------------------------ // MARK: @available //------------------------------------------------------------------------------ ERROR(availability_must_occur_alone, none, "%0 %select{|version }1availability must be specified alone", (AvailabilityDomain, bool)) ERROR(availability_unexpected_version, none, "unexpected version number for %0", (AvailabilityDomain)) GROUPED_ERROR(availability_unrecognized_platform_name, AvailabilityUnrecognizedName, PointsToFirstBadToken, "unrecognized platform name %0", (Identifier)) GROUPED_ERROR(availability_suggest_platform_name, AvailabilityUnrecognizedName, PointsToFirstBadToken, "unrecognized platform name %0; did you mean '%1'?", (Identifier, StringRef)) WARNING(availability_unsupported_version_number, none, "'%0' is not a supported version number", (llvm::VersionTuple)) WARNING(availability_invalid_version_number_for_domain, none, "'%0' is not a valid version number for %1", (llvm::VersionTuple, AvailabilityDomain)) WARNING(attr_availability_expected_deprecated_version, none, "expected version number with 'deprecated' in '%0' attribute for %1", (const DeclAttribute, AvailabilityDomain)) WARNING(attr_availability_cannot_be_used_for_domain, none, "'%0' cannot be used in '%1' attribute for %2", (StringRef, const DeclAttribute, AvailabilityDomain)) WARNING(attr_availability_expected_version_spec, none, "expected 'introduced', 'deprecated', or 'obsoleted' in '%0' attribute " "for %1", (const DeclAttribute, AvailabilityDomain)) ERROR(attr_availability_requires_custom_availability, none, "%0 requires '-enable-experimental-feature CustomAvailability'", (AvailabilityDomain)) ERROR(attr_availability_domain_access, none, "availability domain '%0' is " "%select{private|fileprivate|internal|package|%error|%error}1 " "and cannot be used in '%2' on " "%select{private|fileprivate|internal|package|public|%error}3 %kind4", (AvailabilityDomain, AccessLevel, DeclAttribute, AccessLevel, const Decl *)) ERROR(attr_availability_domain_not_usable_from_inline, none, "availability domain '%0' used in '%1' on %kind2 must be " "'@usableFromInline' or public", (AvailabilityDomain, DeclAttribute, const Decl *)) ERROR(availability_decl_unavailable, none, "%0 is unavailable%select{ in %2|}1%select{|: %3}3", (const ValueDecl *, bool, AvailabilityDomain, StringRef)) #define REPLACEMENT_DECL_KIND_SELECT "select{| instance method| property}" ERROR(availability_decl_unavailable_rename, none, "%0 has been %select{renamed to|replaced by}1" "%" REPLACEMENT_DECL_KIND_SELECT "2 '%3'%select{|: %4}4", (const ValueDecl *, bool, unsigned, StringRef, StringRef)) NOTE(availability_marked_unavailable, none, "%0 has been explicitly marked unavailable here", (const ValueDecl *)) NOTE(availability_introduced_in_version, none, "%0 was introduced in %1 %2", (const ValueDecl *, AvailabilityDomain, AvailabilityRange)) NOTE(availability_obsoleted, none, "%0 was obsoleted in %1 %2", (const ValueDecl *, AvailabilityDomain, AvailabilityRange)) GROUPED_WARNING(availability_deprecated, DeprecatedDeclaration, Deprecation, "%0 %select{is|%select{is|was}3}1 " "deprecated%select{| in %2%select{| %4}3}1%select{|: %5}5", (const ValueDecl *, bool, AvailabilityDomain, bool, AvailabilityRange, StringRef)) GROUPED_WARNING( availability_deprecated_rename, DeprecatedDeclaration, Deprecation, "%0 %select{is|%select{is|was}3}1 " "deprecated%select{| in %2%select{| %4}3}1: " "%select{renamed to|replaced by}5%" REPLACEMENT_DECL_KIND_SELECT "6 " "'%7'", (const ValueDecl *, bool, AvailabilityDomain, bool, AvailabilityRange, bool, unsigned, StringRef)) #undef REPLACEMENT_DECL_KIND_SELECT NOTE(note_deprecated_rename, none, "use '%0' instead", (StringRef)) ERROR(availability_decl_more_than_enclosing, none, "%kindonly0 cannot be more available than enclosing scope", (const Decl *)) NOTE(availability_implicit_decl_here, none, "%kindonly0 implicitly declared here with availability of %1 %2 or newer", (const Decl *, AvailabilityDomain, AvailabilityRange)) NOTE(availability_decl_more_than_enclosing_here, none, "enclosing scope requires availability of %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_decl_only_in, none, "%0 is only available in %1%select{| %3 or newer}2", (const ValueDecl *, AvailabilityDomain, bool, AvailabilityRange)) ERROR(availability_decl_only_in_for_clients, none, "%0 is only available in %1%select{| %3 or newer}2" "%select{|; clients of %4 may have a lower deployment target}2", (const ValueDecl *, AvailabilityDomain, bool, AvailabilityRange, ModuleDecl *)) ERROR(availability_opaque_types_only_version_newer, none, "'some' return types are only available in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_concurrency_only_version_newer, none, "concurrency is only available in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_parameterized_protocol_only_version_newer, none, "runtime support for parameterized protocol types is only available in " "%0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_isolated_any_only_version_newer, none, "runtime support for '@isolated(any)' function types is only available " "in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_copyable_generics_casting_only_version_newer, none, "runtime support for casting types with noncopyable generic arguments " "is only available in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_escapable_generics_casting_only_version_newer, none, "runtime support for casting types with nonescapable generic arguments " "is only available in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_typed_throws_only_version_newer, none, "runtime support for typed throws function types is only available in " "%0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(availability_variadic_type_only_version_newer, none, "parameter packs in generic types are only available in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) NOTE(availability_guard_with_version_check, none, "add 'if #available' version check", ()) NOTE(availability_add_attribute, none, "add '@available' attribute to enclosing %kindonly0", (const Decl *)) ERROR(availability_inout_accessor_only_in, none, "cannot pass as inout because %0 is only available in %1" "%select{| %3 or newer}2", (const ValueDecl *, AvailabilityDomain, bool, AvailabilityRange)) ERROR(availability_query_required_for_platform, none, "condition required for target platform '%0'", (StringRef)) WARNING(availability_query_useless_enclosing_scope, none, "unnecessary check for '%0'; enclosing scope ensures guard " "will always be true", (StringRef)) NOTE(availability_query_useless_enclosing_scope_here, none, "enclosing scope here", ()) ERROR(availability_decl_no_potential, none, "%kindonly0 cannot be marked potentially unavailable with '@available'", (const Decl *)) ERROR(availability_decl_no_unavailable, none, "%kindonly0 cannot be marked unavailable with '@available'", (const Decl *)) ERROR(availability_global_script_no_potential, none, "global variable cannot be marked potentially " "unavailable with '@available' in script mode", ()) ERROR(availability_global_script_no_unavailable, none, "global variable cannot be marked unavailable " "with '@available' in script mode", ()) ERROR(availability_stored_property_no_potential, none, "stored properties cannot be marked potentially unavailable with " "'@available'", ()) ERROR(availability_stored_property_no_unavailable, none, "stored properties cannot be marked unavailable with '@available'", ()) ERROR(availability_enum_element_no_potential, none, "enum cases with associated values cannot be marked potentially unavailable with " "'@available'", ()) WARNING(availability_enum_element_no_potential_warn, none, "enum cases with associated values cannot be marked potentially unavailable with " "'@available'", ()) ERROR(availability_protocol_requires_version, none, "protocol %0 requires %1 to be available in %2 %3 and newer", (const ProtocolDecl *, const ValueDecl *, AvailabilityDomain, AvailabilityRange)) ERROR(availability_protocol_requirement_only_available_in, none, "protocol %0 requirement %1 cannot be satisfied by %kindonly1 that " "is only available in %2", (const ProtocolDecl *, const ValueDecl *, AvailabilityDomain)) NOTE(availability_protocol_requirement_here, none, "protocol requirement here", ()) ERROR(public_decl_needs_availability, none, "public declarations should have an availability attribute " "with an introduction version", ()) ERROR(attr_requires_decl_availability_for_platform,none, "'%0' requires that %1 have explicit availability for %2", (DeclAttribute, DeclName, StringRef)) ERROR(attr_requires_availability_for_platform,none, "'%0' requires explicit availability for %1", (DeclAttribute, StringRef)) // This doesn't display as an availability diagnostic, but it's // implemented there and fires when these subscripts are marked // unavailable, so it seems appropriate to put it here. ERROR(availability_string_subscript_migration, none, "subscripts returning String were obsoleted in Swift 4; explicitly " "construct a String from subscripted result", ()) NOTE(availability_unavailable_implicit_init, none, "call to unavailable %kind0 from superclass %1 occurs implicitly at the " "end of this initializer", (const ValueDecl *, DeclName)) // Conformance availability checking diagnostics ERROR(conformance_availability_unavailable, none, "conformance of %0 to %1 is unavailable" "%select{ in %3|}2%select{|: %4}4", (Type, Type, bool, AvailabilityDomain, StringRef)) NOTE(conformance_availability_marked_unavailable, none, "conformance of %0 to %1 has been explicitly marked " "unavailable here", (Type, Type)) NOTE(conformance_availability_introduced_in_version, none, "conformance of %0 to %1 was introduced in %2 %3", (Type, Type, AvailabilityDomain, AvailabilityRange)) NOTE(conformance_availability_obsoleted, none, "conformance of %0 to %1 was obsoleted in %2 %3", (Type, Type, AvailabilityDomain, AvailabilityRange)) GROUPED_WARNING(conformance_availability_deprecated, DeprecatedDeclaration, Deprecation, "conformance of %0 to %1 %select{is|%select{is|was}4}2 " "deprecated%select{| in %3%select{| %5}4}2%select{|: %6}6", (Type, Type, bool, AvailabilityDomain, bool, AvailabilityRange, StringRef)) ERROR(conformance_availability_only_version_newer, none, "conformance of %0 to %1 is only available in %2 %3 or newer", (Type, Type, AvailabilityDomain, AvailabilityRange)) //------------------------------------------------------------------------------ // MARK: if #available(...) //------------------------------------------------------------------------------ ERROR(availability_query_not_allowed, none, "%0 %select{|version }1checks not allowed in %2(...)", (AvailabilityDomain, bool, StringRef)) ERROR(availability_query_already_specified, none, "%select{|version for }0%1 already specified", (bool, AvailabilityDomain)) ERROR(availability_query_wildcard_required, none, "must handle potential future platforms with '*'", ()) ERROR(unavailability_query_wildcard_not_required, none, "platform wildcard '*' is always implicit in #unavailable", ()) //------------------------------------------------------------------------------ // MARK: @discardableResult //------------------------------------------------------------------------------ WARNING(discardable_result_on_void_never_function, none, "'@discardableResult' declared on a function returning " "'%select{Never|Void}0' " "is unnecessary", (bool)) //------------------------------------------------------------------------------ // MARK: Resilience diagnostics //------------------------------------------------------------------------------ ERROR(fixed_layout_attr_on_internal_type, none, "'@_fixed_layout' attribute can only be applied to '@usableFromInline', " "package, or public declarations, but %0 is " "%select{private|fileprivate|internal|%error|%error|%error}1", (DeclName, AccessLevel)) WARNING(fixed_layout_struct, none, "'@frozen' attribute is now used for fixed-layout structs", ()) ERROR(frozen_attr_on_internal_type, none, "'@frozen' attribute can only be applied to '@usableFromInline', " "package, or public declarations, but %0 is " "%select{private|fileprivate|internal|%error|%error|%error}1", (DeclName, AccessLevel)) ERROR(usable_from_inline_attr_with_explicit_access, none, "'@usableFromInline' attribute can only be applied to internal or package " "declarations, but %kind0 is %select{private|fileprivate|%error|package|public|open}1", (const ValueDecl *, AccessLevel)) WARNING(inlinable_implies_usable_from_inline,none, "'@usableFromInline' attribute has no effect on '@inlinable' %kind0", (const ValueDecl *)) ERROR(usable_from_inline_attr_in_protocol,none, "'@usableFromInline' attribute cannot be used in protocols", ()) #define FRAGILE_FUNC_KIND \ "%select{a '@_transparent' function|" \ "an '@inlinable' function|" \ "an '@_alwaysEmitIntoClient' function|" \ "a default argument value|" \ "a property initializer in a '@frozen' type|" \ "a '@backDeployed' function'}" ERROR(local_type_in_inlinable_function, none, "type %0 cannot be nested inside " FRAGILE_FUNC_KIND "1", (Identifier, unsigned)) ERROR(resilience_decl_unavailable, none, "%kind0 is %select{private|fileprivate|internal|package|%error|%error}1 and " "cannot be referenced from " FRAGILE_FUNC_KIND "2", (const ValueDecl *, AccessLevel, unsigned)) WARNING(resilience_decl_unavailable_warn, none, "%kind0 is %select{private|fileprivate|internal|package|%error|%error}1 and " "should not be referenced from " FRAGILE_FUNC_KIND "2", (const ValueDecl *, AccessLevel, unsigned)) ERROR(inlinable_decl_ref_from_hidden_module, none, "%kind0 cannot be used in " FRAGILE_FUNC_KIND "1 " "because %select{%2 was imported implementation-only|" "it is an SPI imported from %2|" "it is SPI|" "%2 was imported for SPI only|" "%2 was not imported by this file|" "C++ APIs from imported module %2 do not support library evolution|" "%2 was not imported publicly}3", (const ValueDecl *, unsigned, Identifier, unsigned)) ERROR(inlinable_typealias_desugars_to_type_from_hidden_module, none, "%0 aliases '%1.%2' and cannot be used in " FRAGILE_FUNC_KIND "3 " "because %select{%4 has been imported as implementation-only|" "it is an SPI imported from %4|" "<>|" "%4 was imported for SPI only|" "%4 was not imported by this file|" "C++ types from imported module %4 do not support library evolution|" "%4 was not imported publicly}5", (const TypeAliasDecl *, StringRef, StringRef, unsigned, Identifier, unsigned)) NOTE(missing_import_inserted, none, "The missing import of module %0 will be added implicitly", (Identifier)) ERROR(availability_macro_in_inlinable, none, "availability macro cannot be used in " FRAGILE_FUNC_KIND "0", (unsigned)) #undef FRAGILE_FUNC_KIND NOTE(resilience_decl_declared_here, none, "%kind0 is not '@usableFromInline' or public", (const ValueDecl *)) ERROR(class_designated_init_inlinable_resilient,none, "initializer for class %0 is " "'%select{@_transparent|@inlinable|@_alwaysEmitIntoClient|%error}1' and must " "delegate to another initializer", (Type, unsigned)) ERROR(attribute_invalid_on_stored_property, none, "'%0' attribute cannot be applied to stored properties", (DeclAttribute)) ERROR(inlinable_dynamic_not_supported, none, "'@inlinable' attribute cannot be applied to 'dynamic' declarations", ()) ERROR(inlinable_decl_not_public, none, "'@inlinable' attribute can only be applied to internal, package, or public declarations, " "but %0 is %select{private|fileprivate|%error|%error|%error|%error}1", (DeclBaseName, AccessLevel)) ERROR(inlinable_resilient_deinit, none, "deinitializer can only be '@inlinable' if the class is '@_fixed_layout'", ()) ERROR(resilient_associated_type_less_available_requires_default,none, "associated type %0 that is less available than its protocol must have a " "default", (const AssociatedTypeDecl *)) //------------------------------------------------------------------------------ // MARK: @_specialize diagnostics //------------------------------------------------------------------------------ ERROR(specialize_attr_nongeneric_trailing_where,none, "trailing 'where' clause in %select{'_specialize'|'specialized'}1 attribute of non-generic function %0", (DeclName, bool)) ERROR(specialize_missing_where_clause,none, "missing 'where' clause in %select{'_specialize'|'specialized'}0 attribute", (bool)) ERROR(specialize_empty_where_clause,none, "empty 'where' clause in %select{'_specialize'|'specialized'}0 attribute", (bool)) ERROR(specialize_attr_non_concrete_same_type_req,none, "only concrete type same-type requirements are supported by %select{'_specialize'|'specialized'}0 attribute", (bool)) ERROR(specialize_attr_only_generic_param_req,none, "only requirements on generic parameters are supported by %select{'_specialize'|'specialized'}0 attribute", (bool)) ERROR(specialize_attr_type_parameter_count_mismatch,none, "too few generic parameters are specified " "in %select{'_specialize'|'specialized'}2 attribute (got %0, but expected %1)", (unsigned, unsigned, bool)) NOTE(specialize_attr_missing_constraint,none, "missing constraint for %0 in %select{'_specialize'|'specialized'}1 attribute", (DeclName, bool)) ERROR(specialize_attr_unsupported_kind_of_req,none, "only same-type and layout requirements are supported by '_specialize' attribute", ()) ERROR(specialized_attr_unsupported_kind_of_req,none, "only same-type are supported by 'specialized' attribute", ()) ERROR(specialize_target_function_not_found, none, "target function %0 could not be found", (DeclNameRef)) ERROR(specialize_target_function_of_type_not_found, none, "target function %0 of type %1 could not be found", (DeclNameRef, Type)) NOTE(specialize_found_function_of_type, none, "found function %0 of type %1", (DeclName, Type)) //------------------------------------------------------------------------------ // MARK: Variable usage diagnostics //------------------------------------------------------------------------------ WARNING(pbd_never_used_stmtcond, NoUsage, "value %0 was defined but never used; consider replacing " "with boolean test", (Identifier)) WARNING(unused_setter_parameter, NoUsage, "setter argument %0 was never used, but the property was accessed", (Identifier)) NOTE(fixit_for_unused_setter_parameter, none, "did you mean to use %0 instead of accessing the property's current value?", (Identifier)) WARNING(pbd_never_used, NoUsage, "initialization of %select{variable|immutable value}1 %0 was never used" "; consider replacing with assignment to '_' or removing it", (Identifier, unsigned)) WARNING(capture_never_used, NoUsage, "capture %0 was never used", (Identifier)) WARNING(variable_never_used, NoUsage, "%select{variable|immutable value}1 %0 was never used; " "consider replacing with '_' or removing it", (Identifier, unsigned)) WARNING(immutable_value_never_used_but_assigned, NoUsage, "immutable value %0 was never used; consider removing it", (Identifier)) WARNING(variable_never_mutated, none, "variable %0 was never mutated; " "consider %select{removing 'var' to make it|changing to 'let'}1 constant", (Identifier, bool)) WARNING(variable_tuple_elt_never_mutated, none, "variable %0 was never mutated; " "consider changing the pattern to 'case (..., let %1, ...)'", (Identifier, StringRef)) GROUPED_WARNING(weak_variable_never_mutated, WeakMutability, none, "weak variable %0 was never mutated; " "consider %select{removing 'var' to make it|changing to 'let'}1 constant", (Identifier, bool)) GROUPED_WARNING(weak_variable_tuple_elt_never_mutated, WeakMutability, none, "weak variable %0 was never mutated; " "consider changing the pattern to 'case (..., let %1, ...)'", (Identifier, StringRef)) WARNING(variable_never_read, none, "variable %0 was written to, but never read", (Identifier)) WARNING(observe_keypath_property_not_objc_dynamic, none, "passing reference to non-'@objc dynamic' property %0 to KVO method %1 " "may lead to unexpected behavior or runtime trap", (DeclName, DeclName)) WARNING(default_magic_identifier_mismatch, none, "parameter %0 with default argument '%1' passed to parameter %2, whose " "default argument is '%3'", (Identifier, StringRef, Identifier, StringRef)) NOTE(change_caller_default_to_match_callee, none, "did you mean for parameter %0 to default to '%1'?", (Identifier, StringRef)) NOTE(silence_default_magic_identifier_mismatch, none, "add parentheses to silence this warning", ()) //------------------------------------------------------------------------------ // MARK: Debug diagnostics //------------------------------------------------------------------------------ WARNING(debug_long_function_body, none, "%kind0 took %1ms to type-check (limit: %2ms)", (const ValueDecl *, unsigned, unsigned)) WARNING(debug_long_closure_body, none, "closure took %0ms to type-check (limit: %1ms)", (unsigned, unsigned)) WARNING(debug_long_expression, none, "expression took %0ms to type-check (limit: %1ms)", (unsigned, unsigned)) //------------------------------------------------------------------------------ // MARK: Pattern match diagnostics //------------------------------------------------------------------------------ ERROR(empty_switch_stmt,none, "'switch' statement body must have at least one 'case' or 'default' " "block; add a default case",()) ERROR(non_exhaustive_switch,none, "switch must be exhaustive", ()) ERROR(possibly_non_exhaustive_switch,none, "the compiler is unable to check that this switch is exhaustive in reasonable time", ()) NOTE(missing_several_cases,none, "add " "%select{missing cases|a default clause}0", (bool)) NOTE(missing_unknown_case,none, "handle unknown values using \"@unknown default\"", ()) NOTE(non_exhaustive_switch_drop_unknown,none, "remove '@unknown' to handle remaining values", ()) NOTE(missing_particular_case,none, "add missing case: '%0'", (StringRef)) WARNING(redundant_particular_case,none, "case is already handled by previous patterns; consider removing it",()) WARNING(redundant_particular_literal_case,none, "literal value is already handled by previous pattern; " "consider removing it",()) NOTE(redundant_particular_literal_case_here,none, "first occurrence of identical literal pattern is here", ()) ERROR(non_exhaustive_switch_unknown_only,none, "switch covers known cases, but %0 may have additional unknown values" "%select{|, possibly added in future versions}1", (Type, bool)) ERROR(override_nsobject_hashvalue_error,none, "'NSObject.hashValue' is not overridable; " "did you mean to override 'NSObject.hash'?", ()) ERROR(override_nsobject_hash_error,none, "'NSObject.hash(into:)' is not overridable; " "did you mean to override 'NSObject.hash'?", ()) GROUPED_WARNING( hashvalue_implementation, DeprecatedDeclaration, Deprecation, "'Hashable.hashValue' is deprecated as a protocol requirement; " "conform type %0 to 'Hashable' by implementing 'hash(into:)' instead", (Type)) GROUPED_WARNING( executor_enqueue_deprecated_owned_job_implementation, DeprecatedDeclaration, Deprecation, "'Executor.enqueue(Job)' is deprecated as a protocol requirement; " "conform type %0 to 'Executor' by implementing 'func enqueue(ExecutorJob)' " "instead", (Type)) WARNING(executor_enqueue_unused_implementation, none, "'Executor.enqueue(ExecutorJob)' will never be used, due to the presence of " "'enqueue(UnownedJob)'", ()) //------------------------------------------------------------------------------ // MARK: property wrapper diagnostics //------------------------------------------------------------------------------ GROUPED_ERROR(property_wrapper_no_value_property,PropertyWrappers,none, "property wrapper type %0 does not contain a non-static property " "named %1", (Type, Identifier)) GROUPED_ERROR(property_wrapper_ambiguous_value_property,PropertyWrappers,none, "property wrapper type %0 has multiple non-static properties " "named %1", (Type, Identifier)) GROUPED_ERROR(property_wrapper_wrong_initial_value_init,PropertyWrappers,none, "%0 parameter type (%1) must be the same as its " "'wrappedValue' property type (%2) or an '@autoclosure' thereof", (DeclName, Type, Type)) GROUPED_ERROR(property_wrapper_failable_init,PropertyWrappers,none, "property wrapper initializer %0 cannot be failable", (DeclName)) GROUPED_ERROR(property_wrapper_type_requirement_not_accessible,PropertyWrappers,none, "%select{private|fileprivate|internal|package|public|open}0 %kind1 cannot have " "more restrictive access than its enclosing property wrapper type %2 " "(which is %select{private|fileprivate|internal|package|public|open}3)", (AccessLevel, const ValueDecl *, Type, AccessLevel)) GROUPED_ERROR(property_wrapper_ambiguous_enclosing_self_subscript,PropertyWrappers,none, "property wrapper type %0 has multiple enclosing-self subscripts %1", (Type, DeclName)) GROUPED_ERROR(property_wrapper_dynamic_self_type,PropertyWrappers,none, "property wrapper %select{wrapped value|projected value}0 cannot have " "dynamic Self type", (bool)) GROUPED_ERROR(property_wrapper_var_must_be_static,PropertyWrappers,none, "property %0, must be static because property wrapper %1 can only " "be applied to static properties", (Identifier, Type)) ERROR(property_wrapper_attribute_not_on_property, none, "property wrapper attribute %0 can only be applied to a property", (Identifier)) ERROR(property_wrapper_param_not_supported,none, "property wrapper attribute on parameter not yet supported on %kindonly0", (const ValueDecl *)) NOTE(property_wrapper_declared_here,none, "property wrapper type %0 declared here", (Identifier)) ERROR(invalid_projection_argument,none, "cannot use property wrapper projection %select{argument|parameter}0", (bool)) NOTE(property_wrapper_param_no_wrapper,none, "parameter %0 does not have an attached property wrapper", (Identifier)) NOTE(property_wrapper_param_attr_arg,none, "property wrapper has arguments in the wrapper attribute", ()) NOTE(property_wrapper_no_init_projected_value,none, "property wrapper type %0 does not support initialization from a " "projected value", (Type)) ERROR(property_wrapper_param_mutating,none, "property wrapper applied to parameter must have a nonmutating " "'wrappedValue' getter", ()) ERROR(invalid_implicit_property_wrapper,none, "inferred projection type %0 is not a property wrapper", (Type)) ERROR(property_wrapper_mutating_get_composed_to_get_only,none, "property wrapper %0 with a mutating getter cannot be composed inside " "get-only property wrapper %1", (TypeLoc, TypeLoc)) ERROR(property_wrapper_top_level,none, "property wrappers are not yet supported in top-level code", ()) ERROR(property_wrapper_let, none, "property wrapper can only be applied to a 'var'", ()) ERROR(property_wrapper_computed, none, "property wrapper cannot be applied to a computed property", ()) ERROR(property_wrapper_effectful,none, "property wrapper's 'wrappedValue' property cannot define an 'async' or " "'throws' %kindonly0", (const AccessorDecl *)) ERROR(property_with_wrapper_conflict_attribute,none, "property %0 with a wrapper cannot also be " "%select{lazy|'@NSCopying'|'@NSManaged'|'@abi'|weak|unowned|unmanaged}1", (Identifier, int)) ERROR(property_wrapper_not_single_var, none, "property wrapper can only apply to a single variable", ()) ERROR(property_with_wrapper_in_bad_context,none, "%select{|non-static|non-static}1 %kind0 declared inside " "%select{a protocol|an extension|an enum}1 cannot have a wrapper", (const ValueDecl *, int)) ERROR(property_with_wrapper_overrides,none, "property %0 with attached wrapper cannot override another property", (Identifier)) ERROR(property_wrapper_incompatible_property, none, "property type %0 does not match that of the 'wrappedValue' property of " "its wrapper type %1", (Type, Type)) ERROR(wrapped_value_mismatch, none, "property type %0 does not match 'wrappedValue' type %1", (Type, Type)) ERROR(composed_property_wrapper_mismatch, none, "composed wrapper type %0 does not match type of '%1.wrappedValue', which is %2", (Type, StringRef, Type)) ERROR(property_wrapper_type_access,none, "%select{%select{variable|constant}0|property}1 " "%select{must be declared %select{" "%select{private|fileprivate|internal|package|%error|%error}3|private or fileprivate}4" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}3}2 " "because its property wrapper type uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}5 type", (bool, bool, bool, AccessLevel, bool, AccessLevel)) ERROR(property_wrapper_type_not_usable_from_inline,none, "property wrapper type referenced from a '@usableFromInline' " "%select{%select{variable|constant}0|property}1 " "must be '@usableFromInline' or public", (bool, bool)) WARNING(property_wrapper_wrapperValue,Deprecation, "property wrapper's 'wrapperValue' property should be renamed to " "'projectedValue'; use of 'wrapperValue' is deprecated", ()) WARNING(property_wrapper_init_initialValue,Deprecation, "property wrapper's 'init(initialValue:)' should be renamed " "to 'init(wrappedValue:)'; use of 'init(initialValue:)' is deprecated", ()) ERROR(property_wrapper_projection_value_missing,none, "could not find projection value property %0", (DeclNameRef)) ERROR(property_wrapper_missing_arg_init, none, "missing argument for parameter " "%0 in property wrapper initializer; add 'wrappedValue' and %0 " "arguments in '@%1(...)'", (Identifier, StringRef)) //------------------------------------------------------------------------------ // MARK: result builder diagnostics //------------------------------------------------------------------------------ ERROR(result_builder_decl, none, "closure containing a declaration cannot be used with result " "builder %0", (DeclName)) NOTE(note_result_builder_decl, none, "closure containing a declaration cannot be used with result " "builder %0", (DeclName)) ERROR(result_builder_control_flow, none, "closure containing control flow statement cannot be used with result " "builder %0", (DeclName)) NOTE(note_result_builder_control_flow, none, "closure containing control flow statement cannot be used with result " "builder %0", (DeclName)) ERROR(result_builder_attribute_not_allowed_here, none, "result builder attribute %0 can only be applied to a parameter, " "function, subscript, or computed property", (Identifier)) ERROR(result_builder_attribute_on_storage_without_getter, none, "result builder attribute %0 can only be applied to a " "%select{subscript|property|constant|variable}1 if it defines a getter", (DeclName, unsigned)) ERROR(result_builder_parameter_not_of_function_type, none, "result builder attribute %0 can only be applied to a parameter of " "function type", (Identifier)) ERROR(result_builder_parameter_autoclosure, none, "result builder attribute %0 cannot be applied to an autoclosure " "parameter", (Identifier)) ERROR(result_builder_multiple, none, "only one result builder attribute can be attached to a " "%select{declaration|parameter}0", (bool)) NOTE(previous_result_builder_here, none, "previous result builder specified here", ()) ERROR(result_builder_arguments, none, "result builder attributes cannot have arguments", ()) ERROR(result_builder_disabled_by_return, none, "cannot use explicit 'return' statement in the body of result builder %0", (Type)) WARNING(result_builder_disabled_by_return_warn, none, "application of result builder %0 disabled by explicit 'return' " "statement", (Type)) NOTE(result_builder_remove_attr, none, "remove the attribute to explicitly disable the result builder", ()) NOTE(result_builder_remove_returns, none, "remove 'return' statements to apply the result builder", ()) ERROR(result_builder_infer_ambig, none, "ambiguous result builder inferred for %0: %1 or %2", (DeclName, Type, Type)) NOTE(result_builder_infer_add_return, none, "add an explicit 'return' statement to not use a result builder", ()) NOTE(result_builder_infer_pick_specific, none, "apply result builder %0 (inferred from %select{protocol|dynamic replacement of}1 %2)", (Type, unsigned, DeclName)) GROUPED_WARNING(result_builder_missing_limited_availability, ResultBuilderMethods, none, "result builder %0 does not implement 'buildLimitedAvailability'; " "this code may crash on earlier versions of the OS", (Type)) GROUPED_ERROR(result_builder_static_buildblock_or_buildpartialblock, ResultBuilderMethods,none, "result builder must provide at least one static 'buildBlock' " "method, or both 'buildPartialBlock(first:)' and " "'buildPartialBlock(accumulated:next:)'", ()) GROUPED_ERROR(result_builder_missing_available_buildpartialblock, ResultBuilderMethods, none, "result builder %0 does not implement any 'buildBlock' or a combination " "of 'buildPartialBlock(first:)' and " "'buildPartialBlock(accumulated:next:)' with sufficient availability for " "this call site", (Type)) NOTE(result_builder_non_static_buildblock, none, "did you mean to make instance method 'buildBlock' static?", ()) NOTE(result_builder_buildblock_enum_case, none, "enum case 'buildBlock' cannot be used to satisfy the result builder " "requirement", ()) NOTE(result_builder_buildblock_not_static_method, none, "potential match 'buildBlock' is not a static method", ()) NOTE(result_builder_missing_build_optional, none, "add 'buildOptional(_:)' to the result builder %0 to add support for " "'if' statements without an 'else'", (Type)) NOTE(result_builder_missing_build_either, none, "add 'buildEither(first:)' and 'buildEither(second:)' to the result " "builder %0 to add support for 'if'-'else' and 'switch'", (Type)) NOTE(result_builder_missing_build_array, none, "add 'buildArray(_:)' to the result builder %0 to add support for " "'for'..'in' loops", (Type)) NOTE(result_builder_missing_build_limited_availability, none, "add 'buildLimitedAvailability(_:)' to the result " "builder %0 to erase type information for less-available types", (Type)) ERROR(result_builder_requires_explicit_var_initialization,none, "local variable%select{| '%1'}0 requires explicit initializer to be used with " "result builder %2", (bool, StringRef, DeclName)) ERROR(cannot_declare_computed_var_in_result_builder,none, "cannot declare local %select{lazy|wrapped|computed|observed}0 variable " "in result builder", (unsigned)) ERROR(cannot_convert_result_builder_result_to_return_type,none, "cannot convert result builder result type %0 to return type %1", (Type,Type)) ERROR(result_builder_buildblock_not_accessible,none, "result builder must provide at least one static 'buildBlock' as " "accessible as result builder type %0 " "(which is %select{private|fileprivate|internal|package|public|open}1)", (DeclName, AccessLevel)) ERROR(result_builder_buildpartialblock_first_not_accessible,none, "result builder must provide at least one static 'buildPartialBlock(first:)' " "as accessible as result builder type %0 " "(which is %select{private|fileprivate|internal|package|public|open}1)", (DeclName, AccessLevel)) ERROR(result_builder_buildpartialblock_accumulated_not_accessible,none, "result builder must provide at least one static 'buildPartialBlock(accumulated:next:)' " "as accessible as result builder type %0 " "(which is %select{private|fileprivate|internal|package|public|open}1)", (DeclName, AccessLevel)) //------------------------------------------------------------------------------ // MARK: Tuple Shuffle Diagnostics //------------------------------------------------------------------------------ WARNING(warn_reordering_tuple_shuffle_deprecated,Deprecation, "expression shuffles the elements of this tuple; " "this behavior is deprecated", ()) //------------------------------------------------------------------------------ // MARK: Implicit conversion diagnostics //------------------------------------------------------------------------------ ERROR(cannot_implicitly_convert_in_optional_context,none, "cannot implicitly convert value of type %0 to expected type %1", (Type, Type)) //------------------------------------------------------------------------------ // MARK: marker protocol diagnostics //------------------------------------------------------------------------------ ERROR(marker_protocol_requirement, none, "marker protocol %0 cannot have any requirements", (DeclName)) ERROR(marker_protocol_inherit_nonmarker, none, "marker protocol %0 cannot inherit non-marker protocol %1", (DeclName, DeclName)) ERROR(marker_protocol_inherit_class, none, "marker protocol %0 cannot inherit class %1", (DeclName, Type)) ERROR(marker_protocol_cast,none, "marker protocol %0 cannot be used in a conditional cast", (DeclName)) ERROR(marker_protocol_conditional_conformance,none, "conditional conformance to non-marker protocol %0 cannot depend on " "conformance of %1 to marker protocol %2", (Identifier, Type, Identifier)) //------------------------------------------------------------------------------ // MARK: differentiable programming diagnostics //------------------------------------------------------------------------------ ERROR(differentiable_programming_attr_used_without_required_module, none, "%0 used without importing module %1", (const TypeAttribute *, Identifier)) //------------------------------------------------------------------------------ // MARK: OSLog //------------------------------------------------------------------------------ ERROR(oslog_arg_must_be_bool_literal, none, "argument must be a bool literal", ()) ERROR(oslog_arg_must_be_integer_literal, none, "argument must be an integer literal", ()) ERROR(oslog_arg_must_be_string_literal, none, "argument must be a string literal", ()) ERROR(oslog_arg_must_be_float_literal, none, "argument must be a floating-point literal", ()) ERROR(oslog_arg_must_be_metatype_literal, none, "argument must be a .self", ()) ERROR(oslog_arg_must_be_closure, none, "argument must be a closure", ()) ERROR(argument_must_be_constant, none, "argument must be an expression with only literals", ()) ERROR(oslog_message_must_be_string_interpolation, none, "argument must be a string interpolation", ()) ERROR(oslog_arg_must_be_enum_case, none, "argument must be a case of enum %0", (Identifier)) ERROR(oslog_arg_must_be_type_member_access, none, "argument must be a static method or property of %0", (Identifier)) ERROR(atomics_ordering_must_be_constant, none, "ordering argument must be a static method or property of %0", (Identifier)) //------------------------------------------------------------------------------ // MARK: access notes //------------------------------------------------------------------------------ #define WHICH_ACCESS_NOTE(reason) "specified by access note for %" #reason WARNING(access_notes_file_io_error,none, "ignored access notes file at '%0' because it cannot be read: %1", (StringRef, StringRef)) REMARK(attr_added_by_access_note, none, "implicitly added '%1' to this %kindonly2, as " WHICH_ACCESS_NOTE(0), (StringRef, StringRef, const ValueDecl *)) NOTE(fixit_attr_added_by_access_note, none, "add '%0' explicitly to silence this warning", (StringRef)) REMARK(attr_removed_by_access_note, none, "implicitly removed '%1' from this %kindonly2, as " WHICH_ACCESS_NOTE(0), (StringRef, StringRef, const ValueDecl *)) NOTE(fixit_attr_removed_by_access_note, none, "remove '%0' explicitly to silence this warning", (StringRef)) REMARK(attr_objc_name_changed_by_access_note, none, "implicitly changed Objective-C name of this %kindonly1 to %2, as " WHICH_ACCESS_NOTE(0), (StringRef, const ValueDecl *, ObjCSelector)) NOTE(fixit_attr_objc_name_changed_by_access_note, none, "change Objective-C name explicitly to silence this warning", ()) // Bad access note diagnostics. These are usually emitted as remarks, but // '-Raccess-note=all-validate' emits them as errors. ERROR(attr_objc_name_conflicts_with_access_note, none, "ignored access note: did not change Objective-C name of this " "%kindonly1 from %2 to %3, even though it was " WHICH_ACCESS_NOTE(0), (StringRef, const ValueDecl *, ObjCSelector, ObjCSelector)) ERROR(wrap_invalid_attr_added_by_access_note, none, "ignored access note: %0; did not implicitly add '%2' to this " "%kindonly3, even though it was " WHICH_ACCESS_NOTE(1), (DiagnosticInfo *, StringRef, StringRef, const ValueDecl *)) #undef WHICH_ACCESS_NOTE //------------------------------------------------------------------------------ // MARK: Type inference from default expressions //------------------------------------------------------------------------------ ERROR(cannot_default_generic_parameter_inferrable_from_another_parameter, none, "cannot use default expression for inference of %0 because it " "is inferrable from parameters %1", (Type, StringRef)) ERROR(cannot_default_generic_parameter_invalid_requirement, none, "cannot use default expression for inference of %0 because " "requirement '%1' refers to other generic parameters", (Type, StringRef)) ERROR(cannot_convert_default_value_type_to_argument_type, none, "cannot convert default value of type %0 to expected argument type %1 for parameter #%2", (Type, Type, unsigned)) //------------------------------------------------------------------------------ // MARK: Back deployment //------------------------------------------------------------------------------ ERROR(attr_incompatible_with_back_deployed,none, "'%0' cannot be applied to a back deployed %kind1", (DeclAttribute, const Decl *)) WARNING(back_deployed_opaque_result_not_supported,none, "'%0' cannot be applied to %kind1 because it has a 'some' return type", (DeclAttribute, const ValueDecl *)) ERROR(back_deployed_requires_body,none, "'%0' requires that %kind1 have a body", (DeclAttribute, const ValueDecl *)) //------------------------------------------------------------------------------ // MARK: Implicit opening of existential types //------------------------------------------------------------------------------ ERROR(concurrency_task_to_thread_model_custom_executor,none, "custom executors are not permitted within %0", (StringRef)) ERROR(concurrency_task_to_thread_model_async_main,none, "async main functions are not permitted within %0", (StringRef)) ERROR(concurrency_task_to_thread_model_main_actor,none, "MainActor is not permitted within %0", (StringRef)) ERROR(concurrency_task_to_thread_model_global_actor,none, "globalActor is not permitted within %0", (StringRef)) ERROR(concurrency_task_to_thread_model_global_actor_annotation,none, "annotating a type with a global actor %0 is not permitted within %1", (TypeRepr*, StringRef)) //------------------------------------------------------------------------------ // MARK: #_hasSymbol //------------------------------------------------------------------------------ WARNING(has_symbol_decl_must_be_weak,none, "%kind0 is not a weakly linked declaration", (const ValueDecl *)) ERROR(has_symbol_invalid_expr,none, "'#_hasSymbol' condition must refer to a declaration", ()) ERROR(has_symbol_invalid_decl_use_responds_to_selector,none, "'#_hasSymbol' cannot be used with Objective-C %select{method|property}0 " "'%1'; use respondsToSelector() instead", (unsigned, StringRef)) ERROR(has_symbol_invalid_decl,none, "'#_hasSymbol' cannot be used with this declaration", ()) //------------------------------------------------------------------------------ // MARK: Type erasure //------------------------------------------------------------------------------ ERROR(no_metadata_on_non_generic_param, none, "'@_noMetadata' must appear on a generic parameter", ()) //------------------------------------------------------------------------------ // MARK: Macros //------------------------------------------------------------------------------ ERROR(expected_macro_expansion_expr,PointsToFirstBadToken, "expected macro expansion to produce an expression", ()) ERROR(expected_macro_expansion_decls,PointsToFirstBadToken, "expected macro expansion to produce a declaration", ()) ERROR(macro_undefined,PointsToFirstBadToken, "no macro named %0", (DeclName)) ERROR(external_macro_not_found,none, "external macro implementation type '%0.%1' could not be found for " "macro %2; %3", (StringRef, StringRef, DeclName, StringRef)) ERROR(macro_must_be_defined,none, "macro %0 requires a definition", (DeclName)) ERROR(external_macro_outside_macro_definition,none, "macro 'externalMacro' can only be used to define another macro", ()) ERROR(macro_type_access,none, "macro %select{must be declared " "%select{private|fileprivate|internal|package|%error|%error}1" "|cannot be declared " "%select{in this context|fileprivate|internal|package|public|open}1}0 " "because its %select{parameter|result type}3 uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) WARNING(macro_type_access_warn,none, "macro %select{should be declared " "%select{private|fileprivate|internal|package|%error|%error}1" "|should not be declared %select{in this context|fileprivate|internal|package|public|open}1}0 " "because its %select{parameter|result type}3 uses " "%select{a private|a fileprivate|an internal|a package|%error|%error}2 type", (bool, AccessLevel, AccessLevel, bool)) ERROR(macro_in_nested,none, "macro %0 can only be declared at file scope", (DeclName)) ERROR(macro_without_role,none, "macro %0 must declare its applicable roles via '@freestanding' or " "'@attached'", (DeclName)) ERROR(macro_result_type_cannot_be_used,none, "only a freestanding expression macro can produce a result of type %0", (Type)) NOTE(macro_remove_result_type,none, "remove the result type if the macro does not produce a value", ()) NOTE(macro_make_freestanding_expression,none, "make this macro a freestanding expression macro", ()) ERROR(macro_multiple_freestanding_roles,none, "macro can only have a single freestanding role", ()) ERROR(macro_expansion_missing_pound,none, "expansion of macro %0 requires leading '#'", (DeclName)) ERROR(macro_unsupported,none, "macros are not supported in this compiler", ()) ERROR(macro_recursive,none, "recursive expansion of macro %0", (DeclName)) ERROR(external_macro_arg_not_type_name,none, "argument to `#externalMacro` must be a string literal naming " "the external macro's %select{module|type}0", (unsigned)) ERROR(invalid_decl_in_macro_expansion,none, "macro expansion cannot introduce %kindonly0", (const Decl *)) ERROR(let_accessor_expansion,none, "cannot expand accessor macro on variable declared with 'let'", ()) ERROR(invalid_main_type_in_macro_expansion,none, "macro expansion cannot introduce '@main' type", ()) ERROR(literal_type_in_macro_expansion,none, "macro expansion cannot introduce default literal type %0", (Identifier)) ERROR(invalid_macro_introduced_name,none, "declaration name %0 is not covered by macro %1", (DeclName, DeclName)) ERROR(undocumented_conformance_in_expansion,none, "conformance to %0 is not covered by macro %1", (Type, DeclName)) ERROR(invalid_macro_role_for_macro_syntax,none, "invalid macro role for %{a freestanding|an attached}0 macro", (unsigned)) ERROR(macro_cannot_introduce_names,none, "'%0' macros are not allowed to introduce names", (StringRef)) ERROR(macro_nonobserving_accessor_missing_from_expansion,none, "expansion of macro %0 did not produce a non-observing accessor " "(such as 'get') as expected", (DeclName)) ERROR(macro_nonobserver_unexpected_in_expansion,none, "expansion of %kind0 produced an unexpected %kindonly1", (const MacroDecl *, const AccessorDecl *)) ERROR(macro_init_accessor_not_documented,none, "expansion of macro %0 produced an unexpected 'init' accessor", (DeclName)) ERROR(global_arbitrary_name,none, "'%0' macros are not allowed to introduce arbitrary names " "at global scope", (StringRef)) ERROR(local_extension_macro,none, "local type cannot have attached extension macro", ()) ERROR(extension_macro_invalid_conformance,none, "invalid protocol conformance %0 in extension macro", (Type)) ERROR(macro_attached_to_invalid_decl,none, "'%0' macro cannot be attached to %kindonly1 (%base1)", (StringRef, const Decl *)) ERROR(conformance_macro,none, "conformance macros are replaced by extension macros", ()) ERROR(experimental_macro,none, "macro %0 is experimental", (DeclName)) ERROR(experimental_closure_body_macro,none, "function body macros on closures is experimental", ()) ERROR(macro_resolve_circular_reference, none, "circular reference resolving %select{freestanding|attached}0 macro %1", (bool, DeclName)) NOTE(macro_resolve_circular_reference_through, none, "while resolving %select{freestanding|attached}0 macro %1", (bool, DeclName)) ERROR(macro_expand_circular_reference, none, "circular reference expanding %0 macro %1", (StringRef, DeclName)) NOTE(macro_expand_circular_reference_through, none, "circular reference expanding %0 macro %1", (StringRef, DeclName)) ERROR(macro_expand_circular_reference_entity, none, "circular reference expanding %0 macros on %1", (StringRef, DeclName)) NOTE(macro_expand_circular_reference_entity_through, none, "circular reference expanding %0 macros on %1", (StringRef, DeclName)) ERROR(macro_expand_circular_reference_unnamed, none, "circular reference expanding %0 macros", (StringRef)) NOTE(macro_expand_circular_reference_unnamed_through, none, "circular reference expanding %0 macros", (StringRef)) ERROR(accessor_macro_not_single_var, none, "accessor macro %0 can only apply to a single variable", (DeclName)) //------------------------------------------------------------------------------ // MARK: Noncopyable Types Diagnostics //------------------------------------------------------------------------------ ERROR(inverse_but_also_conforms, none, "%kind0 required to be '%1' but is marked with '~%1'", (const ValueDecl *, StringRef)) ERROR(inverse_generic_but_also_conforms, none, "%0 required to be '%1' but is marked with '~%1'", (Type, StringRef)) ERROR(inverse_associatedtype_restriction, none, "cannot suppress '%0' requirement of an associated type", (StringRef)) ERROR(inverse_on_class, none, "%select{classes|actors}1 cannot be '~%0'", (StringRef, bool)) ERROR(inverse_with_class_constraint, none, "composition involving %select{class requirement %2|'AnyObject'}0 " "cannot contain '~%1'", (bool, StringRef, Type)) ERROR(inverse_conflicts_explicit_composition, none, "composition cannot contain '~%0' when another member requires '%0'", (StringRef)) ERROR(inverse_extension, none, "cannot suppress '%0' in extension", (StringRef)) ERROR(copyable_illegal_deinit, none, "deinitializer cannot be declared in %kind0 that conforms to 'Copyable'", (const ValueDecl *)) ERROR(inverse_cannot_be_conditional_on_requirement, none, "conditional conformance to suppressible %kind0 cannot depend on " "'%noformat1%select{:|:| ==|:| has same shape as|}2 %noformat3'", (const ProtocolDecl *, Type, unsigned, Type)) ERROR(inverse_type_member_in_conforming_type,none, "%select{stored property %2|associated value %2}1 of " "'%4'-conforming %kind3 has non-%4 type %0", (Type, bool, DeclName, const ValueDecl *, StringRef)) NOTE(add_inverse,none, "consider adding '~%1' to %kind0", (const ValueDecl *, StringRef)) NOTE(note_inverse_preventing_conformance,none, "%0 has '~%1' constraint preventing implicit '%1' conformance", (Type, StringRef)) NOTE(note_inverse_preventing_conformance_explicit,none, "%kind0 has '~%1' constraint preventing '%1' conformance", (const ValueDecl *, StringRef)) ERROR(non_bitwise_copyable_type_class,none, "class cannot conform to 'BitwiseCopyable'", ()) ERROR(non_bitwise_copyable_type_indirect_enum,none, "indirect enum cannot conform to 'BitwiseCopyable'", ()) ERROR(non_bitwise_copyable_type_indirect_enum_element,none, "enum with indirect case cannot conform to 'BitwiseCopyable'", ()) NOTE(note_non_bitwise_copyable_type_indirect_enum_element,none, "indirect case is here", ()) ERROR(non_bitwise_copyable_type_suppressed,none, "cannot both conform to and suppress conformance to 'BitwiseCopyable'", ()) ERROR(non_bitwise_copyable_type_sensitive,none, "a '@sensitive' type cannot conform to 'BitwiseCopyable'", ()) ERROR(non_bitwise_copyable_type_cxx_nontrivial,none, "non-trivial C++ type cannot conform to 'BitwiseCopyable'", ()) ERROR(non_bitwise_copyable_c_type_nontrivial,none, "type with unrepresentable fields cannot derive conformance to 'BitwiseCopyable'", ()) NOTE(note_non_bitwise_copyable_c_type_add_attr,none, "annotate the type __attribute__((__swift_attr__(\"BitwiseCopyable\")))",()) ERROR(non_bitwise_copyable_type_member,none, "%select{stored property %2|associated value %2}1 of " "'BitwiseCopyable'-conforming %kind3 has non-bitwise-copyable type %0", (Type, bool, DeclName, const ValueDecl *)) NOTE(non_bitwise_copyable_nominal,none, "%kind0 does not conform to the 'BitwiseCopyable' protocol", (const ValueDecl *)) NOTE(non_bitwise_copyable_function_type,none, "a function type must be marked '@convention(thin)' or '@convention(c)' to be bitwise copyable", ()) NOTE(add_nominal_bitwise_copyable_conformance,none, "consider making %kind0 conform to the 'BitwiseCopyable' protocol", (const ValueDecl *)) NOTE(add_generic_parameter_non_bitwise_copyable_conformance,none, "consider making generic parameter %0 conform to the 'BitwiseCopyable' protocol", (Type)) ERROR(bitwise_copyable_outside_module,none, "conformance to 'BitwiseCopyable' must occur in the same module as %kind0", (const ValueDecl *)) ERROR(suppress_inferrable_protocol_extension,none, "conformance to inferrable protocol %0 cannot be suppressed in an extension", (const ProtocolDecl *)) ERROR(suppress_nonsuppressable_protocol,none, "conformance to %0 cannot be suppressed", (const ProtocolDecl *)) WARNING(suppress_already_suppressed_protocol,none, "already suppressed conformance to %0", (const ProtocolDecl *)) ERROR(extension_conforms_to_invertible_and_others, none, "conformance to '%0' must be declared in a separate extension", (StringRef)) ERROR(invertible_conformance_other_source_file,none, "conformance to '%0' must occur in the same source file as %kind1", (StringRef, const ValueDecl *)) ERROR(inverse_conditional_must_be_fully_explicit,none, "conditional conformance to %0 must explicitly " "state whether %1 is required to conform to %2 or not", (const ProtocolDecl *, Type, const ProtocolDecl *)) NOTE(make_inverse_conditional_non_requirement_explicit,none, "specify that the conformance does not require %0 to conform to %1", (Type, const ProtocolDecl *)) NOTE(make_inverse_conditional_requirement_explicit,none, "specify that the conformance requires %0 to conform to %1", (Type, const ProtocolDecl *)) // -- older ones below -- ERROR(noncopyable_parameter_requires_ownership, none, "parameter of noncopyable type %0 must specify ownership", (Type)) ERROR(noncopyable_parameter_subscript_unsupported, none, "subscripts cannot have noncopyable parameters yet", ()) NOTE(noncopyable_parameter_ownership_suggestion, none, "add '%0' %1", (StringRef, StringRef)) ERROR(ownership_specifier_nonescaping_closure,none, "'%0' cannot be applied to nonescaping closure", (StringRef)) ERROR(noncopyable_generics_variadic, none, "noncopyable type %0 cannot be used within a variadic type yet", (Type)) NOTE(noncopyable_generics_implicit_conformance_req, none, "'where %noformat0: %noformat1' is implicit here", (Type, Type)) NOTE(noncopyable_generics_implicit_composition, none, "'%noformat0 & %noformat1' is implicit here", (Type, Type)) ERROR(noncopyable_effectful_getter,none, "%kindonly0 of noncopyable type cannot be 'async' or 'throws'", (const AccessorDecl *)) ERROR(noncopyable_enums_do_not_support_indirect,none, "noncopyable enum %0 cannot be marked indirect or have indirect cases yet", (Identifier)) ERROR(noncopyable_cast,none, "noncopyable types cannot be conditionally cast", ()) ERROR(noncopyable_objc_enum, none, "noncopyable enums cannot be marked '@objc'", ()) ERROR(moveOnly_not_allowed_here,none, "'@_moveOnly' attribute is only valid on structs or enums", ()) ERROR(moveOnly_deprecated,none, "'@_moveOnly' attribute is deprecated and will be removed; use '~Copyable' instead", ()) ERROR(consume_expression_needed_for_cast,none, "implicit conversion to %0 is consuming", (Type)) NOTE(add_consume_to_silence,none, "add 'consume' to make consumption explicit", ()) WARNING(consume_of_bitwisecopyable_noop,none, "'consume' applied to bitwise-copyable type %0 has no effect", (Type)) ERROR(consume_expression_not_passed_lvalue,none, "'consume' can only be applied to a local binding ('let', 'var', or parameter)", ()) ERROR(consume_expression_partial_copyable,none, "'consume' can only be used to partially consume storage of a noncopyable type", ()) ERROR(consume_expression_non_storage,none, "'consume' can only be used to partially consume storage", ()) NOTE(note_consume_expression_non_storage_call,none, "non-storage produced by this call", ()) NOTE(note_consume_expression_non_storage_subscript,none, "non-storage produced by this subscript", ()) NOTE(note_consume_expression_non_storage_property,none, "non-storage produced by this computed property", ()) ERROR(borrow_expression_not_passed_lvalue,none, "'borrow' can only be applied to a local binding ('let', 'var', or parameter)", ()) ERROR(copy_expression_not_passed_lvalue,none, "'copy' can only be applied to a local binding ('let', 'var', or parameter)", ()) ERROR(copy_expression_cannot_be_used_with_noncopyable_types,none, "'copy' cannot be applied to noncopyable types", ()) // Experimental noncopyable feature diagnostics: ERROR(experimental_moveonly_feature_can_only_be_used_when_enabled, none, "Can not use feature when experimental move only is disabled! Pass" " the frontend flag -enable-experimental-move-only to swift to enable " "the usage of this language feature", ()) ERROR(noimplicitcopy_attr_valid_only_on_local_let_params, none, "'@_noImplicitCopy' attribute can only be applied to local lets and params", ()) ERROR(noimplicitcopy_attr_not_allowed_on_moveonlytype,none, "'@_noImplicitCopy' has no effect when applied to a noncopyable type", ()) ERROR(noncopyable_types_cannot_be_resilient, none, "noncopyable %kind0 must be '@frozen' in library evolution mode; " "non-'@frozen' public and '@usableFromInline' noncopyable types are not " "supported", (const ValueDecl *)) ERROR(noncopyable_cannot_have_read_set_accessor,none, "noncopyable %select{variable|subscript}0 cannot provide a read and set accessor", (unsigned)) //------------------------------------------------------------------------------ // MARK: Init accessors //------------------------------------------------------------------------------ ERROR(init_accessor_can_refer_only_to_properties,none, "init accessor cannot refer to %kind0; init accessors can refer only" " to stored properties", (const ValueDecl *)) ERROR(storage_restrictions_attribute_not_on_init_accessor,none, "'@storageRestrictions' could only be used with init accessors", ()) ERROR(init_accessor_property_both_init_and_accessed,none, "property %0 cannot be both initialized and accessed", (DeclName)) ERROR(invalid_use_of_self_in_init_accessor,none, "'self' within init accessors can only be used to reference " "properties listed in 'initializes' and 'accesses'; " "init accessors are run before 'self' is fully available", ()) ERROR(init_accessor_invalid_member_ref,none, "cannot reference instance member %0; init accessors can only " "refer to instance properties listed in 'initializes' and " "'accesses' attributes", (DeclNameRef)) ERROR(cannot_synthesize_memberwise_due_to_property_init_order,none, "cannot synthesize memberwise initializer", ()) NOTE(out_of_order_access_in_init_accessor,none, "init accessor for %0 cannot access stored property %1 because it " "is called before %1 is initialized", (Identifier, Identifier)) //------------------------------------------------------------------------------ // MARK: Reference Bindings Errors //------------------------------------------------------------------------------ ERROR(referencebindings_binding_must_have_initial_value,none, "%0 bindings must have an initial value", (StringRef)) ERROR(referencebindings_binding_must_be_to_lvalue,none, "%0 bindings must be bound to an lvalue", (StringRef)) //------------------------------------------------------------------------------ // MARK: Pack Iteration Diagnostics //------------------------------------------------------------------------------ ERROR(pack_iteration_where_clause_not_supported, none, "'where' clause in pack iteration is not supported", ()) //------------------------------------------------------------------------------ // MARK: Lifetime Dependence Syntax //------------------------------------------------------------------------------ WARNING(use_lifetime_underscored, PointsToFirstBadToken, "Unsupported use of @lifetime, use @_lifetime to specify lifetime dependencies", ()) ERROR(lifetime_dependence_invalid_param_name, none, "invalid parameter name specified %0", (Identifier)) ERROR(lifetime_dependence_invalid_param_index, none, "invalid parameter index specified '%0'", (unsigned)) ERROR(lifetime_dependence_invalid_self_in_static, none, "invalid lifetime dependence specifier on non-existent self", ()) ERROR(lifetime_dependence_invalid_self_in_init, none, "invalid lifetime dependence on self in an initializer", ()) ERROR(lifetime_dependence_duplicate_param_id, none, "duplicate lifetime dependence specifier", ()) ERROR(lifetime_dependence_cannot_use_kind, none, "invalid use of %0 lifetime dependence for %1 ownership", (StringRef, StringRef)) ERROR(lifetime_dependence_cannot_use_parsed_scoped_consuming, none, "invalid use of scoped lifetime dependence with consuming ownership", ()) ERROR(lifetime_dependence_only_on_function_method_init_result, none, "lifetime dependence specifiers may only be used on result of " "functions, methods, initializers", ()) ERROR(lifetime_dependence_ctor_non_self_or_nil_return, none, "expected 'nil' or 'self' as return values in an initializer with " "lifetime dependent specifiers", ()) ERROR(lifetime_dependence_cannot_be_applied_to_tuple_elt, none, "lifetime dependence specifiers cannot be applied to tuple elements", ()) ERROR(lifetime_dependence_immortal_conflict_name, none, "conflict between the parameter name and 'immortal' contextual keyword", ()) ERROR(lifetime_dependence_function_type, none, "lifetime dependencies on function types are not supported", ()) ERROR(lifetime_dependence_immortal_alone, none, "cannot specify any other dependence source along with immortal", ()) ERROR(lifetime_dependence_invalid_inherit_escapable_type, none, "cannot copy the lifetime of an Escapable type, use " "'@_lifetime(%0%1)' instead", (StringRef, StringRef)) ERROR(lifetime_dependence_parsed_borrow_with_ownership, none, "invalid use of %0 dependence with %1 ownership", (StringRef, StringRef)) NOTE(lifetime_dependence_parsed_borrow_with_ownership_fix, none, "use '@_lifetime(%0%1)' instead", (StringRef, StringRef)) ERROR(lifetime_dependence_cannot_use_default_escapable_consuming, none, "invalid lifetime dependence on an Escapable value with %0 ownership", (StringRef)) ERROR(lifetime_dependence_cannot_use_parsed_borrow_inout, none, "invalid use of inout dependence on the same inout parameter", ()) ERROR(lifetime_dependence_duplicate_target, none, "invalid duplicate target lifetime dependencies on function", ()) ERROR(lifetime_parameter_requires_inout, none, "lifetime-dependent parameter '%0' must be 'inout'", (StringRef)) ERROR(lifetime_target_requires_nonescapable, none, "invalid lifetime dependence on an Escapable %0", (StringRef)) //------------------------------------------------------------------------------ // MARK: Lifetime Dependence Requirements //------------------------------------------------------------------------------ ERROR(lifetime_dependence_feature_required_return, none, "%0 cannot return a ~Escapable result", (StringRef)) ERROR(lifetime_dependence_feature_required_mutating, none, "%0 cannot have a ~Escapable 'self'", (StringRef)) ERROR(lifetime_dependence_feature_required_inout, none, "%0 cannot have a ~Escapable 'inout' parameter '%1' in addition to other ~Escapable parameters", // this arg list must be compatible with // lifetime_dependence_cannot_infer_inout (StringRef, StringRef)) ERROR(lifetime_dependence_cannot_infer_return, none, "%0 with a ~Escapable result requires '@_lifetime(...)'", (StringRef)) ERROR(lifetime_dependence_cannot_infer_mutating, none, "%0 with a ~Escapable 'self' requires '@_lifetime(self: ...)'", (StringRef)) ERROR(lifetime_dependence_cannot_infer_inout, none, "%0 with a ~Escapable 'inout' parameter requires '@_lifetime(%1: ...)'", (StringRef, StringRef)) //------------------------------------------------------------------------------ // MARK: Lifetime Dependence Inference - refinements to the requirements above //------------------------------------------------------------------------------ ERROR(lifetime_dependence_cannot_infer_return_no_param, none, "%0 with a ~Escapable result needs a parameter to depend on", (StringRef)) NOTE(lifetime_dependence_cannot_infer_return_immortal, none, "'@_lifetime(immortal)' can be used to indicate that values produced by " "this initializer have no lifetime dependencies", ()) ERROR(lifetime_dependence_cannot_infer_bitwisecopyable, none, "cannot infer lifetime dependence on %0 because '%1' is BitwiseCopyable, " "specify '@_lifetime(borrow self)'", (StringRef, StringRef)) ERROR(lifetime_dependence_cannot_infer_kind, none, "cannot infer the lifetime dependence scope on %0 with a ~Escapable " "parameter, specify '@_lifetime(borrow %1)' or '@_lifetime(copy %1)'", (StringRef, StringRef)) ERROR(lifetime_dependence_cannot_infer_scope_ownership, none, "cannot borrow the lifetime of '%0', which has consuming ownership on %1", (StringRef, StringRef)) NOTE(lifetime_dependence_cannot_infer_inout_suggest, none, "use '@_lifetime(%0: copy %0) to forward the inout dependency", (StringRef)) ERROR(lifetime_dependence_cannot_infer_implicit_init, none, "cannot infer implicit initialization lifetime. Add an initializer with " "'@_lifetime(...)' for each parameter the result depends on", ()) //------------------------------------------------------------------------------ // MARK: Lifetime Dependence Experimental Inference //------------------------------------------------------------------------------ ERROR(lifetime_dependence_cannot_infer_no_candidates, none, "cannot infer lifetime dependence%0, no parameters found that are either " "~Escapable or Escapable with a borrowing ownership", (StringRef)) ERROR(lifetime_dependence_cannot_infer_ambiguous_candidate, none, "cannot infer lifetime dependence%0, multiple parameters qualify as a candidate", (StringRef)) //===----------------------------------------------------------------------===// // MARK: Sending //===----------------------------------------------------------------------===// ERROR(sending_only_on_parameters_and_results, none, "'sending' may only be used on parameters and results", ()) ERROR(sending_cannot_be_applied_to_tuple_elt, none, "'sending' cannot be applied to tuple elements", ()) ERROR(sending_function_wrong_sending,none, "converting a value of type %0 to type %1 risks causing data races", (Type, Type)) NOTE(sending_function_param_with_sending_param_note, none, "converting a function typed value with a sending parameter to one " "without risks allowing actor-isolated values to escape their isolation " "domain as an argument to an invocation of value", ()) NOTE(sending_function_result_with_sending_param_note, none, "converting a function typed value without a sending result as one with " "risks allowing actor-isolated values to escape their " "isolation domain through a result of an invocation of value", ()) //------------------------------------------------------------------------------ // MARK: Strict Memory Safety Diagnostics //------------------------------------------------------------------------------ NOTE(note_reference_to_unsafe_decl,none, "%select{reference|call}0 to unsafe %kind1", (bool, const ValueDecl *)) NOTE(note_reference_to_unsafe_typed_decl,none, "%select{reference|call}0 to %kind1 involves unsafe type %2", (bool, const ValueDecl *, Type)) NOTE(note_unsafe_call_decl_argument_named,none, "argument %1 in call to %kindbase0 has unsafe type %2", (const ValueDecl *, Identifier, Type)) NOTE(note_unsafe_call_decl_argument_indexed,none, "argument #%1 in call to %kindbase0 has unsafe type %2", (const ValueDecl *, unsigned, Type)) NOTE(note_unsafe_call_argument_indexed,none, "argument #%0 in call has unsafe type %1", (unsigned, Type)) NOTE(note_reference_to_unsafe_through_typealias,none, "reference to %kind0 whose underlying type involves unsafe type %1", (const ValueDecl *, Type)) NOTE(note_reference_to_unsafe_type,none, "reference to unsafe type %0", (Type)) NOTE(note_reference_to_nonisolated_unsafe,none, "reference to nonisolated(unsafe) %kind0 is unsafe in concurrently-executing code", (const ValueDecl *)) NOTE(note_reference_unowned_unsafe,none, "reference to unowned(unsafe) %kind0 is unsafe", (const ValueDecl *)) NOTE(note_reference_exclusivity_unchecked,none, "reference to '@exclusivity(unchecked)' %kind0 is unsafe", (const ValueDecl *)) NOTE(note_use_of_unsafe_conformance_is_unsafe,none, "'@unsafe' conformance of %0 to %kind1 involves unsafe code", (Type, const ValueDecl *)) NOTE(note_unsafe_storage,none, "%kindbase1 involves unsafe type %2", (bool, const ValueDecl *, Type)) NOTE(note_unsafe_temporarily_escaping,none, "'withoutActuallyEscaping' function of type %0 is unsafe", (Type)) GROUPED_WARNING(decl_unsafe_storage,StrictMemorySafety,none, "%kindbase0 has storage involving unsafe types", (const Decl *)) NOTE(decl_storage_mark_unsafe,none, "add '@unsafe' if this type is also unsafe to use", ()) NOTE(decl_storage_mark_safe,none, "add '@safe' if this type encapsulates the unsafe storage in " "a safe interface", ()) ERROR(safe_and_unsafe_attr,none, "%kindbase0 cannot be both '@safe' and '@unsafe'", (const Decl *)) GROUPED_WARNING(unsafe_superclass,StrictMemorySafety,none, "%kindbase0 has superclass involving unsafe type %1", (const ValueDecl *, Type)) GROUPED_WARNING(conformance_involves_unsafe,StrictMemorySafety,none, "conformance of %0 to %kind1 involves unsafe code; use '@unsafe' to " "indicate that the conformance is not memory-safe", (Type, const ValueDecl *)) NOTE(note_witness_unsafe,none, "unsafe %kind0 cannot satisfy safe requirement", (const ValueDecl *)) NOTE(note_type_witness_unsafe,none, "unsafe type %0 cannot satisfy safe associated type %1", (Type, DeclName)) GROUPED_WARNING(override_safe_with_unsafe,StrictMemorySafety,none, "override of safe %kindonly0 with unsafe %kindonly0", (const Decl *)) GROUPED_WARNING(preconcurrency_import_unsafe,StrictMemorySafety,none, "'@preconcurrency' import is not memory-safe because it can silently " "introduce data races; add '@unsafe' to indicate that this is unsafe", ()) GROUPED_WARNING(unsafe_without_unsafe,StrictMemorySafety,none, "expression uses unsafe constructs but is not marked with 'unsafe'", ()) GROUPED_WARNING(for_unsafe_without_unsafe,StrictMemorySafety,none, "for-in loop uses unsafe constructs but is not marked with 'unsafe'", ()) WARNING(no_unsafe_in_unsafe,none, "no unsafe operations occur within 'unsafe' expression", ()) WARNING(no_unsafe_in_unsafe_for,none, "no unsafe operations occur within 'unsafe' for-in loop", ()) NOTE(make_subclass_unsafe,none, "make class %0 '@unsafe' to allow unsafe overrides of safe superclass " "methods", (DeclName)) //===----------------------------------------------------------------------===// // MARK: Value Generics //===----------------------------------------------------------------------===// ERROR(cannot_pass_type_for_value_generic,none, "cannot pass type %0 as a value for generic value %1", (Type, Type)) ERROR(value_type_used_in_type_parameter,none, "cannot use value type %0 for generic argument %1", (Type, Type)) ERROR(invalid_value_type_value_generic,none, "%0 is not a supported value type for %1", (Type, Type)) ERROR(invalid_value_generic_conformance,none, "value generic type %0 cannot conform to protocol %1", (Type, Type)) ERROR(invalid_value_generic_same_type,none, "cannot constrain value parameter %0 to be type %1", (Type, Type)) ERROR(integer_type_not_accepted,none, "integer unexpectedly used in a type position", ()) ERROR(value_generic_unexpected,none, "using value generic %0 here is not allowed", (Type)) ERROR(missing_value_generic_type,none, "value generic %0 must have an explicit value type declared", (Identifier)) ERROR(availability_value_generic_type_only_version_newer, none, "values in generic types are only available in %0 %1 or newer", (AvailabilityDomain, AvailabilityRange)) ERROR(invalid_value_for_type_same_type,none, "cannot constrain type parameter %0 to be integer %1", (Type, Type)) //===----------------------------------------------------------------------===// // MARK: InlineArray //===----------------------------------------------------------------------===// ERROR(inlinearray_literal_incorrect_count,none, "expected %0 elements in inline array literal, but got %1", (Type, Type)) ERROR(inline_array_type_backwards,none, "element count must precede inline array element type", ()) //===----------------------------------------------------------------------===// // MARK: Embedded Swift //===----------------------------------------------------------------------===// GROUPED_ERROR(weak_unowned_in_embedded_swift, EmbeddedRestrictions, none, "attribute %0 cannot be used in Embedded Swift", (ReferenceOwnership)) GROUPED_WARNING(untyped_throws_in_embedded_swift, EmbeddedRestrictions, DefaultIgnore, "untyped throws is not available in Embedded Swift; add a thrown error type with '(type)'", ()) GROUPED_ERROR(generic_nonfinal_in_embedded_swift, EmbeddedRestrictions, none, "generic %kind0 in a class %select{must be 'final'|cannot be 'required'}1 in Embedded Swift", (const Decl *, bool)) GROUPED_WARNING(use_generic_member_of_existential_in_embedded_swift, EmbeddedRestrictions, DefaultIgnore, "cannot use generic %kind0 on a value of type %1 in Embedded Swift", (const Decl *, Type)) //===----------------------------------------------------------------------===// // MARK: @abi Attribute //===----------------------------------------------------------------------===// ERROR(attr_abi_mismatched_kind,none, "cannot give %kind0 the ABI of a %kindonly1", (const Decl *, const Decl *)) ERROR(attr_abi_mismatched_arity,none, "cannot give %kind0 the ABI of a %kindonly0 with a different number of " "%select{|generic }1parameters", (Decl *, /*genericParams=*/bool)) ERROR(attr_abi_mismatched_throws,none, "cannot give %0 the ABI of a %kindonly0 which %select{cannot|can}1 throw", (Decl *, /*abiCanThrow=*/bool)) ERROR(attr_abi_mismatched_async,none, "cannot give %0 the ABI of %select{a non-async|an async}1 %kindonly0", (Decl *, /*abiIsAsync=*/bool)) ERROR(attr_abi_multiple_vars,none, "'abi' attribute can only be applied to a single %0; declare each " "%0 separately", (DescriptiveDeclKind)) ERROR(attr_abi_incompatible_with_silgen_name,none, "cannot use '@_silgen_name' and '@abi' on the same %kindonly0 because " "they serve the same purpose", (const Decl *)) ERROR(attr_abi_missing_attr,none, "missing '%0' %select{attribute|modifier}1 in '@abi'", (StringRef, bool)) ERROR(attr_abi_extra_attr,none, "extra %select{|implicit }2'%0' %select{attribute|modifier}1 in '@abi'", (StringRef, bool, /*isImplicit=*/bool)) ERROR(attr_abi_forbidden_attr,none, "unused '%0' %select{attribute|modifier}1 in '@abi'", (StringRef, bool)) ERROR(attr_abi_mismatched_attr,none, "'%0' %select{attribute|modifier}1 in '@abi' should match '%2'", (StringRef, bool, StringRef)) NOTE(attr_abi_matching_attr_here,none, "%select{should match|matches}0 %select{attribute|modifier}1 " "%select{|implicitly added }2here", (/*matches=*/bool, /*isModifier=*/bool, /*isImplicit=*/bool)) #define TYPE_ORIGIN(KIND_IDX, DECL_IDX) "%select{|%kind" #DECL_IDX " |" \ "self parameter |result |thrown |%error}" #KIND_IDX ERROR(attr_abi_mismatched_type,none, TYPE_ORIGIN(0, 1) "type %2 in '@abi' should match %3", (unsigned, Decl *, Type, Type)) NOTE(attr_abi_should_match_type_here,none, "should match type here", ()) ERROR(attr_abi_mismatched_generic_signature,none, "generic signature '%0' in '@abi' is not compatible with '%1'", (StringRef, StringRef)) ERROR(attr_abi_missing_generic_signature,none, "declaration in '@abi' should have generic signature compatible with " "'%0'", (StringRef)) ERROR(attr_abi_extra_generic_signature,none, "declaration in '@abi' should not have generic signature because %0 " "is not generic", (Decl *)) ERROR(attr_abi_mismatched_param_modifier,none, "%select{default |}0%select{attribute|modifier}2 %select{|'%0' }0" "on " TYPE_ORIGIN(3, 4) "in '@abi' is not compatible with " "%select{default|'%1'}1", (StringRef, StringRef, /*isModifier=*/bool, unsigned, Decl *)) ERROR(attr_abi_no_default_arguments,none, "%kind0 in '@abi' should not have a default argument; it does not " "affect the parameter's ABI", (Decl *)) ERROR(attr_abi_no_macros,none, "%kind0 cannot be expanded in '@abi' attribute", (Decl *)) ERROR(attr_abi_no_lazy,none, "'lazy' is not compatible with '@abi' attribute", ()) // These macros insert 'final', 'non-final', or nothing depending on both the // current decl and its counterpart, such that 'non-final' is used if the // counterpart would be described as 'final' or 'static'. They must be kept in // sync with `StaticnessAndFinality`. #define NONFINAL_OR_NOTHING(COUNTERPART) \ "%select{||non-final |non-final |non-final |%error}" #COUNTERPART #define FINAL_OR_NONFINAL_OR_NOTHING(CURRENT, COUNTERPART, FINAL_OK) \ "%select{|%select{" NONFINAL_OR_NOTHING(COUNTERPART) \ "|" NONFINAL_OR_NOTHING(COUNTERPART) \ "|final |final ||%error}" #CURRENT "}" #FINAL_OK ERROR(attr_abi_static_final_mismatch,none, FINAL_OR_NONFINAL_OR_NOTHING(0, 2, 4) "%kind1 in '@abi' should be " FINAL_OR_NONFINAL_OR_NOTHING(2, 0, 4) "%kindonly3 to ensure ABI " "compatibility", (uint8_t, Decl *, uint8_t, Decl *, /*isClass=*/bool)) #undef NONFINAL_OR_NOTHING #undef FINAL_OR_NONFINAL_OR_NOTHING ERROR(attr_abi_failable_mismatch,none, "cannot give %select{non-failable|failable}1 %kind0 the ABI of a " "%select{non-failable|failable}2 %kindonly0", (Decl *, bool, bool)) //===----------------------------------------------------------------------===// // MARK: Isolated conformances //===----------------------------------------------------------------------===// NOTE(note_isolate_conformance_to_global_actor,none, "isolate this conformance to the %select{global actor %0|main actor}1 " "with '@%2'", (Type, bool, StringRef)) NOTE(note_depends_on_isolated_conformance,none, "conformance depends on %0 conformance of %1 to %kind2", (ActorIsolation, Type, const ValueDecl *)) GROUPED_ERROR(isolated_conformance_with_sendable,IsolatedConformances,none, "%4 conformance of %0 to %1 cannot satisfy conformance " "requirement for a %select{'Sendable'|'SendableMetatype'}2 type " "parameter %3", (Type, DeclName, bool, Type, ActorIsolation)) GROUPED_ERROR(isolated_conformance_with_sendable_simple,IsolatedConformances, none, "%2 conformance of %0 to %1 cannot satisfy " "conformance requirement for a 'Sendable' type parameter ", (Type, DeclName, ActorIsolation)) GROUPED_ERROR(isolated_conformance_wrong_domain,IsolatedConformances,none, "%0 conformance of %1 to %2 cannot be used in %3 context", (ActorIsolation, Type, DeclName, ActorIsolation)) GROUPED_WARNING(isolated_conformance_will_become_nonisolated,IsolatedConformances,none, "conformance of %0 to %1 should be marked 'nonisolated' to retain its behavior with upcoming feature 'InferIsolatedConformances'", (const ValueDecl *, const ValueDecl *)) GROUPED_ERROR(isolated_conformance_to_sendable_metatype,IsolatedConformances,none, "cannot form %0 conformance of %1 to SendableMetatype-inheriting %kind2", (ActorIsolation, Type, const ValueDecl *)) //===----------------------------------------------------------------------===// // MARK: @_inheritActorContext //===----------------------------------------------------------------------===// ERROR(inherit_actor_context_only_on_func_types,none, "%0 only applies to parameters with function types (got: %1)", (DeclAttribute, Type)) ERROR(inherit_actor_context_only_on_sending_or_Sendable_params,none, "%0 only applies to 'sending' parameters or parameters with " "'@Sendable' function types", (DeclAttribute)) ERROR(inherit_actor_context_only_on_async_or_isolation_erased_params,none, "%0 only applies to '@isolated(any)' parameters or parameters with " "asynchronous function types", (DeclAttribute)) //===----------------------------------------------------------------------===// // MARK: @concurrent and nonisolated(nonsending) attributes //===----------------------------------------------------------------------===// ERROR(execution_behavior_only_on_async,none, "cannot use %0 on non-async %kind1", (DeclAttribute, ValueDecl *)) ERROR(cannot_specify_execution_behavior_for_decl,none, "%0 is only applicable to asynchronous functions, " "initializers, subscripts and computed properties", (DeclAttribute)) ERROR(execution_behavior_only_on_async_closure,none, "cannot use %0 on non-async closure", (DeclAttribute)) ERROR(execution_behavior_type_attr_only_on_async,none, "cannot use '@%0' on non-async function type", (StringRef)) ERROR(nonisolated_nonsending_only_on_function_types, none, "%0 may only be used on function types", (TypeRepr *)) ERROR(nonisolated_nonsending_only_on_async,none, "cannot use %0 on non-async function type", (TypeRepr *)) ERROR(cannot_use_nonisolated_nonsending_together_with_concurrent,none, "cannot use %0 together with '@concurrent'", (TypeRepr *)) ERROR(execution_behavior_incompatible_isolated_parameter,none, "cannot use %0 on %kind1 because it has " "an isolated parameter: %2", (DeclAttribute, ValueDecl *, ValueDecl *)) ERROR(execution_behavior_attr_incompatible_with_global_isolation,none, "cannot use %0 because function type is isolated to a global actor %1", (DeclAttribute, Type)) ERROR(execution_behavior_attr_incompatible_with_isolated_param,none, "cannot use %0 together with an isolated parameter", (DeclAttribute)) ERROR(execution_behavior_type_attr_incompatible_with_global_isolation,none, "cannot use '@%0' because function type is isolated to a global actor %1", (StringRef, Type)) ERROR(nonisolated_nonsending_incompatible_with_global_isolation,none, "cannot use %0 because function type is isolated to a global actor %1", (TypeRepr *, Type)) ERROR(execution_behavior_type_attr_incompatible_with_isolated_param,none, "cannot use '@%0' together with an isolated parameter", (StringRef)) ERROR(nonisolated_nonsending_incompatible_with_isolated_param,none, "cannot use %0 together with an isolated parameter", (TypeRepr *)) ERROR(execution_behavior_type_attr_incompatible_with_isolated_any,none, "cannot use '@%0' together with '@isolated(any)'", (StringRef)) ERROR(nonisolated_nonsending_incompatible_with_isolated_any,none, "cannot use %0 together with '@isolated(any)'", (TypeRepr *)) ERROR(invalid_function_conversion_with_non_sendable,none, "cannot convert %0 to %1 because crossing of an isolation boundary " "requires parameter and result types to conform to 'Sendable' protocol", (Type, Type)) NOTE(type_does_not_conform_to_Sendable,none, "type %0 does not conform to 'Sendable' protocol", (Type)) GROUPED_WARNING( attr_execution_nonisolated_behavior_will_change_decl, NonisolatedNonsendingByDefault, none, "feature '%0' will cause nonisolated async %kindbase1 to run on the " "caller's actor; use '@concurrent' to preserve behavior", (StringRef, const AbstractFunctionDecl *)) GROUPED_WARNING( attr_execution_nonisolated_behavior_will_change_closure, NonisolatedNonsendingByDefault, none, "feature '%0' will cause nonisolated async closure to run on the caller's " "actor; use '@concurrent' to preserve behavior", (StringRef)) GROUPED_WARNING( attr_execution_nonisolated_behavior_will_change_typerepr, NonisolatedNonsendingByDefault, none, "feature '%0' will cause nonisolated async function type to be treated as " "specified to run on the caller's actor; use '@concurrent' to preserve " "behavior", (StringRef)) //===----------------------------------------------------------------------===// // MARK: @nonexhaustive and @preEnumExtensibility Attributes //===----------------------------------------------------------------------===// ERROR(nonexhaustive_attr_on_frozen_type,none, "cannot use '@nonexhaustive' together with '@frozen'", ()) ERROR(nonexhaustive_attr_on_internal_type,none, "'@nonexhaustive' attribute can only be applied to public or package " "declarations, but %0 is " "%select{private|fileprivate|internal|%error|%error|%error}1", (DeclName, AccessLevel)) //===----------------------------------------------------------------------===// // MARK: `using` declaration //===----------------------------------------------------------------------===// ERROR(invalid_redecl_of_file_isolation,none, "invalid redeclaration of file-level default actor isolation", ()) NOTE(invalid_redecl_of_file_isolation_prev,none, "default isolation was previously declared here", ()) #define UNDEFINE_DIAGNOSTIC_MACROS #include "DefineDiagnosticMacros.h"