//===--- DiagnosticsSIL.def - Diagnostics Text ------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 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 SIL (dataflow) analysis. // 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" // SILGen issues. WARNING(return_borrowing_switch_binding,none, "returning the non-'Copyable' value of a pattern binding from a " "switch that borrows by default; the switch will be performed as a " "consume for compatibility for now, but this will require an explicit " "'switch consume' in the future", ()) ERROR(bridging_module_missing,none, "unable to find module '%0' for implicit conversion function '%0.%1'", (StringRef, StringRef)) ERROR(bridging_function_missing,none, "unable to find implicit conversion function '%0.%1'", (StringRef, StringRef)) ERROR(bridging_function_overloaded,none, "multiple definitions of implicit conversion function '%0.%1'", (StringRef, StringRef)) ERROR(bridging_function_not_function,none, "definition of implicit conversion function '%0.%1' is not a function", (StringRef, StringRef)) ERROR(bridging_function_not_correct_type,none, "definition of implicit conversion function '%0.%1' is not of the correct" " type", (StringRef, StringRef)) ERROR(bridging_objcbridgeable_missing,none, "cannot find definition of '_ObjectiveCBridgeable' protocol", ()) ERROR(bridging_objcbridgeable_broken,none, "broken definition of '_ObjectiveCBridgeable' protocol: missing %0", (DeclName)) ERROR(sil_function_redefinition,none, "multiple definitions of symbol '%0'", (StringRef)) NOTE(sil_function_redefinition_note,none, "other definition here", ()) ERROR(invalid_sil_builtin,none, "INTERNAL ERROR: invalid use of builtin: %0", (StringRef)) ERROR(could_not_find_bridge_type,none, "could not find Objective-C bridge type for type %0; " "did you forget to import Foundation?", (Type)) ERROR(could_not_find_pointer_pointee_property,none, "could not find 'pointee' property of pointer type %0", (Type)) ERROR(writeback_overlap_property,none, "inout writeback to computed property %0 occurs in multiple arguments to" " call, introducing invalid aliasing", (Identifier)) ERROR(writeback_overlap_subscript,none, "inout writeback through subscript occurs in multiple arguments to call," " introducing invalid aliasing", ()) NOTE(writebackoverlap_note,none, "concurrent writeback occurred here", ()) ERROR(inout_argument_alias,none, "inout arguments are not allowed to alias each other", ()) NOTE(previous_inout_alias,none, "previous aliasing argument", ()) ERROR(unimplemented_generator_witnesses,none, "protocol conformance emission for generator coroutines is unimplemented", ()) ERROR(exclusivity_access_required,none, "overlapping accesses to %0, but " "%select{initialization|read|modification|deinitialization}1 requires " "exclusive access; " "%select{consider copying to a local variable|" "consider calling MutableCollection.swapAt(_:_:)}2", (StringRef, unsigned, bool)) ERROR(exclusivity_access_required_unknown_decl,none, "overlapping accesses, but " "%select{initialization|read|modification|deinitialization}0 requires " "exclusive access; consider copying to a local variable", (unsigned)) ERROR(exclusivity_access_required_moveonly,none, "overlapping accesses to %0, but " "%select{initialization|read|modification|deinitialization}1 requires " "exclusive access", (StringRef, unsigned)) ERROR(exclusivity_access_required_unknown_decl_moveonly,none, "overlapping accesses, but " "%select{initialization|read|modification|deinitialization}0 requires " "exclusive access", (unsigned)) NOTE(exclusivity_conflicting_access,none, "conflicting access is here", ()) ERROR(unsupported_sil_builtin,none, "builtin '%0' is not supported by SIL generation", (StringRef)) ERROR(unsupported_c_function_pointer_conversion,none, "C function pointer signature %0 is not compatible with expected type %1", (Type, Type)) ERROR(c_function_pointer_from_function_with_context,none, "a C function pointer cannot be formed from a " "%select{local function|closure}0 that captures " "%select{context|generic parameters|dynamic Self type}1", (bool, unsigned)) ERROR(objc_selector_malformed,none,"the type ObjectiveC.Selector is malformed", ()) ERROR(unsupported_variadic_function_abstraction,none, "cannot fully abstract a value of variadic function type %0 because " "different contexts will not be able to reliably agree on a calling " "convention; try wrapping it in a struct", (Type)) ERROR(function_type_mismatch,none, "function type mismatch, declared as %0 but used as %1", (Type, Type)) NOTE(function_declared_here,none, "function declared here", ()) ERROR(deserialize_function_type_mismatch,Fatal, "type mismatch of function '%0', declared as %1 but used in a swift module as %2", (StringRef, Type, Type)) ERROR(without_actually_escaping_on_isolated_any,none, "withoutActuallyEscaping is currently unimplemented for '@isolated(any)' " "function values", ()) // Capture before declaration diagnostics. ERROR(capture_before_declaration,none, "closure captures %0 before it is declared", (Identifier)) NOTE(captured_value_declared_here,none, "captured value declared here", ()) #define SELECT_ESCAPING_CLOSURE_KIND "escaping %select{local function|closure|autoclosure}0" // Invalid escaping capture diagnostics. ERROR(escaping_inout_capture,none, SELECT_ESCAPING_CLOSURE_KIND " captures 'inout' parameter %1", (unsigned, Identifier)) NOTE(inout_param_defined_here,none, "parameter %0 is declared 'inout'", (Identifier)) ERROR(escaping_mutable_self_capture,none, SELECT_ESCAPING_CLOSURE_KIND " captures mutating 'self' parameter", (unsigned)) ERROR(escaping_noescape_param_capture,none, SELECT_ESCAPING_CLOSURE_KIND " captures non-escaping parameter %1", (unsigned, Identifier)) NOTE(noescape_param_defined_here,none, "parameter %0 is implicitly non-escaping", (Identifier)) ERROR(escaping_noescape_var_capture,none, SELECT_ESCAPING_CLOSURE_KIND " captures non-escaping value", (unsigned)) NOTE(value_captured_here,none,"captured here", ()) NOTE(copy_inout_captured_by_autoclosure,none, "pass a copy of %0", (Identifier)) NOTE(copy_self_captured_by_autoclosure,none, "pass a copy of 'self'", ()) #undef SELECT_ESCAPING_CLOSURE_KIND NOTE(value_captured_transitively,none, "captured indirectly by this call", ()) ERROR(err_noescape_param_call,none, "passing a %select{|closure which captures a }1non-escaping function " "parameter %0 to a call to a non-escaping function parameter can allow " "re-entrant modification of a variable", (DeclName, unsigned)) // Definite initialization diagnostics. NOTE(variable_defined_here,none, "%select{variable|constant}0 defined here", (bool)) ERROR(variable_used_before_initialized,none, "%select{variable|constant}1 '%0' used before being initialized", (StringRef, bool)) ERROR(variable_inout_before_initialized,none, "%select{variable|constant}1 '%0' passed by reference before being" " initialized", (StringRef, bool)) ERROR(variable_closure_use_uninit,none, "%select{variable|constant}1 '%0' captured by a closure before being" " initialized", (StringRef, bool)) ERROR(variable_defer_use_uninit,none, "%select{variable|constant}1 '%0' used in defer before being" " initialized", (StringRef, bool)) ERROR(self_closure_use_uninit,none, "'self' captured by a closure before all members were initialized", ()) ERROR(variable_addrtaken_before_initialized,none, "address of %select{variable|constant}1 '%0' taken before it is" " initialized", (StringRef, bool)) ERROR(ivar_not_initialized_at_superinit,none, "property '%0' not initialized at super.init call", (StringRef, bool)) ERROR(ivar_not_initialized_at_implicit_superinit,none, "property '%0' not initialized at implicitly generated super.init call", (StringRef, bool)) ERROR(ivar_not_initialized_by_init_accessor,none, "property %0 not initialized by init accessor", (DeclName)) ERROR(noncopyable_dynamic_lifetime_unsupported,none, "conditional initialization or destruction of noncopyable types is not " "supported; this variable must be consistently in an initialized or " "uninitialized state through every code path", ()) ERROR(self_use_before_fully_init,none, "'self' used in %select{method call|property access}1 %0 before " "%select{all stored properties are initialized|" "'super.init' call|" "'self.init' call}2", (DeclBaseName, bool, unsigned)) ERROR(use_of_self_before_fully_init,none, "'self' used before all stored properties are initialized", ()) NOTE(stored_property_not_initialized,none, "'%0' not initialized", (StringRef)) NOTE(isolated_property_initializer,none, "%1 default value of '%0' cannot be used in a %2 initalizer", (StringRef, ActorIsolation, ActorIsolation)) ERROR(selfinit_multiple_times,none, "'%select{super|self}0.init' called multiple times in initializer", (unsigned)) ERROR(superselfinit_not_called_before_return,none, "'%select{super|self}0.init' isn't called on all paths before returning " "from initializer", (unsigned)) ERROR(self_before_superinit,none, "'self' used before 'super.init' call", ()) ERROR(self_before_selfinit,none, "'self' used before 'self.init' call", ()) ERROR(self_before_selfinit_value_type,none, "'self' used before 'self.init' call or assignment to 'self'", ()) ERROR(self_inside_catch_superselfinit,none, "'self' used inside 'catch' block reachable from " "%select{super|self}0.init call", (unsigned)) ERROR(return_from_init_without_initing_stored_properties,none, "return from initializer without initializing all" " stored properties", ()) ERROR(explicit_store_of_compilerinitialized,none, "illegal assignment to '@_compilerInitialized' storage", ()) ERROR(variable_function_use_uninit,none, "%select{variable|constant}1 '%0' used by function definition before" " being initialized", (StringRef, bool)) ERROR(struct_not_fully_initialized,none, "struct '%0' must be completely initialized before a member is stored to", (StringRef, bool)) ERROR(immutable_property_already_initialized,none, "immutable value '%0' may only be initialized once", (StringRef)) NOTE(initial_value_provided_in_let_decl,none, "initial value already provided in 'let' declaration", ()) ERROR(mutation_of_property_of_immutable_value,none, "cannot mutate %select{property %0|subscript}1 of immutable value '%2'", (DeclBaseName, bool, StringRef)) ERROR(using_mutating_accessor_on_immutable_value,none, "mutating accessor for %select{property %0|subscript}1 may not" " be used on immutable value '%2'", (DeclBaseName, bool, StringRef)) ERROR(mutating_method_called_on_immutable_value,none, "mutating %select{method|operator}1 %0 may not" " be used on immutable value '%2'", (DeclBaseName, unsigned, StringRef)) ERROR(immutable_value_passed_inout,none, "immutable value '%0' must not be passed inout", (StringRef)) ERROR(assignment_to_immutable_value,none, "immutable value '%0' must not be assigned to", (StringRef)) WARNING(designated_init_in_cross_module_extension,none, "initializer for struct %0 must use \"self.init(...)\" or \"self = ...\"" "%select{| on all paths}1 because " "%select{it is not in module %2|the struct was imported from C}3", (Type, bool, Identifier, bool)) NOTE(designated_init_c_struct_fix,none, "use \"self.init()\" to initialize the struct with zero values", ()) // Control flow diagnostics. ERROR(missing_return_closure,none, "missing return in closure expected to return %0", (Type)) ERROR(missing_never_call_closure,none, "closure with uninhabited return type %0 is missing " "call to another never-returning function on all paths", (Type)) ERROR(missing_return_decl,none, "missing return in %kindonly1 expected to return %0", (Type, const AbstractFunctionDecl *)) ERROR(missing_never_call_decl,none, "%kindonly1 with uninhabited return type %0 is missing " "call to another never-returning function on all paths", (Type, const AbstractFunctionDecl *)) NOTE(missing_return_last_expr_note,none, "did you mean to return the last expression?", ()) ERROR(guard_body_must_not_fallthrough,none, "'guard' body must not fall through, consider using a 'return' or 'throw'" " to exit the scope", ()) WARNING(unreachable_code,none, "will never be executed", ()) NOTE(unreachable_code_uninhabited_param_note,none, "'%0' is of type %1 which cannot be constructed because %select{it " "contains %3 which is an enum with no cases|it is an enum with no cases}2", (StringRef, Type, bool, Type)) NOTE(unreachable_code_branch,none, "condition always evaluates to %select{false|true}0", (bool)) NOTE(call_to_noreturn_note,none, "a call to a never-returning function", ()) WARNING(unreachable_code_after_stmt,none, "code after '%select{return|break|continue|throw}0' will never " "be executed", (unsigned)) WARNING(unreachable_case,none, "%select{case|default}0 will never be executed", (bool)) WARNING(switch_on_a_constant,none, "switch condition evaluates to a constant", ()) NOTE(unreachable_code_note,none, "will never be executed", ()) WARNING(warn_infinite_recursive_call,none, "function call causes an infinite recursion", ()) WARNING(warn_dead_weak_store,none, "weak reference will always be nil because the referenced object is " "deallocated here", ()) // performance diagnostics ERROR(performance_dynamic_casting,none, "dynamic casting can lock or allocate", ()) ERROR(performance_metadata,none, "%0 can cause metadata allocation or locks", (StringRef)) ERROR(performance_metadata_type,none, "Using type %0 can cause metadata allocation or locks", (Type)) ERROR(performance_allocating,none, "%0 can cause an allocation", (StringRef)) ERROR(performance_deallocating,none, "%0 can cause an deallocation", (StringRef)) ERROR(performance_deallocating_type,none, "%0 a value of type %1 can cause a deallocation", (StringRef, Type)) ERROR(performance_locking,none, "%0 can cause locking", (StringRef)) ERROR(performance_arc,none, "this code performs reference counting operations which can cause locking", ()) ERROR(performance_objectivec,none, "calls of Objective-C methods can have unpredictable performance", ()) ERROR(performance_unknown_callees,none, "called function is not known at compile time and can have unpredictable performance", ()) ERROR(performance_callee_unavailable,none, "called function is not available in this module and can have unpredictable performance", ()) ERROR(bad_attr_on_non_const_global,none, "global variable must be a compile-time constant to use %0 attribute", (StringRef)) ERROR(global_must_be_compile_time_const,none, "global variable must be a compile-time constant", ()) ERROR(embedded_cannot_specialize_class_method,none, "classes cannot have a non-final, generic method %0 in embedded Swift", (DeclName)) ERROR(embedded_cannot_specialize_witness_method,none, "a protocol type cannot contain a generic method %0 in embedded Swift", (DeclName)) ERROR(cannot_specialize_class,none, "cannot specialize %0 because class definition is not available (make sure to build with -wmo)", (Type)) ERROR(embedded_swift_existential_type,none, "cannot use a value of protocol type %0 in embedded Swift", (Type)) ERROR(embedded_swift_existential_protocol,none, "cannot use a value of protocol type 'any %0' in embedded Swift", (StringRef)) ERROR(embedded_swift_existential,none, "cannot use a value of protocol type in embedded Swift", ()) ERROR(perf_diag_existential_type,none, "cannot use a value of protocol type %0 in '@_noExistential' function", (Type)) ERROR(perf_diag_existential,none, "cannot use a value of protocol type in '@_noExistential' function", ()) ERROR(embedded_swift_value_deinit,none, "cannot de-virtualize deinit of type %0", (Type)) ERROR(embedded_swift_metatype_type,none, "cannot use metatype of type %0 in embedded Swift", (Type)) ERROR(embedded_swift_metatype,none, "cannot use metatype in embedded Swift", ()) ERROR(embedded_swift_keypath,none, "cannot use key path in embedded Swift", ()) ERROR(embedded_swift_dynamic_cast,none, "cannot do dynamic casting in embedded Swift", ()) ERROR(embedded_swift_allocating_type,none, "cannot use allocating type %0 in -no-allocations mode", (Type)) ERROR(embedded_swift_allocating_coroutine,none, "cannot use co-routines (like accessors) in -no-allocations mode", ()) ERROR(embedded_swift_allocating_closure,none, "cannot use escaping closures in -no-allocations mode", ()) ERROR(embedded_swift_allocating,none, "cannot use allocating operation in -no-allocations mode", ()) ERROR(embedded_capture_of_generic_value_with_deinit,none, "capturing generic non-copyable type with deinit in escaping closure not supported in embedded Swift", ()) ERROR(embedded_call_generic_function,none, "cannot specialize generic function or default protocol method in this context", ()) ERROR(embedded_call_generic_function_with_dynamic_self,none, "cannot call an initializer or static method, which is defined as default protocol method, from a class method or initializer", ()) NOTE(embedded_specialization_called_from,none, "generic specialization called here", ()) NOTE(embedded_existential_created,none, "protocol type value created here", ()) NOTE(embedded_constructor_called,none, "instance of type created here", ()) ERROR(wrong_linkage_for_serialized_function,none, "function has wrong linkage to be called from %0", (StringRef)) NOTE(performance_called_from,none, "called from here", ()) // 'transparent' diagnostics ERROR(circular_transparent,none, "inlining 'transparent' functions forms circular loop", ()) NOTE(note_while_inlining,none, "while inlining here", ()) // Pre-specializations ERROR(cannot_prespecialize,none, "Cannot pre-specialize %0", (StringRef)) ERROR(missing_prespecialization,none, "Pre-specialized function %0 missing in SwiftOnoneSupport module", (StringRef)) // Arithmetic diagnostics. ERROR(integer_conversion_overflow,none, "integer overflows when converted from %0 to %1", (Type, Type)) ERROR(integer_conversion_overflow_builtin_types,none, "integer overflows when converted from %select{unsigned|signed}0 " "%1 to %select{unsigned|signed}2 %3", (bool, Type, bool, Type)) WARNING(integer_conversion_overflow_warn,none, "integer overflows when converted from %0 to %1", (Type, Type)) ERROR(negative_integer_literal_overflow_unsigned,none, "negative integer '%1' overflows when stored into unsigned type %0", (Type, StringRef)) ERROR(integer_literal_overflow,none, "integer literal '%1' overflows when stored into %0", (Type, StringRef)) ERROR(integer_literal_overflow_builtin_types,none, "integer literal '%2' overflows when stored into " "%select{unsigned|signed}0 %1", (bool, Type, StringRef)) WARNING(integer_literal_overflow_warn,none, "integer literal overflows when stored into %0", (Type)) ERROR(arithmetic_operation_overflow,none, "arithmetic operation '%0 %1 %2' (on type %3) results in an overflow", (StringRef, StringRef, StringRef, Type)) ERROR(arithmetic_operation_overflow_generic_type,none, "arithmetic operation '%0 %1 %2' (on %select{unsigned|signed}3 " "%4-bit integer type) results in an overflow", (StringRef, StringRef, StringRef, bool, unsigned)) ERROR(division_overflow,none, "division '%0 %1 %2' results in an overflow", (StringRef, StringRef, StringRef)) ERROR(division_by_zero,none, "division by zero", ()) ERROR(wrong_non_negative_assumption,none, "assumed non-negative value '%0' is negative", (StringRef)) ERROR(shifting_all_significant_bits,none, "shift amount is greater than or equal to type size in bits", ()) // FIXME: We won't need this as it will be replaced with user-generated strings. // staticReport diagnostics. ERROR(static_report_error, none, "static report error", ()) ERROR(pound_assert_condition_not_constant,none, "#assert condition not constant", ()) ERROR(pound_assert_failure,none, "%0", (StringRef)) NOTE(constexpr_unknown_reason_default,none, "cannot evaluate expression as constant here", ()) NOTE(constexpr_unevaluable_operation,none, "cannot constant evaluate operation%select{| used by this call}0", (bool)) NOTE(constexpr_too_many_instructions,none, "exceeded instruction limit: %0 when evaluating the expression " "at compile time", (unsigned)) NOTE(constexpr_limit_exceeding_instruction,none, "limit exceeded " "%select{here|during this call}0", (bool)) NOTE(constexpr_loop_found_note,none, "control-flow loop found during evaluation ", ()) NOTE(constexpr_loop_instruction,none, "found loop " "%select{here|inside this call}0", (bool)) NOTE(constexpr_overflow,none, "integer overflow detected", ()) NOTE(constexpr_overflow_operation,none, "operation" "%select{| performed during this call}0 overflows", (bool)) NOTE(constexpr_trap, none, "%0", (StringRef)) NOTE(constexpr_trap_operation, none, "operation" "%select{| performed during this call}0 traps", (bool)) NOTE(constexpr_invalid_operand_seen, none, "operation with invalid operands encountered during evaluation",()) NOTE(constexpr_operand_invalid_here, none, "operation with invalid operands encountered " "%select{here|during this call}0", (bool)) NOTE(constexpr_value_unknown_at_top_level,none, "cannot evaluate top-level value as constant here",()) NOTE(constexpr_multiple_writers_found_at_top_level,none, "top-level value has multiple assignments",()) NOTE(constexpr_unsupported_instruction_found, none, "encountered operation not supported by the evaluator: %0", (StringRef)) NOTE(constexpr_unsupported_instruction_found_here,none, "operation" "%select{| used by this call is}0 not supported by the evaluator", (bool)) NOTE(constexpr_found_callee_with_no_body, none, "encountered call to '%0' whose body is not available. " "Imported functions must be marked '@inlinable' to constant evaluate", (StringRef)) NOTE(constexpr_callee_with_no_body, none, "%select{|calls a }0function whose body is not available", (bool)) NOTE(constexpr_found_call_with_unknown_arg, none, "encountered call to '%0' where the %1 argument is not a constant", (StringRef, StringRef)) NOTE(constexpr_call_with_unknown_arg, none, "%select{|makes a }0function call with non-constant arguments", (bool)) NOTE(constexpr_untracked_sil_value_use_found, none, "encountered use of a variable not tracked by the evaluator", ()) NOTE(constexpr_untracked_sil_value_used_here, none, "untracked variable used %select{here|by this call}0", (bool)) NOTE(constexpr_unevaluable_cast_found, none, "encountered an unevaluable cast", ()) NOTE(constexpr_unevaluable_cast_used_here, none, "unevaluable cast encountered %select{here|by this call}0", (bool)) NOTE(constexpr_unresolvable_witness_call, none, "encountered unresolvable witness method call: '%0'", (StringRef)) NOTE(constexpr_no_witness_table_entry, none, "cannot find witness table entry " "%select{for this call|for a witness-method invoked during this call}0", (bool)) NOTE(constexpr_witness_call_with_no_conformance, none, "cannot find concrete conformance " "%select{for this call|for a witness-method invoked during this call}0", (bool)) REMARK(constexpr_unknown_control_flow_due_to_skip,none, "branch depends on " "non-constant value produced by an unevaluated instructions", ()) NOTE(constexpr_returned_by_unevaluated_instruction,none, "result of an unevaluated instruction is not a constant", ()) NOTE(constexpr_mutated_by_unevaluated_instruction,none, "value mutable by an " "unevaluated instruction is not a constant", ()) ERROR(not_constant_evaluable, none, "not constant evaluable", ()) ERROR(constexpr_imported_func_not_onone, none, "imported constant evaluable " "function '%0' must be annotated '@_optimize(none)'", (StringRef)) // Differentiation transform diagnostics ERROR(autodiff_internal_swift_not_imported,none, "Automatic differentiation internal error: the Swift module is not " "imported", ()) ERROR(autodiff_differentiation_module_not_imported,none, "Automatic differentiation requires the '_Differentiation' module to be " "imported", ()) ERROR(autodiff_conversion_to_linear_function_not_supported,none, "conversion to '@differentiable(_linear)' function type is not yet " "supported", ()) ERROR(autodiff_function_not_differentiable_error,none, "function is not differentiable", ()) ERROR(autodiff_expression_not_differentiable_error,none, "expression is not differentiable", ()) NOTE(autodiff_expression_not_differentiable_note,none, "expression is not differentiable", ()) NOTE(autodiff_when_differentiating_function_call,none, "when differentiating this function call", ()) NOTE(autodiff_when_differentiating_function_definition,none, "when differentiating this function definition", ()) NOTE(autodiff_implicitly_inherited_differentiable_attr_here,none, "differentiability required by the corresponding protocol requirement " "here", ()) NOTE(autodiff_jvp_control_flow_not_supported,none, "forward-mode differentiation does not yet support control flow", ()) NOTE(autodiff_control_flow_not_supported,none, "cannot differentiate unsupported control flow", ()) NOTE(autodiff_missing_return,none, "missing return for differentiation", ()) NOTE(autodiff_external_nondifferentiable_function,none, "cannot differentiate functions that have not been marked " "'@differentiable' and that are defined in other files", ()) NOTE(autodiff_opaque_function_not_differentiable,none, "opaque non-'@differentiable' function is not differentiable", ()) NOTE(autodiff_private_derivative_from_fragile,none, "differentiated functions in " "%select{'@inlinable' functions|default arguments}0 must be marked " "'@differentiable' or have a public '@derivative'" "%select{|; this is not possible with a closure, make a top-level " "function instead}1", (unsigned, bool)) NOTE(autodiff_function_noderivative_parameter_not_differentiable,none, "cannot differentiate with respect to a '@noDerivative' parameter", ()) NOTE(autodiff_function_assoc_func_unmet_requirements,none, "function call is not differentiable because generic requirements are not " "met: '%0'", (/*requirements*/ StringRef)) NOTE(autodiff_nondifferentiable_argument,none, "cannot differentiate through a non-differentiable argument; do you want " "to use 'withoutDerivative(at:)'?", ()) NOTE(autodiff_nondifferentiable_result,none, "cannot differentiate through a non-differentiable result; do you want to " "use 'withoutDerivative(at:)'?", ()) NOTE(autodiff_protocol_member_not_differentiable,none, "member is not differentiable because the corresponding protocol " "requirement is not '@differentiable'", ()) NOTE(autodiff_class_member_not_differentiable,none, "member is not differentiable because the corresponding class member " "is not '@differentiable'", ()) NOTE(autodiff_member_subset_indices_not_differentiable,none, "member is differentiable only with respect to a smaller subset of " "arguments", ()) // TODO(TF-642): Remove when `partial_apply` works with `@differentiable` // functions. NOTE(autodiff_cannot_param_subset_thunk_partially_applied_orig_fn,none, "cannot convert a direct method reference to a '@differentiable' " "function; use an explicit closure instead", ()) NOTE(autodiff_cannot_differentiate_through_direct_yield,none, "cannot differentiate through a '_read' accessor", ()) NOTE(autodiff_enums_unsupported,none, "differentiating enum values is not yet supported", ()) NOTE(autodiff_stored_property_parent_not_differentiable,none, "cannot differentiate access to property '%0.%1' because '%0' does not " "conform to 'Differentiable'", (StringRef, StringRef)) NOTE(autodiff_stored_property_not_differentiable,none, "cannot differentiate access to property '%0.%1' because property type %2 " "does not conform to 'Differentiable'", (StringRef, StringRef, Type)) NOTE(autodiff_stored_property_tangent_not_struct,none, "cannot differentiate access to property '%0.%1' because " "'%0.TangentVector' is not a struct", (StringRef, StringRef)) NOTE(autodiff_stored_property_no_corresponding_tangent,none, "cannot differentiate access to property '%0.%1' because " "'%0.TangentVector' does not have a stored property named '%1'", (StringRef, StringRef)) NOTE(autodiff_tangent_property_wrong_type,none, "cannot differentiate access to property '%0.%1' because " "'%0.TangentVector.%1' does not have expected type %2", (StringRef, StringRef, /*originalPropertyTanType*/ Type)) NOTE(autodiff_tangent_property_not_stored,none, "cannot differentiate access to property '%0.%1' because " "'%0.TangentVector.%1' is not a stored property", (StringRef, StringRef)) NOTE(autodiff_coroutines_not_supported,none, "differentiation of coroutine calls is not yet supported", ()) NOTE(autodiff_cannot_differentiate_writes_to_global_variables,none, "cannot differentiate writes to global variables", ()) NOTE(autodiff_cannot_differentiate_writes_to_mutable_captures,none, "cannot differentiate writes to mutable captures", ()) ERROR(non_physical_addressof,none, "addressof only works with purely physical lvalues; " "use 'withUnsafePointer' or 'withUnsafeBytes' unless you're implementing " "'withUnsafePointer' or 'withUnsafeBytes'", ()) ERROR(non_borrowed_indirect_addressof,none, "addressof only works with borrowable in-memory rvalues; " "use 'withUnsafePointer' or 'withUnsafeBytes' unless you're implementing " "'withUnsafePointer' or 'withUnsafeBytes'", ()) REMARK(opt_remark_passed, none, "%0", (StringRef)) REMARK(opt_remark_missed, none, "%0", (StringRef)) NOTE(opt_remark_note, none, "%0", (StringRef)) // Float-point to integer conversions ERROR(float_to_int_overflow, none, "invalid%select{| implicit}2 conversion: '%0' overflows %1", (StringRef, Type, bool)) ERROR(negative_fp_literal_overflow_unsigned, none, "negative literal '%0' cannot be converted to %select{|unsigned }2%1", (StringRef, Type, bool)) // Overflow and underflow warnings for floating-point truncation WARNING(warning_float_trunc_overflow, none, "'%0' overflows to %select{|-}2inf during conversion to %1", (StringRef, Type, bool)) WARNING(warning_float_trunc_underflow, none, "'%0' underflows and loses precision during conversion to %1", (StringRef, Type, bool)) WARNING(warning_float_trunc_hex_inexact, none, "'%0' loses precision during conversion to %1", (StringRef, Type, bool)) WARNING(warning_float_overflows_maxbuiltin, none, "'%0' overflows to %select{|-}1inf because its magnitude exceeds " "the limits of a float literal", (StringRef, bool)) // Integer to floating-point conversions WARNING(warning_int_to_fp_inexact, none, "'%1' is not exactly representable as %0; it becomes '%2'", (Type, StringRef, StringRef)) // Flow-isolation diagnostics ERROR(isolated_after_nonisolated, none, "cannot access %kind1 here in " "%select{nonisolated initializer|deinitializer}0", (bool, const ValueDecl *)) NOTE(nonisolated_blame, none, "after %1%2 %3, " "only nonisolated properties of 'self' can be accessed from " "%select{this init|a deinit}0", (bool, StringRef, StringRef, DeclName)) ERROR(isolated_property_mutation_in_nonisolated_context,none, "actor-isolated %kind0 can not be %select{referenced|mutated}1 " "from a nonisolated context", (const ValueDecl *, bool)) // Yield usage errors ERROR(return_before_yield, none, "accessor must yield before returning",()) ERROR(multiple_yields, none, "accessor must not yield more than once", ()) NOTE(previous_yield, none, "previous yield was here", ()) ERROR(possible_return_before_yield, none, "accessor must yield on all paths before returning", ()) NOTE(branch_doesnt_yield, none, "missing yield when the condition is %select{false|true}0", (bool)) NOTE(named_case_doesnt_yield, none, "missing yield in the %0 case", (Identifier)) NOTE(case_doesnt_yield, none, "missing yield in " "%select{this|the nil|the non-nil}0 case", (unsigned)) NOTE(switch_value_case_doesnt_yield, none, "missing yield in the %0 case", (StringRef)) NOTE(try_branch_doesnt_yield, none, "missing yield when error is " "%select{not |}0thrown", (bool)) // OS log optimization diagnostics. ERROR(oslog_constant_eval_trap, none, "%0", (StringRef)) ERROR(oslog_too_many_instructions, none, "interpolated expression and arguments " "are too complex", ()) ERROR(oslog_invalid_log_message, none, "invalid log message; extending " "types defined in the os module is not supported", ()) NOTE(oslog_const_evaluable_fun_error, none, "'%0' failed evaluation", (StringRef)) ERROR(oslog_non_constant_message, none, "'OSLogMessage' instance passed to the " "log call is not a constant", ()) ERROR(oslog_non_constant_interpolation, none, "'OSLogInterpolation' instance " "passed to 'OSLogMessage.init' is not a constant", ()) ERROR(oslog_property_not_constant, none, "'OSLogInterpolation.%0' is not a " "constant", (StringRef)) ERROR(oslog_message_alive_after_opts, none, "string interpolation cannot " "be used in this context; if you are calling an os_log function, " "try a different overload", ()) ERROR(oslog_message_explicitly_created, none, "'OSLogMessage' must be " " created from a string interpolation or string literal", ()) WARNING(oslog_call_in_unreachable_code, none, "os log call will never be " "executed and may have undiagnosed errors", ()) ERROR(global_string_pointer_on_non_constant, none, "globalStringTablePointer " "builtin must be used only on string literals", ()) ERROR(polymorphic_builtin_passed_non_trivial_non_builtin_type, none, "Argument " "of type %0 can not be passed as an argument to a Polymorphic " "builtin. Polymorphic builtins can only be passed arguments that are " "trivial builtin typed", (Type)) ERROR(polymorphic_builtin_passed_type_without_static_overload, none, "Static" " overload %0 does not exist for polymorphic builtin '%1'. Static " "overload implied by passing argument of type %2", (Identifier, StringRef, Type)) ERROR(builtin_get_function_isolation_bad_argument, none, "argument to 'extractFunctionIsolation' must have '@isolated(any)' " "function type", ()) ERROR(box_to_stack_cannot_promote_box_to_stack_due_to_escape_alloc, none, "Can not promote value from heap to stack due to value escaping", ()) NOTE(box_to_stack_cannot_promote_box_to_stack_due_to_escape_location, none, "value escapes here", ()) WARNING(semantic_function_improper_nesting, none, "'@_semantics' function calls non-'@_semantics' function with nested '@_semantics' calls", ()) // SDK mismatch diagnostics ERROR(missing_deinit_on_executor_function, none, "Missing 'swift_task_deinitOnExecutor' function! " "This is likely due to an outdated/incompatible SDK.", ()) // Capture promotion diagnostics WARNING(capturepromotion_concurrentcapture_mutation, none, "'%0' mutated after capture by sendable closure", (StringRef)) NOTE(capturepromotion_concurrentcapture_closure_here, none, "variable captured by sendable closure", ()) NOTE(capturepromotion_concurrentcapture_capturinguse_here, none, "capturing use", ()) NOTE(capturepromotion_variable_defined_here,none, "variable defined here", ()) // noimplicitcopy on generic or existential binding ERROR(noimplicitcopy_used_on_generic_or_existential, none, "'@_noImplicitCopy' can not be used on a generic or existential typed " "binding or a nominal type containing such typed things", ()) // discard statement ERROR(discard_nontrivial_storage,none, "can only 'discard' type %0 if it contains trivially-destroyed " "stored properties at this time", (Type)) NOTE(discard_nontrivial_storage_note,none, "type %0 cannot be trivially destroyed", (Type)) NOTE(discard_nontrivial_implicit_storage_note,none, "type %0 implicitly contains %1 which cannot be trivially destroyed", (Type, Type)) /// Move Checking / Noncopyable types diagnostics ERROR(sil_movechecking_owned_value_consumed_more_than_once, none, "'%0' consumed more than once", (StringRef)) ERROR(sil_movechecking_owned_value_consumed_and_used_at_same_time, none, "'%0' consumed and used at the same time", (StringRef)) ERROR(sil_movechecking_value_used_after_consume, none, "'%0' used after consume", (StringRef)) ERROR(sil_movechecking_guaranteed_value_consumed, none, "'%0' is borrowed and cannot be consumed", (StringRef)) ERROR(sil_movechecking_borrowed_parameter_captured_by_closure, none, "'%0' cannot be captured by an escaping closure since it is a borrowed " "parameter", (StringRef)) ERROR(sil_movechecking_capture_consumed, none, "noncopyable '%0' cannot be consumed when captured by an escaping closure", (StringRef)) ERROR(sil_movechecking_not_reinitialized_before_end_of_function, none, "missing reinitialization of %select{inout parameter|closure capture}1 '%0' " "after consume", (StringRef, bool)) ERROR(sil_movechecking_not_reinitialized_before_end_of_coroutine, none, "field '%0' was consumed but not reinitialized; " "the field must be reinitialized during the access", (StringRef)) ERROR(sil_movechecking_not_reinitialized_before_end_of_access, none, "missing reinitialization of %select{inout parameter|closure capture}1 '%0' " "after consume while accessing memory", (StringRef, bool)) ERROR(sil_movechecking_value_consumed_in_a_loop, none, "'%0' consumed in a loop", (StringRef)) ERROR(sil_movechecking_use_after_partial_consume, none, "cannot use '%0' after partial consume", (StringRef)) ERROR(sil_movechecking_notconsumable_but_assignable_was_consumed, none, "cannot consume noncopyable stored property '%0' %select{of a class|that is global}1", (StringRef, bool)) ERROR(sil_movechecking_cannot_destructure_has_deinit, none, "cannot partially consume '%0' when it has a deinitializer", (StringRef)) ERROR(sil_movechecking_cannot_destructure_imported_nonfrozen, none, "cannot partially consume '%0' of non-frozen type %1 imported from %2", (StringRef, Type, const ModuleDecl*)) ERROR(sil_movechecking_cannot_destructure_exported_usableFromInline_alwaysEmitIntoClient, none, "cannot partially consume '%0' of non-frozen usableFromInline type %1 " "within a function annotated '@_alwaysEmitIntoClient'", (StringRef, Type)) ERROR(sil_movechecking_cannot_destructure, none, "cannot partially consume '%0'", (StringRef)) ERROR(sil_movechecking_cannot_partially_reinit_has_deinit, none, "cannot partially reinitialize '%0' when it has a deinitializer; only full reinitialization is allowed", (StringRef)) ERROR(sil_movechecking_cannot_partially_reinit_nonfrozen, none, "cannot partially reinitialize '%0' of non-frozen type %1 imported from %2; only full reinitialization is allowed", (StringRef, Type, const ModuleDecl*)) ERROR(sil_movechecking_cannot_partially_reinit_exported_usableFromInline_alwaysEmitIntoClient, none, "cannot partially reinitialize '%0' of non-frozen usableFromInline type " "%1 within a function annotated '@_alwaysEmitIntoClient'", (StringRef, Type)) ERROR(sil_movechecking_cannot_partially_reinit, none, "cannot partially reinitialize '%0' after it has been consumed; only full reinitialization is allowed", (StringRef)) ERROR(sil_movechecking_discard_missing_consume_self, none, "must consume 'self' before exiting method that discards self", ()) ERROR(sil_movechecking_reinit_after_discard, none, "cannot reinitialize 'self' after 'discard self'", ()) ERROR(sil_movechecking_consume_during_deinit, none, "'self' cannot be consumed during 'deinit'", ()) NOTE(sil_movechecking_discard_self_here, none, "discarded self here", ()) NOTE(sil_movechecking_partial_consume_here, none, "partially consumed here", ()) NOTE(sil_movechecking_consuming_use_here, none, "consumed here", ()) NOTE(sil_movechecking_consumed_again_here, none, "consumed again here", ()) NOTE(sil_movechecking_two_consuming_uses_here, none, "multiple consumes here", ()) NOTE(sil_movechecking_consuming_and_non_consuming_uses_here, none, "consumed and used here", ()) NOTE(sil_movechecking_consuming_closure_use_here, none, "closure capturing '%0' here", (StringRef)) NOTE(sil_movechecking_nonconsuming_use_here, none, "used here", ()) NOTE(sil_movechecking_consumed_in_loop_here, none, "consumed in loop here", ()) NOTE(sil_movechecking_deinit_here, none, "deinitializer declared here", ()) // errors involving noncopyables that are considered to be bugs in the compiler ERROR(sil_movechecking_not_understand_consumable_and_assignable, none, "usage of no-implicit-copy value that the compiler can't verify. This is a compiler bug. Please file a bug with a small example of the bug", ()) ERROR(sil_movechecking_not_understand_moveonly, none, "usage of a noncopyable type that compiler can't verify. This is a compiler bug. Please file a bug with a small example of the bug", ()) ERROR(sil_movechecking_bug_missed_copy, none, "copy of noncopyable typed value. This is a compiler bug. Please file a bug with a small example of the bug", ()) ERROR(sil_movechecking_bug_exclusivity_violation, none, "'%0' has an unexpected exclusivity violation. This is a compiler bug. Please file a bug with a small example of the bug", (StringRef)) ERROR(sil_movekillscopyablevalue_move_applied_to_unsupported_move, none, "'consume' applied to value that the compiler does not support. This is a compiler bug. Please file a bug with a small example of the bug", ()) ERROR(sil_movekillscopyable_move_applied_to_nonlocal_memory, none, "'consume' cannot be applied to %select{globals|escaping captures}0", (unsigned)) // Implicit inout-to-UnsafeRawPointer conversions WARNING(nontrivial_to_rawpointer_conversion,none, "forming %1 to a variable of type %0; this is likely incorrect because %2 may contain " "an object reference.", (Type, Type, Type)) WARNING(nontrivial_string_to_rawpointer_conversion,none, "forming %0 to an inout variable of type String exposes the internal representation " "rather than the string contents.", (Type)) // MARK: Reference Binding Warnings ERROR(sil_referencebinding_unknown_pattern, none, "reference binding that the compiler does not understand how to check. Please file a bug", ()) ERROR(sil_referencebinding_src_used_within_inout_scope, none, "var bound to inout binding cannot be used within the inout binding's scope", ()) NOTE(sil_referencebinding_inout_binding_here, none, "inout binding here", ()) //===----------------------------------------------------------------------===// // MARK: Region-Based Isolation Diagnostics //===----------------------------------------------------------------------===// // READ THIS: Please when adding diagnostics for region-based isolation, keep // them ordered in sections depending on which emitter uses it. It makes it // easier for people unfamiliar with the code to quickly see which diagnostics // are used by which of the SendNonSendable emitters use. //=== // Misc ERROR(regionbasedisolation_unknown_pattern, none, "pattern that the region-based isolation checker does not understand how to check. Please file a bug", ()) NOTE(regionbasedisolation_maybe_race, none, "access can happen concurrently", ()) NOTE(regionbasedisolation_type_is_non_sendable, none, "%0 is a non-Sendable type", (Type)) //=== // Use After Send Emitter GROUPED_ERROR(regionbasedisolation_named_send_yields_race, SendingRisksDataRace, none, "sending %0 risks causing data races", (Identifier)) GROUPED_ERROR(regionbasedisolation_type_send_yields_race, SendingRisksDataRace, none, "sending value of non-Sendable type %0 risks causing data races", (Type)) NOTE(regionbasedisolation_type_use_after_send, none, "sending value of non-Sendable type %0 to %1 callee risks causing data races between %1 and local %2 uses", (Type, ActorIsolation, ActorIsolation)) NOTE(regionbasedisolation_type_use_after_send_callee, none, "sending value of non-Sendable type %0 to %1 %kind2 risks causing data " "races between %1 and local %3 uses", (Type, ActorIsolation, const ValueDecl *, ActorIsolation)) NOTE(regionbasedisolation_named_info_send_yields_race, none, "sending %1%0 to %2 callee risks causing data races between %2 and local %3 uses", (Identifier, StringRef, ActorIsolation, ActorIsolation)) NOTE(regionbasedisolation_named_info_send_yields_race_callee, none, "sending %1%0 to %2 %kind3 risks causing data races between %2 and local %4 uses", (Identifier, StringRef, ActorIsolation, const ValueDecl *, ActorIsolation)) // Use after send closure. NOTE(regionbasedisolation_type_isolated_capture_yields_race, none, "sending value of non-Sendable type %0 to %1 closure due to closure capture risks causing races in between %1 and %2 uses", (Type, ActorIsolation, ActorIsolation)) // Value captured in async let and reused. NOTE(regionbasedisolation_named_nonisolated_asynclet_name, none, "sending %0 into async let risks causing data races between async let uses and local uses", (Identifier)) NOTE(regionbasedisolation_named_value_used_after_explicit_sending, none, "%0 used after being passed as a 'sending' parameter; Later uses could race", (Identifier)) NOTE(regionbasedisolation_named_isolated_closure_yields_race, none, "%0%1 is captured by a %2 closure. %2 uses in closure may race against later %3 uses", (StringRef, Identifier, ActorIsolation, ActorIsolation)) NOTE(regionbasedisolation_typed_use_after_sending, none, "Passing value of non-Sendable type %0 as a 'sending' argument risks causing races in between local and caller code", (Type)) NOTE(regionbasedisolation_typed_use_after_sending_callee, none, "Passing value of non-Sendable type %0 as a 'sending' argument to %kind1 risks causing races in between local and caller code", (Type, const ValueDecl *)) //=== // Sending Never Sendable Emitter NOTE(regionbasedisolation_named_send_never_sendable, none, "sending %1%0 to %2 callee risks causing data races between %2 and %3 uses", (Identifier, StringRef, ActorIsolation, StringRef)) NOTE(regionbasedisolation_named_send_never_sendable_callee, none, "sending %1%0 to %2 %kind3 risks causing data races between %2 and %4 uses", (Identifier, StringRef, ActorIsolation, const ValueDecl *, StringRef)) NOTE(regionbasedisolation_named_send_into_sending_param, none, "%0%1 is passed as a 'sending' parameter; Uses in callee may race with " "later %0uses", (StringRef, Identifier)) NOTE(regionbasedisolation_named_nosend_send_into_result, none, "%0%1 cannot be a 'sending' result. %2 uses may race with caller uses", (StringRef, Identifier, StringRef)) NOTE(regionbasedisolation_typed_tns_passed_to_sending, none, "Passing %0 value of non-Sendable type %1 as a 'sending' parameter risks " "causing races inbetween %0 uses and uses reachable from the callee", (StringRef, Type)) ERROR(regionbasedisolation_typed_tns_passed_sending_closure, none, "passing closure as a 'sending' parameter risks causing data races between %0 and concurrent execution of the closure", (StringRef)) NOTE(regionbasedisolation_typed_tns_passed_to_sending_closure_helper_have_value, none, "closure captures %0 %1", (StringRef, DeclName)) NOTE(regionbasedisolation_typed_tns_passed_to_sending_closure_helper_have_value_task_isolated, none, "closure captures %0 which is accessible to code in the current task", (DeclName)) NOTE(regionbasedisolation_typed_tns_passed_to_sending_closure_helper_have_boxed_value_task_isolated, none, "closure captures reference to mutable %kind0 which is accessible to code in the current task", (const ValueDecl *)) NOTE(regionbasedisolation_typed_tns_passed_to_sending_closure_helper_have_value_region, none, "closure captures %1 which is accessible to %0 code", (StringRef, DeclName)) NOTE(regionbasedisolation_typed_tns_passed_to_sending_closure_helper_multiple_value, none, "closure captures non-Sendable %0", (DeclName)) NOTE(regionbasedisolation_closure_captures, none, "closure captures %0", (DeclName)) NOTE(regionbasedisolation_closure_captures_actor, none, "closure captures %0 allowing access to %1 state within the closure", (DeclName, StringRef)) NOTE(regionbasedisolation_typed_tns_passed_to_sending_callee, none, "Passing %0 value of non-Sendable type %1 as a 'sending' parameter to %kind2 risks causing races inbetween %0 uses and uses reachable from %2", (StringRef, Type, const ValueDecl *)) NOTE(regionbasedisolation_named_send_nt_asynclet_capture, none, "sending %1 %0 into async let risks causing data races between nonisolated and %1 uses", (Identifier, StringRef)) NOTE(regionbasedisolation_typed_sendneversendable_via_arg, none, "sending %0 value of non-Sendable type %1 to %2 callee risks causing races in between %0 and %2 uses", (StringRef, Type, ActorIsolation)) NOTE(regionbasedisolation_typed_sendneversendable_via_arg_callee, none, "sending %0 value of non-Sendable type %1 to %2 %kind3 risks causing races in between %0 and %2 uses", (StringRef, Type, ActorIsolation, const ValueDecl *)) // Error that is only used when the send non sendable emitter cannot discover any // information to give a better diagnostic. ERROR(regionbasedisolation_task_or_actor_isolated_sent, none, "task or actor-isolated value cannot be sent", ()) //=== // InOut Sending Emitter NOTE(regionbasedisolation_inout_sending_must_be_reinitialized, none, "'inout sending' parameter must be reinitialized before function exit with a non-actor-isolated value", ()) ERROR(regionbasedisolation_inout_sending_cannot_be_actor_isolated, none, "'inout sending' parameter %0 cannot be %1at end of function", (Identifier, StringRef)) NOTE(regionbasedisolation_inout_sending_cannot_be_actor_isolated_note, none, "%1%0 risks causing races in between %1uses and caller uses since caller assumes value is not actor isolated", (Identifier, StringRef)) //=== // Out Sending ERROR(regionbasedisolation_out_sending_cannot_be_actor_isolated_type, none, "returning a %1 %0 value as a 'sending' result risks causing data races", (Type, StringRef)) NOTE(regionbasedisolation_out_sending_cannot_be_actor_isolated_note_type, none, "returning a %1 %0 value risks causing races since the caller assumes the value can be safely sent to other isolation domains", (Type, StringRef)) ERROR(regionbasedisolation_out_sending_cannot_be_actor_isolated_named, none, "returning %1 %0 as a 'sending' result risks causing data races", (Identifier, StringRef)) NOTE(regionbasedisolation_out_sending_cannot_be_actor_isolated_note_named, none, "returning %1 %0 risks causing data races since the caller assumes that %0 can be safely sent to other isolation domains", (Identifier, StringRef)) //=== // non-Sendable Results // Example: returning main-actor isolated result to a custom-actor isolated context risks causing data races ERROR(rbi_isolation_crossing_result, none, "non-Sendable %0-typed result can not be returned from %1 %kind2 to %3 context", (Type, ActorIsolation, const ValueDecl *, ActorIsolation)) ERROR(rbi_isolation_crossing_result_no_decl, none, "non-Sendable %0-typed result can not be returned from %1 function to %2 context", (Type, ActorIsolation, ActorIsolation)) NOTE(rbi_non_sendable_nominal,none, "%kind0 does not conform to the 'Sendable' protocol", (const ValueDecl *)) NOTE(rbi_nonsendable_function_type,none, "a function type must be marked '@Sendable' to conform to 'Sendable'", ()) NOTE(rbi_add_nominal_sendable_conformance,none, "consider making %kind0 conform to the 'Sendable' protocol", (const ValueDecl *)) NOTE(rbi_add_generic_parameter_sendable_conformance,none, "consider making generic parameter %0 conform to the 'Sendable' protocol", (Type)) // Concurrency related diagnostics ERROR(cannot_find_executor_factory_type, none, "the DefaultExecutorFactory type could not be found", ()) ERROR(executor_factory_must_conform, none, "the DefaultExecutorFactory does not conform to 'ExecutorFactory'", ()) //===----------------------------------------------------------------------===// // MARK: Misc Diagnostics //===----------------------------------------------------------------------===// // TODO: print the name of the nominal type ERROR(deinit_not_visible, none, "deinit of non-copyable type not visible in the current module", ()) ERROR(lifetime_variable_outside_scope, none, "lifetime-dependent variable '%0' escapes its scope", (Identifier)) ERROR(lifetime_value_outside_scope, none, "lifetime-dependent value escapes its scope", ()) ERROR(lifetime_value_outside_accessor, none, "lifetime-dependent value returned by generated accessor '%0'", (StringRef)) ERROR(lifetime_value_outside_thunk, none, "lifetime-dependent value returned by generated %select{function|thunk}0 '%1'", (bool, StringRef)) NOTE(lifetime_outside_scope_argument, none, "it depends on the lifetime of argument '%0'", (Identifier)) NOTE(lifetime_outside_scope_synthesized_argument, none, "it depends on the lifetime of an argument of '%0'", (Identifier)) NOTE(lifetime_outside_scope_access, none, "it depends on this scoped access to variable '%0'", (Identifier)) NOTE(lifetime_outside_scope_variable, none, "it depends on the lifetime of variable '%0'", (Identifier)) NOTE(lifetime_outside_scope_value, none, "it depends on the lifetime of this parent value", ()) NOTE(lifetime_outside_scope_capture, none, "it depends on a closure capture; this is not yet supported", ()) NOTE(lifetime_outside_scope_use, none, "this use of the lifetime-dependent value is out of scope", ()) NOTE(lifetime_outside_scope_escape, none, "this use causes the lifetime-dependent value to escape", ()) ERROR(noncopyable_shared_case_block_unimplemented, none, "matching a non-'Copyable' value using a case label that has multiple patterns is not implemented", ()) #define UNDEFINE_DIAGNOSTIC_MACROS #include "DefineDiagnosticMacros.h"