@@ -8351,16 +8351,16 @@ ERROR(attr_abi_mismatched_kind,none,
8351
8351
8352
8352
ERROR(attr_abi_mismatched_arity,none,
8353
8353
" 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 ))
8356
8356
8357
8357
ERROR(attr_abi_mismatched_throws,none,
8358
8358
" cannot give %0 the ABI of a %kindonly0 which %select{cannot|can}1 throw" ,
8359
- (ValueDecl *, /* abiCanThrow=*/ bool ))
8359
+ (Decl *, /* abiCanThrow=*/ bool ))
8360
8360
8361
8361
ERROR(attr_abi_mismatched_async,none,
8362
8362
" cannot give %0 the ABI of %select{a non-async|an async}1 %kindonly0" ,
8363
- (ValueDecl *, /* abiIsAsync=*/ bool ))
8363
+ (Decl *, /* abiIsAsync=*/ bool ))
8364
8364
8365
8365
ERROR(attr_abi_mismatched_pbd_size,none,
8366
8366
" cannot give pattern binding the ABI of a binding with "
@@ -8369,13 +8369,89 @@ ERROR(attr_abi_mismatched_pbd_size,none,
8369
8369
8370
8370
ERROR(attr_abi_mismatched_var,none,
8371
8371
" no match for %select{%kind0 in the ABI|ABI %kind0}1" ,
8372
- (ValueDecl *, /* isABI=*/ bool ))
8372
+ (Decl *, /* isABI=*/ bool ))
8373
8373
8374
8374
ERROR(attr_abi_incompatible_with_silgen_name,none,
8375
8375
" cannot use '@_silgen_name' and '@abi' on the same %0 because they serve "
8376
8376
" the same purpose" ,
8377
8377
(DescriptiveDeclKind))
8378
8378
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
+
8379
8455
//===----------------------------------------------------------------------===//
8380
8456
// MARK: Isolated conformances
8381
8457
//===----------------------------------------------------------------------===//
0 commit comments