mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] Thread DeclNameRef through most of the compiler
This huge commit contains as many of the mechanical changes as possible.
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
struct Convention {
|
||||
StringRef Name = {};
|
||||
DeclName WitnessMethodProtocol = {};
|
||||
DeclNameRef WitnessMethodProtocol = {};
|
||||
StringRef ClangType = {};
|
||||
// Carry the source location for diagnostics.
|
||||
SourceLoc ClangTypeLoc = {};
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
/// Don't use this function if you are creating a C convention as you
|
||||
/// probably need a ClangType field as well.
|
||||
static Convention makeSwiftConvention(StringRef name) {
|
||||
return {name, DeclName(), "", {}};
|
||||
return {name, DeclNameRef(), "", {}};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1057,15 +1057,16 @@ class DynamicReplacementAttr final
|
||||
friend TrailingObjects;
|
||||
friend class DynamicallyReplacedDeclRequest;
|
||||
|
||||
DeclName ReplacedFunctionName;
|
||||
DeclNameRef ReplacedFunctionName;
|
||||
LazyMemberLoader *Resolver = nullptr;
|
||||
uint64_t ResolverContextData;
|
||||
|
||||
/// Create an @_dynamicReplacement(for:) attribute written in the source.
|
||||
DynamicReplacementAttr(SourceLoc atLoc, SourceRange baseRange,
|
||||
DeclName replacedFunctionName, SourceRange parenRange);
|
||||
DeclNameRef replacedFunctionName,
|
||||
SourceRange parenRange);
|
||||
|
||||
DynamicReplacementAttr(DeclName name, AbstractFunctionDecl *f)
|
||||
DynamicReplacementAttr(DeclNameRef name, AbstractFunctionDecl *f)
|
||||
: DeclAttribute(DAK_DynamicReplacement, SourceLoc(), SourceRange(),
|
||||
/*Implicit=*/false),
|
||||
ReplacedFunctionName(name),
|
||||
@@ -1073,7 +1074,7 @@ class DynamicReplacementAttr final
|
||||
Bits.DynamicReplacementAttr.HasTrailingLocationInfo = false;
|
||||
}
|
||||
|
||||
DynamicReplacementAttr(DeclName name,
|
||||
DynamicReplacementAttr(DeclNameRef name,
|
||||
LazyMemberLoader *Resolver = nullptr,
|
||||
uint64_t Data = 0)
|
||||
: DeclAttribute(DAK_DynamicReplacement, SourceLoc(), SourceRange(),
|
||||
@@ -1100,18 +1101,18 @@ class DynamicReplacementAttr final
|
||||
public:
|
||||
static DynamicReplacementAttr *
|
||||
create(ASTContext &Context, SourceLoc AtLoc, SourceLoc DynReplLoc,
|
||||
SourceLoc LParenLoc, DeclName replacedFunction, SourceLoc RParenLoc);
|
||||
SourceLoc LParenLoc, DeclNameRef replacedFunction, SourceLoc RParenLoc);
|
||||
|
||||
static DynamicReplacementAttr *create(ASTContext &ctx,
|
||||
DeclName replacedFunction,
|
||||
DeclNameRef replacedFunction,
|
||||
AbstractFunctionDecl *replacedFuncDecl);
|
||||
|
||||
static DynamicReplacementAttr *create(ASTContext &ctx,
|
||||
DeclName replacedFunction,
|
||||
DeclNameRef replacedFunction,
|
||||
LazyMemberLoader *Resolver,
|
||||
uint64_t Data);
|
||||
|
||||
DeclName getReplacedFunctionName() const {
|
||||
DeclNameRef getReplacedFunctionName() const {
|
||||
return ReplacedFunctionName;
|
||||
}
|
||||
|
||||
@@ -1630,8 +1631,8 @@ public:
|
||||
};
|
||||
|
||||
/// A declaration name with location.
|
||||
struct DeclNameWithLoc {
|
||||
DeclName Name;
|
||||
struct DeclNameRefWithLoc {
|
||||
DeclNameRef Name;
|
||||
DeclNameLoc Loc;
|
||||
};
|
||||
|
||||
@@ -1652,9 +1653,9 @@ class DifferentiableAttr final
|
||||
/// The number of parsed parameters specified in 'wrt:'.
|
||||
unsigned NumParsedParameters = 0;
|
||||
/// The JVP function.
|
||||
Optional<DeclNameWithLoc> JVP;
|
||||
Optional<DeclNameRefWithLoc> JVP;
|
||||
/// The VJP function.
|
||||
Optional<DeclNameWithLoc> VJP;
|
||||
Optional<DeclNameRefWithLoc> VJP;
|
||||
/// The JVP function (optional), resolved by the type checker if JVP name is
|
||||
/// specified.
|
||||
FuncDecl *JVPFunction = nullptr;
|
||||
@@ -1674,15 +1675,15 @@ class DifferentiableAttr final
|
||||
explicit DifferentiableAttr(bool implicit, SourceLoc atLoc,
|
||||
SourceRange baseRange, bool linear,
|
||||
ArrayRef<ParsedAutoDiffParameter> parameters,
|
||||
Optional<DeclNameWithLoc> jvp,
|
||||
Optional<DeclNameWithLoc> vjp,
|
||||
Optional<DeclNameRefWithLoc> jvp,
|
||||
Optional<DeclNameRefWithLoc> vjp,
|
||||
TrailingWhereClause *clause);
|
||||
|
||||
explicit DifferentiableAttr(Decl *original, bool implicit, SourceLoc atLoc,
|
||||
SourceRange baseRange, bool linear,
|
||||
IndexSubset *parameterIndices,
|
||||
Optional<DeclNameWithLoc> jvp,
|
||||
Optional<DeclNameWithLoc> vjp,
|
||||
Optional<DeclNameRefWithLoc> jvp,
|
||||
Optional<DeclNameRefWithLoc> vjp,
|
||||
GenericSignature derivativeGenericSignature);
|
||||
|
||||
public:
|
||||
@@ -1690,27 +1691,27 @@ public:
|
||||
SourceLoc atLoc, SourceRange baseRange,
|
||||
bool linear,
|
||||
ArrayRef<ParsedAutoDiffParameter> params,
|
||||
Optional<DeclNameWithLoc> jvp,
|
||||
Optional<DeclNameWithLoc> vjp,
|
||||
Optional<DeclNameRefWithLoc> jvp,
|
||||
Optional<DeclNameRefWithLoc> vjp,
|
||||
TrailingWhereClause *clause);
|
||||
|
||||
static DifferentiableAttr *create(AbstractFunctionDecl *original,
|
||||
bool implicit, SourceLoc atLoc,
|
||||
SourceRange baseRange, bool linear,
|
||||
IndexSubset *parameterIndices,
|
||||
Optional<DeclNameWithLoc> jvp,
|
||||
Optional<DeclNameWithLoc> vjp,
|
||||
Optional<DeclNameRefWithLoc> jvp,
|
||||
Optional<DeclNameRefWithLoc> vjp,
|
||||
GenericSignature derivativeGenSig);
|
||||
|
||||
/// Get the optional 'jvp:' function name and location.
|
||||
/// Use this instead of `getJVPFunction` to check whether the attribute has a
|
||||
/// registered JVP.
|
||||
Optional<DeclNameWithLoc> getJVP() const { return JVP; }
|
||||
Optional<DeclNameRefWithLoc> getJVP() const { return JVP; }
|
||||
|
||||
/// Get the optional 'vjp:' function name and location.
|
||||
/// Use this instead of `getVJPFunction` to check whether the attribute has a
|
||||
/// registered VJP.
|
||||
Optional<DeclNameWithLoc> getVJP() const { return VJP; }
|
||||
Optional<DeclNameRefWithLoc> getVJP() const { return VJP; }
|
||||
|
||||
IndexSubset *getParameterIndices() const {
|
||||
return ParameterIndices;
|
||||
@@ -1775,7 +1776,7 @@ class DerivativeAttr final
|
||||
friend TrailingObjects;
|
||||
|
||||
/// The original function name.
|
||||
DeclNameWithLoc OriginalFunctionName;
|
||||
DeclNameRefWithLoc OriginalFunctionName;
|
||||
/// The original function declaration, resolved by the type checker.
|
||||
AbstractFunctionDecl *OriginalFunction = nullptr;
|
||||
/// The number of parsed parameters specified in 'wrt:'.
|
||||
@@ -1786,23 +1787,24 @@ class DerivativeAttr final
|
||||
Optional<AutoDiffDerivativeFunctionKind> Kind = None;
|
||||
|
||||
explicit DerivativeAttr(bool implicit, SourceLoc atLoc, SourceRange baseRange,
|
||||
DeclNameWithLoc original,
|
||||
DeclNameRefWithLoc original,
|
||||
ArrayRef<ParsedAutoDiffParameter> params);
|
||||
|
||||
explicit DerivativeAttr(bool implicit, SourceLoc atLoc, SourceRange baseRange,
|
||||
DeclNameWithLoc original, IndexSubset *indices);
|
||||
DeclNameRefWithLoc original, IndexSubset *indices);
|
||||
|
||||
public:
|
||||
static DerivativeAttr *create(ASTContext &context, bool implicit,
|
||||
SourceLoc atLoc, SourceRange baseRange,
|
||||
DeclNameWithLoc original,
|
||||
DeclNameRefWithLoc original,
|
||||
ArrayRef<ParsedAutoDiffParameter> params);
|
||||
|
||||
static DerivativeAttr *create(ASTContext &context, bool implicit,
|
||||
SourceLoc atLoc, SourceRange baseRange,
|
||||
DeclNameWithLoc original, IndexSubset *indices);
|
||||
DeclNameRefWithLoc original,
|
||||
IndexSubset *indices);
|
||||
|
||||
DeclNameWithLoc getOriginalFunctionName() const {
|
||||
DeclNameRefWithLoc getOriginalFunctionName() const {
|
||||
return OriginalFunctionName;
|
||||
}
|
||||
AbstractFunctionDecl *getOriginalFunction() const {
|
||||
|
||||
@@ -163,7 +163,7 @@ NOTE(kind_declname_declared_here,none,
|
||||
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",
|
||||
(DeclName, Identifier))
|
||||
(DeclNameRef, Identifier))
|
||||
|
||||
#ifndef DIAG_NO_UNDEF
|
||||
# if defined(DIAG)
|
||||
|
||||
@@ -207,7 +207,7 @@ ERROR(lex_conflict_marker_in_file,none,
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
NOTE(note_in_decl_extension,none,
|
||||
"in %select{declaration|extension}0 of %1", (bool, DeclName))
|
||||
"in %select{declaration|extension}0 of %1", (bool, DeclNameRef))
|
||||
ERROR(line_directive_style_deprecated,none,
|
||||
"#line directive was renamed to #sourceLocation",
|
||||
())
|
||||
|
||||
@@ -57,7 +57,7 @@ NOTE(opaque_return_type_declared_here,none,
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
ERROR(ambiguous_member_overload_set,none,
|
||||
"ambiguous reference to member %0", (DeclName))
|
||||
"ambiguous reference to member %0", (DeclNameRef))
|
||||
ERROR(ambiguous_reference_to_decl,none,
|
||||
"ambiguous reference to %0 %1", (DescriptiveDeclKind, DeclName))
|
||||
ERROR(no_overloads_match_exactly_in_call,none,
|
||||
@@ -81,25 +81,25 @@ ERROR(could_not_find_value_subscript,none,
|
||||
(Type))
|
||||
|
||||
ERROR(could_not_find_tuple_member,none,
|
||||
"value of tuple type %0 has no member %1", (Type, DeclName))
|
||||
"value of tuple type %0 has no member %1", (Type, DeclNameRef))
|
||||
|
||||
ERROR(could_not_find_value_member,none,
|
||||
"value of type %0 has no member %1", (Type, DeclName))
|
||||
"value of type %0 has no member %1", (Type, DeclNameRef))
|
||||
ERROR(could_not_find_value_member_corrected,none,
|
||||
"value of type %0 has no member %1; did you mean %2?",
|
||||
(Type, DeclName, DeclName))
|
||||
(Type, DeclNameRef, DeclName))
|
||||
ERROR(could_not_find_value_dynamic_member_corrected,none,
|
||||
"value of type %0 has no dynamic member %2 using key path from root type %1; did you mean %3?",
|
||||
(Type, Type, DeclName, DeclName))
|
||||
(Type, Type, DeclNameRef, DeclName))
|
||||
ERROR(could_not_find_value_dynamic_member,none,
|
||||
"value of type %0 has no dynamic member %2 using key path from root type %1",
|
||||
(Type, Type, DeclName))
|
||||
(Type, Type, DeclNameRef))
|
||||
|
||||
ERROR(could_not_find_type_member,none,
|
||||
"type %0 has no member %1", (Type, DeclName))
|
||||
"type %0 has no member %1", (Type, DeclNameRef))
|
||||
ERROR(could_not_find_type_member_corrected,none,
|
||||
"type %0 has no member %1; did you mean %2?",
|
||||
(Type, DeclName, DeclName))
|
||||
(Type, DeclNameRef, DeclName))
|
||||
|
||||
ERROR(could_not_find_subscript_member_did_you_mean,none,
|
||||
"value of type %0 has no property or method named 'subscript'; "
|
||||
@@ -107,7 +107,8 @@ ERROR(could_not_find_subscript_member_did_you_mean,none,
|
||||
(Type))
|
||||
|
||||
ERROR(could_not_find_enum_case,none,
|
||||
"enum type %0 has no case %1; did you mean %2", (Type, DeclName, DeclName))
|
||||
"enum type %0 has no case %1; did you mean %2",
|
||||
(Type, DeclNameRef, DeclName))
|
||||
|
||||
NOTE(did_you_mean_raw_type,none,
|
||||
"did you mean to specify a raw type on the enum declaration?", ())
|
||||
@@ -128,35 +129,35 @@ ERROR(unexpected_arguments_in_enum_case,none,
|
||||
"enum case %0 has no associated values", (DeclName))
|
||||
|
||||
ERROR(could_not_use_value_member,none,
|
||||
"member %1 cannot be used on value of type %0", (Type, DeclName))
|
||||
"member %1 cannot be used on value of type %0", (Type, DeclNameRef))
|
||||
ERROR(could_not_use_type_member,none,
|
||||
"member %1 cannot be used on type %0", (Type, DeclName))
|
||||
"member %1 cannot be used on type %0", (Type, DeclNameRef))
|
||||
|
||||
ERROR(could_not_use_type_member_on_instance,none,
|
||||
"static member %1 cannot be used on instance of type %0",
|
||||
(Type, DeclName))
|
||||
(Type, DeclNameRef))
|
||||
ERROR(could_not_use_enum_element_on_instance,none,
|
||||
"enum case %0 cannot be used as an instance member",
|
||||
(DeclName))
|
||||
(DeclNameRef))
|
||||
ERROR(could_not_use_type_member_on_protocol_metatype,none,
|
||||
"static member %1 cannot be used on protocol metatype %0",
|
||||
(Type, DeclName))
|
||||
(Type, DeclNameRef))
|
||||
ERROR(could_not_use_instance_member_on_type,none,
|
||||
"instance member %1"
|
||||
"%select{| of type %2}3 cannot be used on"
|
||||
"%select{| instance of nested}3 type %0",
|
||||
(Type, DeclName, Type, bool))
|
||||
(Type, DeclNameRef, Type, bool))
|
||||
ERROR(could_not_use_member_on_existential,none,
|
||||
"member %1 cannot be used on value of protocol type %0; use a generic"
|
||||
" constraint instead",
|
||||
(Type, DeclName))
|
||||
(Type, DeclNameRef))
|
||||
FIXIT(replace_with_type,"%0",(Type))
|
||||
FIXIT(insert_type_qualification,"%0.",(Type))
|
||||
|
||||
ERROR(candidate_inaccessible,none,
|
||||
"%0 is inaccessible due to "
|
||||
"'%select{private|fileprivate|internal|%error|%error}1' protection level",
|
||||
(DeclName, AccessLevel))
|
||||
(DeclBaseName, AccessLevel))
|
||||
|
||||
NOTE(note_candidate_inaccessible,none,
|
||||
"%0 is inaccessible due to "
|
||||
@@ -577,7 +578,7 @@ WARNING(expr_keypath_swift3_objc_inference,none,
|
||||
(DeclName, Identifier))
|
||||
ERROR(expr_keypath_type_of_property,none,
|
||||
"cannot refer to type member %0 within instance of type %1",
|
||||
(DeclName, Type))
|
||||
(DeclNameRef, Type))
|
||||
ERROR(expr_keypath_generic_type,none,
|
||||
"key path cannot refer to generic type %0", (DeclName))
|
||||
ERROR(expr_keypath_not_property,none,
|
||||
@@ -781,24 +782,24 @@ NOTE(invalid_redecl_prev,none,
|
||||
"%0 previously declared here", (DeclName))
|
||||
|
||||
ERROR(ambiguous_type_base,none,
|
||||
"%0 is ambiguous for type lookup in this context", (DeclName))
|
||||
"%0 is ambiguous for type lookup in this context", (DeclNameRef))
|
||||
ERROR(invalid_member_type,none,
|
||||
"%0 is not a member type of %1", (DeclName, Type))
|
||||
"%0 is not a member type of %1", (DeclNameRef, Type))
|
||||
ERROR(invalid_member_type_suggest,none,
|
||||
"%0 does not have a member type named %1; did you mean %2?",
|
||||
(Type, DeclName, DeclName))
|
||||
(Type, DeclNameRef, DeclName))
|
||||
ERROR(invalid_member_reference,none,
|
||||
"%0 %1 is not a member type of %2",
|
||||
(DescriptiveDeclKind, DeclName, Type))
|
||||
ERROR(ambiguous_member_type,none,
|
||||
"ambiguous type name %0 in %1", (DeclName, Type))
|
||||
"ambiguous type name %0 in %1", (DeclNameRef, Type))
|
||||
ERROR(no_module_type,none,
|
||||
"no type named %0 in module %1", (DeclName, Identifier))
|
||||
"no type named %0 in module %1", (DeclNameRef, Identifier))
|
||||
ERROR(ambiguous_module_type,none,
|
||||
"ambiguous type name %0 in module %1", (DeclName, Identifier))
|
||||
"ambiguous type name %0 in module %1", (DeclNameRef, Identifier))
|
||||
ERROR(use_nonmatching_operator,none,
|
||||
"%0 is not a %select{binary|prefix unary|postfix unary}1 operator",
|
||||
(DeclName, unsigned))
|
||||
(DeclNameRef, unsigned))
|
||||
ERROR(unsupported_recursion_in_associated_type_reference,none,
|
||||
"unsupported recursion for reference to %select{associated type|type alias}0 %1 of type %2",
|
||||
(bool, DeclName, Type))
|
||||
@@ -819,18 +820,18 @@ ERROR(unspaced_unary_operator,none,
|
||||
())
|
||||
|
||||
ERROR(use_unresolved_identifier,none,
|
||||
"use of unresolved %select{identifier|operator}1 %0", (DeclName, bool))
|
||||
"use of unresolved %select{identifier|operator}1 %0", (DeclNameRef, bool))
|
||||
ERROR(use_unresolved_identifier_corrected,none,
|
||||
"use of unresolved %select{identifier|operator}1 %0; did you mean '%2'?",
|
||||
(DeclName, bool, StringRef))
|
||||
(DeclNameRef, bool, StringRef))
|
||||
NOTE(confusable_character,none,
|
||||
"%select{identifier|operator}0 '%1' contains possibly confused characters; "
|
||||
"did you mean to use '%2'?",
|
||||
(bool, StringRef, StringRef))
|
||||
ERROR(use_undeclared_type,none,
|
||||
"use of undeclared type %0", (DeclName))
|
||||
"use of undeclared type %0", (DeclNameRef))
|
||||
ERROR(use_undeclared_type_did_you_mean,none,
|
||||
"use of undeclared type %0; did you mean to use '%1'?", (DeclName, StringRef))
|
||||
"use of undeclared type %0; did you mean to use '%1'?", (DeclNameRef, StringRef))
|
||||
NOTE(note_typo_candidate_implicit_member,none,
|
||||
"did you mean the implicitly-synthesized %1 '%0'?", (StringRef, StringRef))
|
||||
NOTE(note_remapped_type,none,
|
||||
@@ -847,7 +848,7 @@ NOTE(object_literal_resolve_import,none,
|
||||
(StringRef, StringRef, StringRef))
|
||||
|
||||
ERROR(use_local_before_declaration,none,
|
||||
"use of local variable %0 before its declaration", (DeclName))
|
||||
"use of local variable %0 before its declaration", (DeclNameRef))
|
||||
ERROR(unsupported_existential_type,none,
|
||||
"protocol %0 can only be used as a generic constraint because it has "
|
||||
"Self or associated type requirements", (Identifier))
|
||||
@@ -1068,10 +1069,10 @@ NOTE(unwrap_with_guard,none,
|
||||
"if the optional value contains 'nil'", ())
|
||||
ERROR(optional_base_not_unwrapped,none,
|
||||
"value of optional type %0 must be unwrapped to refer to member %1 of "
|
||||
"wrapped base type %2", (Type, DeclName, Type))
|
||||
"wrapped base type %2", (Type, DeclNameRef, Type))
|
||||
NOTE(optional_base_chain,none,
|
||||
"chain the optional using '?' to access member %0 only for non-'nil' "
|
||||
"base values", (DeclName))
|
||||
"base values", (DeclNameRef))
|
||||
ERROR(missing_unwrap_optional_try,none,
|
||||
"value of optional type %0 not unwrapped; did you mean to use 'try!' "
|
||||
"or chain with '?'?",
|
||||
@@ -1138,21 +1139,21 @@ NOTE(candidate_expected_different_labels,none,
|
||||
|
||||
ERROR(member_shadows_global_function,none,
|
||||
"use of %0 refers to %1 %2 rather than %3 %4 in %5 %6",
|
||||
(DeclName, DescriptiveDeclKind, DeclName, DescriptiveDeclKind, DeclName,
|
||||
DescriptiveDeclKind, DeclName))
|
||||
(DeclNameRef, DescriptiveDeclKind, DeclName, DescriptiveDeclKind,
|
||||
DeclName, DescriptiveDeclKind, DeclName))
|
||||
ERROR(member_shadows_global_function_near_match,none,
|
||||
"use of %0 nearly matches %3 %4 in %5 %6 rather than %1 %2",
|
||||
(DeclName, DescriptiveDeclKind, DeclName, DescriptiveDeclKind, DeclName,
|
||||
DescriptiveDeclKind, DeclName))
|
||||
(DeclNameRef, DescriptiveDeclKind, DeclName, DescriptiveDeclKind,
|
||||
DeclName, DescriptiveDeclKind, DeclName))
|
||||
|
||||
ERROR(instance_member_use_on_type,none,
|
||||
"instance member %1 cannot be used on type %0; "
|
||||
"did you mean to use a value of this type instead?", (Type, DeclName))
|
||||
"did you mean to use a value of this type instead?", (Type, DeclNameRef))
|
||||
ERROR(instance_member_in_initializer,none,
|
||||
"cannot use instance member %0 within property initializer; "
|
||||
"property initializers run before 'self' is available", (DeclName))
|
||||
"property initializers run before 'self' is available", (DeclNameRef))
|
||||
ERROR(instance_member_in_default_parameter,none,
|
||||
"cannot use instance member %0 as a default parameter", (DeclName))
|
||||
"cannot use instance member %0 as a default parameter", (DeclNameRef))
|
||||
|
||||
ERROR(missing_argument_named,none,
|
||||
"missing argument for parameter %0 in call", (Identifier))
|
||||
@@ -2178,10 +2179,10 @@ WARNING(append_interpolation_access_control,none,
|
||||
// Protocols and existentials
|
||||
ERROR(assoc_type_outside_of_protocol,none,
|
||||
"associated type %0 can only be used with a concrete type or "
|
||||
"generic parameter base", (DeclName))
|
||||
"generic parameter base", (DeclNameRef))
|
||||
ERROR(typealias_outside_of_protocol,none,
|
||||
"type alias %0 can only be used with a concrete type or "
|
||||
"generic parameter base", (DeclName))
|
||||
"generic parameter base", (DeclNameRef))
|
||||
|
||||
ERROR(objc_protocol_inherits_non_objc_protocol,none,
|
||||
"@objc protocol %0 cannot refine non-@objc protocol %1", (Type, Type))
|
||||
@@ -2903,7 +2904,7 @@ ERROR(no_MaxBuiltinFloatType_found,none,
|
||||
"standard library error: _MaxBuiltinFloatType is not properly defined", ())
|
||||
|
||||
ERROR(no_member_of_module,none,
|
||||
"module %0 has no member named %1", (Identifier, DeclName))
|
||||
"module %0 has no member named %1", (Identifier, DeclNameRef))
|
||||
|
||||
ERROR(super_with_no_base_class,none,
|
||||
"'super' members cannot be referenced in a root class", ())
|
||||
@@ -3049,9 +3050,9 @@ ERROR(collection_literal_empty,none,
|
||||
|
||||
ERROR(unresolved_member_no_inference,none,
|
||||
"reference to member %0 cannot be resolved without a contextual type",
|
||||
(DeclName))
|
||||
(DeclNameRef))
|
||||
ERROR(cannot_infer_base_of_unresolved_member,none,
|
||||
"cannot infer contextual base in reference to member %0", (DeclName))
|
||||
"cannot infer contextual base in reference to member %0", (DeclNameRef))
|
||||
ERROR(unresolved_collection_literal,none,
|
||||
"cannot infer type for empty collection literal without a "
|
||||
"contextual type", ())
|
||||
@@ -3138,9 +3139,9 @@ WARNING(use_of_void_pointer,none,
|
||||
|
||||
// Ambiguities
|
||||
ERROR(ambiguous_decl_ref,none,
|
||||
"ambiguous use of %0", (DeclName))
|
||||
"ambiguous use of %0", (DeclNameRef))
|
||||
ERROR(ambiguous_operator_ref,none,
|
||||
"ambiguous use of operator %0", (DeclName))
|
||||
"ambiguous use of operator %0", (DeclNameRef))
|
||||
NOTE(ambiguous_because_of_trailing_closure,none,
|
||||
"%select{use an explicit argument label instead of a trailing closure|"
|
||||
"avoid using a trailing closure}0 to call %1",
|
||||
@@ -3213,7 +3214,7 @@ NOTE(fix_unqualified_access_top_level_multi,none,
|
||||
WARNING(warn_deprecated_conditional_conformance_outer_access,none,
|
||||
"use of %0 as reference to %1 in %2 %3 will change in future versions of Swift to reference %4 in %5 %6 "
|
||||
"which comes via a conditional conformance",
|
||||
(DeclName, DescriptiveDeclKind, DescriptiveDeclKind, DeclName,
|
||||
(DeclNameRef, DescriptiveDeclKind, DescriptiveDeclKind, DeclName,
|
||||
DescriptiveDeclKind, DescriptiveDeclKind, DeclName))
|
||||
NOTE(fix_deprecated_conditional_conformance_outer_access,none,
|
||||
"use '%0' to continue to reference the %1",
|
||||
@@ -3425,7 +3426,7 @@ NOTE(masked_mutable_property,none,
|
||||
|
||||
ERROR(assignment_let_property_delegating_init,none,
|
||||
"'let' property %0 may not be initialized directly; use "
|
||||
"\"self.init(...)\" or \"self = ...\" instead", (DeclName))
|
||||
"\"self.init(...)\" or \"self = ...\" instead", (DeclNameRef))
|
||||
|
||||
ERROR(label_shadowed, none,
|
||||
"label %0 cannot be reused on an inner statement", (Identifier))
|
||||
@@ -3576,7 +3577,7 @@ ERROR(cannot_convert_single_tuple_into_multiple_arguments,none,
|
||||
|
||||
ERROR(enum_element_pattern_assoc_values_mismatch,none,
|
||||
"pattern with associated values does not match enum case %0",
|
||||
(DeclName))
|
||||
(DeclNameRef))
|
||||
NOTE(enum_element_pattern_assoc_values_remove,none,
|
||||
"remove associated values to make the pattern match", ())
|
||||
ERROR(tuple_pattern_length_mismatch,none,
|
||||
@@ -3584,14 +3585,14 @@ ERROR(tuple_pattern_length_mismatch,none,
|
||||
ERROR(tuple_pattern_label_mismatch,none,
|
||||
"tuple pattern element label %0 must be %1", (Identifier, Identifier))
|
||||
ERROR(enum_element_pattern_member_not_found,none,
|
||||
"enum case %0 not found in type %1", (DeclName, Type))
|
||||
"enum case %0 not found in type %1", (DeclNameRef, Type))
|
||||
ERROR(optional_element_pattern_not_valid_type,none,
|
||||
"'?' pattern cannot match values of type %0", (Type))
|
||||
ERROR(condition_optional_element_pattern_not_valid_type,none,
|
||||
"initializer for conditional binding must have Optional type, not %0",
|
||||
(Type))
|
||||
ERROR(enum_element_pattern_not_member_of_enum,none,
|
||||
"enum case %0 is not a member of type %1", (DeclName, Type))
|
||||
"enum case %0 is not a member of type %1", (DeclNameRef, Type))
|
||||
ERROR(ambiguous_enum_pattern_type,none,
|
||||
"generic enum type %0 is ambiguous without explicit generic parameters "
|
||||
"when matching value of type %1", (Type, Type))
|
||||
@@ -4210,12 +4211,12 @@ ERROR(dynamic_and_library_evolution_not_supported,none,
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
ERROR(dynamic_replacement_accessor_type_mismatch, none,
|
||||
"replaced accessor %0's type does not match", (DeclNameRef))
|
||||
"replaced accessor %0's type does not match", (DeclName))
|
||||
ERROR(dynamic_replacement_accessor_not_dynamic, none,
|
||||
"replaced accessor for %0 is not marked dynamic", (DeclNameRef))
|
||||
"replaced accessor for %0 is not marked dynamic", (DeclName))
|
||||
ERROR(dynamic_replacement_accessor_not_explicit, none,
|
||||
"replaced accessor %select{get|set|_read|_modify|willSet|didSet|unsafeAddress|addressWithOwner|addressWithNativeOwner|unsafeMutableAddress|mutableAddressWithOwner|}0 for %1 is not explicitly defined",
|
||||
(unsigned, DeclNameRef))
|
||||
(unsigned, DeclName))
|
||||
ERROR(dynamic_replacement_function_not_dynamic, none,
|
||||
"replaced function %0 is not marked dynamic", (DeclName))
|
||||
ERROR(dynamic_replacement_function_not_found, none,
|
||||
@@ -4231,7 +4232,8 @@ ERROR(dynamic_replacement_function_of_type_not_found, none,
|
||||
NOTE(dynamic_replacement_found_function_of_type, none,
|
||||
"found function %0 of type %1", (DeclName, Type))
|
||||
ERROR(dynamic_replacement_not_in_extension, none,
|
||||
"dynamicReplacement(for:) of %0 is not defined in an extension or at the file level", (DeclName))
|
||||
"dynamicReplacement(for:) of %0 is not defined in an extension or at the "
|
||||
"file level", (DeclName))
|
||||
ERROR(dynamic_replacement_must_not_be_dynamic, none,
|
||||
"dynamicReplacement(for:) of %0 must not be dynamic itself", (DeclName))
|
||||
ERROR(dynamic_replacement_replaced_not_objc_dynamic, none,
|
||||
@@ -4239,9 +4241,9 @@ ERROR(dynamic_replacement_replaced_not_objc_dynamic, none,
|
||||
ERROR(dynamic_replacement_replacement_not_objc_dynamic, none,
|
||||
"%0 is marked @objc dynamic", (DeclName))
|
||||
ERROR(dynamic_replacement_replaced_constructor_is_convenience, none,
|
||||
"replaced constructor %0 is marked as convenience", (DeclName))
|
||||
"replaced constructor %0 is marked as convenience", (DeclNameRef))
|
||||
ERROR(dynamic_replacement_replaced_constructor_is_not_convenience, none,
|
||||
"replaced constructor %0 is not marked as convenience", (DeclName))
|
||||
"replaced constructor %0 is not marked as convenience", (DeclNameRef))
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MARK: @available
|
||||
@@ -4675,7 +4677,7 @@ WARNING(property_wrapper_init_initialValue,none,
|
||||
"to 'init(wrappedValue:)'; use of 'init(initialValue:)' is deprecated",
|
||||
())
|
||||
ERROR(property_wrapper_projection_value_missing,none,
|
||||
"could not find projection value property %0", (Identifier))
|
||||
"could not find projection value property %0", (DeclNameRef))
|
||||
ERROR(property_wrapper_missing_arg_init, none, "missing argument for parameter "
|
||||
"%0 in property wrapper initializer; add 'wrappedValue' and %0 "
|
||||
"arguments in '@%1(...)'", (Identifier, StringRef))
|
||||
|
||||
@@ -1487,11 +1487,11 @@ public:
|
||||
/// sema), or may just be a use of an unknown identifier.
|
||||
///
|
||||
class UnresolvedDeclRefExpr : public Expr {
|
||||
DeclName Name;
|
||||
DeclNameRef Name;
|
||||
DeclNameLoc Loc;
|
||||
|
||||
public:
|
||||
UnresolvedDeclRefExpr(DeclName name, DeclRefKind refKind, DeclNameLoc loc)
|
||||
UnresolvedDeclRefExpr(DeclNameRef name, DeclRefKind refKind, DeclNameLoc loc)
|
||||
: Expr(ExprKind::UnresolvedDeclRef, /*Implicit=*/loc.isInvalid()),
|
||||
Name(name), Loc(loc) {
|
||||
Bits.UnresolvedDeclRefExpr.DeclRefKind = static_cast<unsigned>(refKind);
|
||||
@@ -1503,7 +1503,7 @@ public:
|
||||
static UnresolvedDeclRefExpr *createImplicit(
|
||||
ASTContext &C, DeclName name,
|
||||
DeclRefKind refKind = DeclRefKind::Ordinary) {
|
||||
return new (C) UnresolvedDeclRefExpr(name, refKind,
|
||||
return new (C) UnresolvedDeclRefExpr(DeclNameRef_(name), refKind,
|
||||
DeclNameLoc());
|
||||
}
|
||||
|
||||
@@ -1520,7 +1520,7 @@ public:
|
||||
}
|
||||
|
||||
bool hasName() const { return static_cast<bool>(Name); }
|
||||
DeclName getName() const { return Name; }
|
||||
DeclNameRef getName() const { return Name; }
|
||||
|
||||
DeclRefKind getRefKind() const {
|
||||
return static_cast<DeclRefKind>(Bits.UnresolvedDeclRefExpr.DeclRefKind);
|
||||
@@ -1788,11 +1788,11 @@ class UnresolvedMemberExpr final
|
||||
public TrailingCallArguments<UnresolvedMemberExpr> {
|
||||
SourceLoc DotLoc;
|
||||
DeclNameLoc NameLoc;
|
||||
DeclName Name;
|
||||
DeclNameRef Name;
|
||||
Expr *Argument;
|
||||
|
||||
UnresolvedMemberExpr(SourceLoc dotLoc, DeclNameLoc nameLoc,
|
||||
DeclName name, Expr *argument,
|
||||
DeclNameRef name, Expr *argument,
|
||||
ArrayRef<Identifier> argLabels,
|
||||
ArrayRef<SourceLoc> argLabelLocs,
|
||||
bool hasTrailingClosure,
|
||||
@@ -1801,12 +1801,12 @@ class UnresolvedMemberExpr final
|
||||
public:
|
||||
/// Create a new unresolved member expression with no arguments.
|
||||
static UnresolvedMemberExpr *create(ASTContext &ctx, SourceLoc dotLoc,
|
||||
DeclNameLoc nameLoc, DeclName name,
|
||||
DeclNameLoc nameLoc, DeclNameRef name,
|
||||
bool implicit);
|
||||
|
||||
/// Create a new unresolved member expression.
|
||||
static UnresolvedMemberExpr *create(ASTContext &ctx, SourceLoc dotLoc,
|
||||
DeclNameLoc nameLoc, DeclName name,
|
||||
DeclNameLoc nameLoc, DeclNameRef name,
|
||||
SourceLoc lParenLoc,
|
||||
ArrayRef<Expr *> args,
|
||||
ArrayRef<Identifier> argLabels,
|
||||
@@ -1815,7 +1815,7 @@ public:
|
||||
Expr *trailingClosure,
|
||||
bool implicit);
|
||||
|
||||
DeclName getName() const { return Name; }
|
||||
DeclNameRef getName() const { return Name; }
|
||||
DeclNameLoc getNameLoc() const { return NameLoc; }
|
||||
SourceLoc getDotLoc() const { return DotLoc; }
|
||||
Expr *getArgument() const { return Argument; }
|
||||
@@ -2411,12 +2411,12 @@ class UnresolvedDotExpr : public Expr {
|
||||
Expr *SubExpr;
|
||||
SourceLoc DotLoc;
|
||||
DeclNameLoc NameLoc;
|
||||
DeclName Name;
|
||||
DeclNameRef Name;
|
||||
ArrayRef<ValueDecl *> OuterAlternatives;
|
||||
|
||||
public:
|
||||
UnresolvedDotExpr(
|
||||
Expr *subexpr, SourceLoc dotloc, DeclName name, DeclNameLoc nameloc,
|
||||
Expr *subexpr, SourceLoc dotloc, DeclNameRef name, DeclNameLoc nameloc,
|
||||
bool Implicit,
|
||||
ArrayRef<ValueDecl *> outerAlternatives = ArrayRef<ValueDecl *>())
|
||||
: Expr(ExprKind::UnresolvedDot, Implicit), SubExpr(subexpr),
|
||||
@@ -2430,7 +2430,7 @@ public:
|
||||
static UnresolvedDotExpr *createImplicit(
|
||||
ASTContext &C, Expr *base, DeclName name) {
|
||||
return new (C) UnresolvedDotExpr(base, SourceLoc(),
|
||||
name, DeclNameLoc(),
|
||||
DeclNameRef_(name), DeclNameLoc(),
|
||||
/*implicit=*/true);
|
||||
}
|
||||
|
||||
@@ -2479,7 +2479,7 @@ public:
|
||||
Expr *getBase() const { return SubExpr; }
|
||||
void setBase(Expr *e) { SubExpr = e; }
|
||||
|
||||
DeclName getName() const { return Name; }
|
||||
DeclNameRef getName() const { return Name; }
|
||||
DeclNameLoc getNameLoc() const { return NameLoc; }
|
||||
|
||||
ArrayRef<ValueDecl *> getOuterAlternatives() const {
|
||||
@@ -4892,7 +4892,7 @@ class KeyPathExpr : public Expr {
|
||||
|
||||
public:
|
||||
/// A single stored component, which will be one of:
|
||||
/// - an unresolved DeclName, which has to be type-checked
|
||||
/// - an unresolved DeclNameRef, which has to be type-checked
|
||||
/// - a resolved ValueDecl, referring to
|
||||
/// - a subscript index expression, which may or may not be resolved
|
||||
/// - an optional chaining, forcing, or wrapping component
|
||||
@@ -4913,11 +4913,11 @@ public:
|
||||
|
||||
private:
|
||||
union DeclNameOrRef {
|
||||
DeclName UnresolvedName;
|
||||
DeclNameRef UnresolvedName;
|
||||
ConcreteDeclRef ResolvedDecl;
|
||||
|
||||
DeclNameOrRef() : UnresolvedName{} {}
|
||||
DeclNameOrRef(DeclName un) : UnresolvedName(un) {}
|
||||
DeclNameOrRef(DeclNameRef un) : UnresolvedName(un) {}
|
||||
DeclNameOrRef(ConcreteDeclRef rd) : ResolvedDecl(rd) {}
|
||||
} Decl;
|
||||
|
||||
@@ -4958,7 +4958,7 @@ public:
|
||||
{}
|
||||
|
||||
/// Create an unresolved component for a property.
|
||||
static Component forUnresolvedProperty(DeclName UnresolvedName,
|
||||
static Component forUnresolvedProperty(DeclNameRef UnresolvedName,
|
||||
SourceLoc Loc) {
|
||||
return Component(nullptr,
|
||||
UnresolvedName, nullptr, {}, {},
|
||||
@@ -5173,7 +5173,7 @@ public:
|
||||
void setSubscriptIndexHashableConformances(
|
||||
ArrayRef<ProtocolConformanceRef> hashables);
|
||||
|
||||
DeclName getUnresolvedDeclName() const {
|
||||
DeclNameRef getUnresolvedDeclName() const {
|
||||
switch (getKind()) {
|
||||
case Kind::UnresolvedProperty:
|
||||
return Decl.UnresolvedName;
|
||||
|
||||
@@ -505,13 +505,13 @@ class EnumElementPattern : public Pattern {
|
||||
TypeLoc ParentType;
|
||||
SourceLoc DotLoc;
|
||||
DeclNameLoc NameLoc;
|
||||
DeclName Name;
|
||||
DeclNameRef Name;
|
||||
PointerUnion<EnumElementDecl *, Expr*> ElementDeclOrUnresolvedOriginalExpr;
|
||||
Pattern /*nullable*/ *SubPattern;
|
||||
|
||||
public:
|
||||
EnumElementPattern(TypeLoc ParentType, SourceLoc DotLoc, DeclNameLoc NameLoc,
|
||||
DeclName Name, EnumElementDecl *Element,
|
||||
DeclNameRef Name, EnumElementDecl *Element,
|
||||
Pattern *SubPattern, Optional<bool> Implicit = None)
|
||||
: Pattern(PatternKind::EnumElement),
|
||||
ParentType(ParentType), DotLoc(DotLoc), NameLoc(NameLoc), Name(Name),
|
||||
@@ -525,7 +525,7 @@ public:
|
||||
/// contextual type.
|
||||
EnumElementPattern(SourceLoc DotLoc,
|
||||
DeclNameLoc NameLoc,
|
||||
DeclName Name,
|
||||
DeclNameRef Name,
|
||||
Pattern *SubPattern,
|
||||
Expr *UnresolvedOriginalExpr)
|
||||
: Pattern(PatternKind::EnumElement),
|
||||
@@ -551,7 +551,7 @@ public:
|
||||
|
||||
void setSubPattern(Pattern *p) { SubPattern = p; }
|
||||
|
||||
DeclName getName() const { return Name; }
|
||||
DeclNameRef getName() const { return Name; }
|
||||
|
||||
EnumElementDecl *getElementDecl() const {
|
||||
return ElementDeclOrUnresolvedOriginalExpr.dyn_cast<EnumElementDecl*>();
|
||||
|
||||
@@ -263,23 +263,23 @@ class ComponentIdentTypeRepr : public IdentTypeRepr {
|
||||
///
|
||||
/// The initial parsed representation is always an identifier, and
|
||||
/// name binding will resolve this to a specific declaration.
|
||||
llvm::PointerUnion<DeclName, TypeDecl *> IdOrDecl;
|
||||
llvm::PointerUnion<DeclNameRef, TypeDecl *> IdOrDecl;
|
||||
|
||||
/// The declaration context from which the bound declaration was
|
||||
/// found. only valid if IdOrDecl is a TypeDecl.
|
||||
DeclContext *DC;
|
||||
|
||||
protected:
|
||||
ComponentIdentTypeRepr(TypeReprKind K, DeclNameLoc Loc, DeclName Id)
|
||||
ComponentIdentTypeRepr(TypeReprKind K, DeclNameLoc Loc, DeclNameRef Id)
|
||||
: IdentTypeRepr(K), Loc(Loc), IdOrDecl(Id), DC(nullptr) {}
|
||||
|
||||
public:
|
||||
DeclNameLoc getNameLoc() const { return Loc; }
|
||||
DeclName getNameRef() const;
|
||||
DeclNameRef getNameRef() const;
|
||||
|
||||
/// Replace the identifier with a new identifier, e.g., due to typo
|
||||
/// correction.
|
||||
void overwriteNameRef(DeclName newId) { IdOrDecl = newId; }
|
||||
void overwriteNameRef(DeclNameRef newId) { IdOrDecl = newId; }
|
||||
|
||||
/// Return true if this has been name-bound already.
|
||||
bool isBound() const { return IdOrDecl.is<TypeDecl *>(); }
|
||||
@@ -312,7 +312,7 @@ protected:
|
||||
/// A simple identifier type like "Int".
|
||||
class SimpleIdentTypeRepr : public ComponentIdentTypeRepr {
|
||||
public:
|
||||
SimpleIdentTypeRepr(DeclNameLoc Loc, DeclName Id)
|
||||
SimpleIdentTypeRepr(DeclNameLoc Loc, DeclNameRef Id)
|
||||
: ComponentIdentTypeRepr(TypeReprKind::SimpleIdent, Loc, Id) {}
|
||||
|
||||
// SmallVector::emplace_back will never need to call this because
|
||||
@@ -342,7 +342,7 @@ class GenericIdentTypeRepr final : public ComponentIdentTypeRepr,
|
||||
friend TrailingObjects;
|
||||
SourceRange AngleBrackets;
|
||||
|
||||
GenericIdentTypeRepr(DeclNameLoc Loc, DeclName Id,
|
||||
GenericIdentTypeRepr(DeclNameLoc Loc, DeclNameRef Id,
|
||||
ArrayRef<TypeRepr*> GenericArgs,
|
||||
SourceRange AngleBrackets)
|
||||
: ComponentIdentTypeRepr(TypeReprKind::GenericIdent, Loc, Id),
|
||||
@@ -360,7 +360,7 @@ class GenericIdentTypeRepr final : public ComponentIdentTypeRepr,
|
||||
public:
|
||||
static GenericIdentTypeRepr *create(const ASTContext &C,
|
||||
DeclNameLoc Loc,
|
||||
DeclName Id,
|
||||
DeclNameRef Id,
|
||||
ArrayRef<TypeRepr*> GenericArgs,
|
||||
SourceRange AngleBrackets);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user