//===--- 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. 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)) 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_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)) // 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)) 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 %1 expected to return %0", (Type, DescriptiveDeclKind)) ERROR(missing_never_call_decl,none, "%1 with uninhabited return type %0 is missing " "call to another never-returning function on all paths", (Type, DescriptiveDeclKind)) 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", ()) 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_multiple_results,none, "cannot differentiate through multiple results", ()) NOTE(autodiff_cannot_differentiate_through_inout_arguments,none, "cannot differentiate through 'inout' arguments", ()) 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 %1 %2 here in %select{non-isolated initializer|deinitializer}0", (bool, DescriptiveDeclKind, DeclName)) NOTE(nonisolated_blame, none, "after %1%2 %3, " "only non-isolated properties of 'self' can be accessed from " "%select{this init|a deinit}0", (bool, StringRef, StringRef, DeclName)) ERROR(non_sendable_from_deinit,none, "cannot access %1 %2 with a non-sendable type %0 from non-isolated deinit", (Type, DescriptiveDeclKind, DeclName)) // 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(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", ()) // 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", ()) // move operator used on generic or evalue ERROR(move_operator_used_on_generic_or_existential_value, none, "move() used on a generic or existential value", ()) // copy operator used on generic or evalue ERROR(copy_operator_used_on_generic_or_existential_value, none, "copy() used on a generic or existential value", ()) // 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_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, 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, 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'", ()) 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", ()) // Warnings arising from the flow-sensitive checking of Sendability of // non-Sendable values WARNING(arg_region_consumed, none, "call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller", ()) WARNING(consumption_yields_race, none, "non-sendable value sent across isolation domains that could be concurrently accessed later in this function (%0 access site%select{|s}1 displayed%select{|, %3 more hidden}2)", (unsigned, bool, bool, unsigned)) WARNING(call_site_consumption_yields_race, none, "passing argument of non-sendable type %0 from %1 context to %2 context at this call site could yield a race with accesses later in this function (%3 access site%select{|s}4 displayed%select{|, %6 more hidden}5)", (Type, ActorIsolation, ActorIsolation, unsigned, bool, bool, unsigned)) NOTE(possible_racy_access_site, none, "access here could race", ()) #define UNDEFINE_DIAGNOSTIC_MACROS #include "DefineDiagnosticMacros.h"