//===--- DiagnosticsCommon.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 that can be emitted across the whole compiler. // 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" ERROR(invalid_diagnostic,none, "INTERNAL ERROR: this diagnostic should not be produced", ()) ERROR(not_implemented,none, "INTERNAL ERROR: feature not implemented: %0", (StringRef)) ERROR(error_opening_output,none, "error opening '%0' for output: %1", (StringRef, StringRef)) ERROR(error_closing_output,none, "error closing '%0' for output: %1", (StringRef, StringRef)) ERROR(cannot_find_group_info_file,none, "cannot find group info file at path: '%0'", (StringRef)) ERROR(cannot_parse_group_info_file,none, "cannot parse group info file at path: '%0'", (StringRef)) ERROR(error_no_group_info,none, "no group info found for file: '%0'", (StringRef)) NOTE(brace_stmt_suggest_do,none, "did you mean to use a 'do' statement?", ()) WARNING(error_in_future_swift_version,none, "%0; this is an error in Swift %1", (DiagnosticInfo *, unsigned)) // Generic disambiguation NOTE(while_parsing_as_left_angle_bracket,none, "while parsing this '<' as a type parameter bracket", ()) // Generic determinism-forcing override. REMARK(remark_max_determinism_overriding,none, "SWIFTC_MAXIMUM_DETERMINISM overriding %0", (StringRef)) // FIXME: This is used both as a parse error (a literal "super" outside a // method) and a type-checker error ("super" in a method of a non-class type). ERROR(super_not_in_class_method,none, "'super' cannot be used outside of class members", ()) ERROR(class_func_not_in_class,none, "class methods are only allowed within classes; " "use 'static' to declare a %select{static|requirement fulfilled by either a static or class}0 method", (bool)) ERROR(class_var_not_in_class,none, "class properties are only allowed within classes; " "use 'static' to declare a %select{static|requirement fulfilled by either a static or class}0 property", (bool)) ERROR(class_subscript_not_in_class,none, "class subscripts are only allowed within classes; " "use 'static' to declare a %select{static|requirement fulfilled by either a static or class}0 subscript", (bool)) ERROR(require_static_for_const,none, "'static' is required for _const variable declaration", ()) ERROR(require_let_for_const,none, "let is required for a _const variable declaration", ()) ERROR(require_const_initializer_for_const,none, "_const let should be initialized with a compile-time literal", ()) // FIXME: Used by both the parser and the type-checker. ERROR(func_decl_without_brace,PointsToFirstBadToken, "expected '{' in body of function declaration", ()) NOTE(convert_let_to_var,none, "change 'let' to 'var' to make it mutable", ()) NOTE(note_typo_candidate,none, "did you mean '%0'?", (StringRef)) NOTE(profile_read_error,none, "failed to load profile data '%0': '%1'", (StringRef, StringRef)) ERROR(attr_only_on_parameters, none, "'%0' may only be used on parameters", (StringRef)) ERROR(function_type_no_parens,none, "single argument function types require parentheses", ()) // Used by both the Frontend and Sema. ERROR(error_underlying_module_not_found,none, "underlying Objective-C module %0 not found", (Identifier)) // Used by -verify-generic-signatures ERROR(generic_signature_not_minimal,none, "generic requirement '%0' is redundant in %1", (StringRef, StringRef)) ERROR(generic_signature_not_valid,none, "generic signature %0 is invalid", (StringRef)) ERROR(generic_signature_not_equal,none, "generic signature %0 is not equal to new signature %1", (StringRef, StringRef)) // Used in diagnostics that are split across requests implemented in several places. ERROR(concurrency_default_actor_not_found,none, "broken standard library: cannot find default actor type '%0'", (StringRef)) // FIXME: Used by swift-api-digester. Don't want to set up a separate diagnostics // file just for a few errors. ERROR(sdk_node_unrecognized_key,none, "unrecognized key '%0' in SDK node", (StringRef)) ERROR(sdk_node_unrecognized_node_kind,none, "unrecognized SDK node kind '%0'", (StringRef)) ERROR(sdk_node_unrecognized_type_attr_kind,none, "unrecognized type attribute '%0' in SDK node", (StringRef)) ERROR(sdk_node_unrecognized_decl_attr_kind,none, "unrecognized declaration attribute '%0' in SDK node", (StringRef)) ERROR(sdk_node_unrecognized_decl_kind,none, "unrecognized declaration kind '%0' in SDK node", (StringRef)) ERROR(sdk_node_unrecognized_accessor_kind,none, "unrecognized accessor kind '%0' in SDK node", (StringRef)) // Emitted from ModuleDecl::computeFileIDMap() WARNING(source_location_creates_file_id_conflicts,none, "'#sourceLocation' directive produces '#fileID' string of '%0', which " "conflicts with '#fileID' strings produced by other paths in the " "module", (StringRef)) NOTE(fixit_correct_source_location_file,none, "change file in '#sourceLocation' to '%0'", (StringRef)) // Usually, but not always, emitted from the driver ERROR(error_two_files_same_name,none, "filename \"%0\" used twice: '%1' and '%2'", (StringRef, StringRef, StringRef)) NOTE(note_explain_two_files_same_name,none, "filenames are used to distinguish private declarations with the same " "name", ()) //------------------------------------------------------------------------------ // MARK: Circular reference diagnostics //------------------------------------------------------------------------------ ERROR(circular_reference, none, "circular reference", ()) NOTE(circular_reference_through, none, "through reference here", ()) ERROR(circular_class_inheritance,none, "%0 inherits from itself", (Identifier)) ERROR(circular_enum_inheritance,none, "%0 has a raw type that depends on itself", (Identifier)) ERROR(circular_protocol_def,none, "protocol %0 refines itself", (Identifier)) NOTE(kind_declname_declared_here,none, "%0 %1 declared here", (DescriptiveDeclKind, DeclName)) WARNING(warn_property_wrapper_module_scope,none, "ignoring associated type %0 in favor of module-scoped property " "wrapper %0; please qualify the reference with %1", (DeclNameRef, Identifier)) NOTE(circular_type_resolution_note,none, "while resolving type %0", (TypeRepr *)) //------------------------------------------------------------------------------ // MARK: Cross-import overlay loading diagnostics //------------------------------------------------------------------------------ ERROR(cannot_load_swiftoverlay_file, none, "cannot load cross-import overlay for '%0' and '%1': %2 (declared by '%3')", (StringRef, StringRef, StringRef, StringRef)) ERROR(cannot_list_swiftcrossimport_dir, none, "cannot list cross-import overlays for '%0': %1 (declared in '%2')", (StringRef, StringRef, StringRef)) WARNING(cross_imported_by_both_modules, none, "modules %0 and %1 both declare module %2 as a cross-import overlay, " "which may cause paradoxical behavior when looking up names in them; " "please report this bug to the maintainers of these modules", (Identifier, Identifier, Identifier)) //------------------------------------------------------------------------------ // MARK: dependencies scanner diagnostics //------------------------------------------------------------------------------ ERROR(scanner_find_cycle, none, "dependency scanner detected dependency cycle: '%0'", (StringRef)) ERROR(scanner_arguments_invalid, none, "dependencies scanner cannot be configured with arguments: '%0'", (StringRef)) WARNING(warn_scanner_deserialize_failed, none, "Failed to load module scanning dependency cache from: '%0', re-building scanner cache from scratch.", (StringRef)) REMARK(remark_reuse_cache, none, "Re-using serialized module scanning dependency cache from: '%0'.", (StringRef)) REMARK(remark_save_cache, none, "Serializing module scanning dependency cache to: '%0'.", (StringRef)) //------------------------------------------------------------------------------ // MARK: custom attribute diagnostics //------------------------------------------------------------------------------ ERROR(unknown_attribute,none, "unknown attribute '%0'", (StringRef)) //------------------------------------------------------------------------------ // MARK: macro diagnostics //------------------------------------------------------------------------------ NOTE(in_macro_expansion,none, "in expansion of macro %0%select{| on %kind1}1 here", (DeclName, const Decl *)) ERROR(macro_experimental,none, "%0 macros are an experimental feature that is not enabled %select{|(%1)}1", (StringRef, StringRef)) ERROR(ambiguous_macro_reference,none, "ambiguous reference to macro %0", (DeclName)) //------------------------------------------------------------------------------ // MARK: bridged diagnostics //------------------------------------------------------------------------------ NOTE(bridged_note, none, "%0", (StringRef)) WARNING(bridged_warning, none,"%0", (StringRef)) ERROR(bridged_error, none, "%0", (StringRef)) ERROR(bridged_fatal_error, Fatal, "%0", (StringRef)) REMARK(bridged_remark, none, "%0", (StringRef)) #define UNDEFINE_DIAGNOSTIC_MACROS #include "DefineDiagnosticMacros.h"