@@ -8351,16 +8351,16 @@ ERROR(attr_abi_mismatched_kind,none,
83518351
83528352ERROR(attr_abi_mismatched_arity,none,
83538353 " cannot give %kind0 the ABI of a %kindonly0 with a different number of "
8354- " low-level parameters " ,
8355- (ValueDecl * ))
8354+ " %select{|generic }1parameters " ,
8355+ (Decl *, /* genericParams= */ bool ))
83568356
83578357ERROR(attr_abi_mismatched_throws,none,
83588358 " cannot give %0 the ABI of a %kindonly0 which %select{cannot|can}1 throw" ,
8359- (ValueDecl *, /* abiCanThrow=*/ bool ))
8359+ (Decl *, /* abiCanThrow=*/ bool ))
83608360
83618361ERROR(attr_abi_mismatched_async,none,
83628362 " cannot give %0 the ABI of %select{a non-async|an async}1 %kindonly0" ,
8363- (ValueDecl *, /* abiIsAsync=*/ bool ))
8363+ (Decl *, /* abiIsAsync=*/ bool ))
83648364
83658365ERROR(attr_abi_mismatched_pbd_size,none,
83668366 " cannot give pattern binding the ABI of a binding with "
@@ -8369,13 +8369,89 @@ ERROR(attr_abi_mismatched_pbd_size,none,
83698369
83708370ERROR(attr_abi_mismatched_var,none,
83718371 " no match for %select{%kind0 in the ABI|ABI %kind0}1" ,
8372- (ValueDecl *, /* isABI=*/ bool ))
8372+ (Decl *, /* isABI=*/ bool ))
83738373
83748374ERROR(attr_abi_incompatible_with_silgen_name,none,
83758375 " cannot use '@_silgen_name' and '@abi' on the same %0 because they serve "
83768376 " the same purpose" ,
83778377 (DescriptiveDeclKind))
83788378
8379+ ERROR(attr_abi_missing_attr,none,
8380+ " missing '%0' %select{attribute|modifier}1 in '@abi'" ,
8381+ (StringRef, bool ))
8382+ ERROR(attr_abi_extra_attr,none,
8383+ " extra %select{|implicit }2'%0' %select{attribute|modifier}1 in '@abi'" ,
8384+ (StringRef, bool , /* isImplicit=*/ bool ))
8385+ ERROR(attr_abi_forbidden_attr,none,
8386+ " unused '%0' %select{attribute|modifier}1 in '@abi'" ,
8387+ (StringRef, bool ))
8388+ REMARK(abi_attr_inferred_attribute,none,
8389+ " inferred '%0' in '@abi' to match %select{attribute|modifier}1 on API" ,
8390+ (StringRef, bool ))
8391+
8392+ ERROR(attr_abi_mismatched_attr,none,
8393+ " '%0' %select{attribute|modifier}1 in '@abi' should match '%2'" ,
8394+ (StringRef, bool , StringRef))
8395+ NOTE(attr_abi_matching_attr_here,none,
8396+ " %select{should match|matches}0 %select{attribute|modifier}1 "
8397+ " %select{|implicitly added }2here" ,
8398+ (/* matches=*/ bool , /* isModifier=*/ bool , /* isImplicit=*/ bool ))
8399+
8400+ #define TYPE_ORIGIN (KIND_IDX, DECL_IDX ) " %select{|%kind" #DECL_IDX " |" \
8401+ " self parameter |result |thrown |%error}" #KIND_IDX
8402+ ERROR (attr_abi_mismatched_type,none,
8403+ TYPE_ORIGIN (0 , 1 ) "type %2 in '@abi' should match %3",
8404+ (unsigned , Decl *, Type, Type))
8405+ NOTE(attr_abi_should_match_type_here,none,
8406+ " should match type here" , ())
8407+
8408+ ERROR(attr_abi_mismatched_generic_signature,none,
8409+ " generic signature '%0' in '@abi' is not compatible with '%1'" ,
8410+ (StringRef, StringRef))
8411+ ERROR(attr_abi_missing_generic_signature,none,
8412+ " declaration in '@abi' should have generic signature compatible with "
8413+ " '%0'" ,
8414+ (StringRef))
8415+ ERROR(attr_abi_extra_generic_signature,none,
8416+ " declaration in '@abi' should not have generic signature because %0 "
8417+ " is not generic" ,
8418+ (Decl *))
8419+
8420+ ERROR(attr_abi_mismatched_param_modifier,none,
8421+ " %select{default |}0%select{attribute|modifier}2 %select{|'%0' }0"
8422+ " on " TYPE_ORIGIN(3 , 4 ) "in '@abi' is not compatible with "
8423+ "%select{default |' %1' }1 " ,
8424+ (StringRef, StringRef, /*isModifier=*/bool, unsigned, Decl *))
8425+ ERROR(attr_abi_no_default_arguments,none,
8426+ " %kind0 in ' @abi' should not have a default argument; it does not "
8427+ " affect the parameter' s ABI",
8428+ (Decl *))
8429+
8430+ // These macros insert ' final ' , ' non-final ' , or nothing depending on both the
8431+ // current decl and its counterpart, such that ' non-final ' is used if the
8432+ // counterpart would be described as ' final ' or ' static ' . They must be kept in
8433+ // sync with `StaticnessAndFinality`.
8434+ #define NONFINAL_OR_NOTHING(COUNTERPART) \
8435+ "%select{||non-final |non-final |non-final |%error}" #COUNTERPART
8436+ #define FINAL_OR_NONFINAL_OR_NOTHING(CURRENT, COUNTERPART, FINAL_OK) \
8437+ "%select{|%select{" NONFINAL_OR_NOTHING(COUNTERPART) \
8438+ "|" NONFINAL_OR_NOTHING(COUNTERPART) \
8439+ "|final |final ||%error}" #CURRENT "}" #FINAL_OK
8440+
8441+ ERROR(attr_abi_static_final_mismatch,none,
8442+ FINAL_OR_NONFINAL_OR_NOTHING(0, 2, 4) "%kind1 in ' @abi' should be "
8443+ FINAL_OR_NONFINAL_OR_NOTHING(2, 0, 4) "%kindonly3 to ensure ABI "
8444+ "compatibility",
8445+ (uint8_t, Decl *, uint8_t, Decl *, /*isClass=*/bool))
8446+
8447+ #undef NONFINAL_OR_NOTHING
8448+ #undef FINAL_OR_NONFINAL_OR_NOTHING
8449+
8450+ ERROR(attr_abi_failable_mismatch,none,
8451+ "cannot give %select{non-failable|failable}1 %kind0 the ABI of a "
8452+ "%select{non-failable|failable}2 %kindonly0",
8453+ (Decl *, bool, bool))
8454+
83798455//===----------------------------------------------------------------------===//
83808456// MARK: Isolated conformances
83818457//===----------------------------------------------------------------------===//
0 commit comments