@@ -1292,6 +1292,28 @@ WARNING(pattern_type_access_inferred_warn,none,
1292
1292
" because its type %6 uses "
1293
1293
" %select{a private|a fileprivate|an internal|%error|%error}5 type" ,
1294
1294
(bool , bool , bool , AccessLevel, bool , AccessLevel, Type))
1295
+ ERROR(pattern_type_not_usable_from_inline,none,
1296
+ " type referenced from a '@usableFromInline' "
1297
+ " %select{%select{variable|constant}0|property}1 "
1298
+ " must be '@usableFromInline' or public" ,
1299
+ (bool , bool ))
1300
+ WARNING(pattern_type_not_usable_from_inline_warn,none,
1301
+ " type referenced from a '@usableFromInline' "
1302
+ " %select{%select{variable|constant}0|property}1 "
1303
+ " should be '@usableFromInline' or public" ,
1304
+ (bool , bool ))
1305
+ ERROR(pattern_type_not_usable_from_inline_inferred,none,
1306
+ " type referenced from a '@usableFromInline' "
1307
+ " %select{%select{variable|constant}0|property}1 "
1308
+ " with inferred type %2 "
1309
+ " must be '@usableFromInline' or public" ,
1310
+ (bool , bool , Type))
1311
+ WARNING(pattern_type_not_usable_from_inline_inferred_warn,none,
1312
+ " type referenced from a '@usableFromInline' "
1313
+ " %select{%select{variable|constant}0|property}1 "
1314
+ " with inferred type %2 "
1315
+ " should be '@usableFromInline' or public" ,
1316
+ (bool , bool , Type))
1295
1317
ERROR(pattern_binds_no_variables,none,
1296
1318
" %select{property|global variable}0 declaration does not bind any "
1297
1319
" variables" ,
@@ -1346,6 +1368,16 @@ WARNING(type_alias_underlying_type_access_warn,none,
1346
1368
" because its underlying type uses "
1347
1369
" %select{a private|a fileprivate|an internal|%error|%error}2 type" ,
1348
1370
(bool , AccessLevel, AccessLevel, bool ))
1371
+ ERROR(type_alias_underlying_type_not_usable_from_inline,none,
1372
+ " type referenced from the underlying type of a "
1373
+ " '@usableFromInline' type alias "
1374
+ " must be '@usableFromInline' or public" ,
1375
+ ())
1376
+ WARNING(type_alias_underlying_type_not_usable_from_inline_warn,none,
1377
+ " type referenced from the underlying type of a "
1378
+ " '@usableFromInline' type alias "
1379
+ " should be '@usableFromInline' or public" ,
1380
+ ())
1349
1381
1350
1382
// Subscripts
1351
1383
ERROR(subscript_type_access,none,
@@ -1363,6 +1395,14 @@ WARNING(subscript_type_access_warn,none,
1363
1395
" because its %select{index|element type}3 uses "
1364
1396
" %select{a private|a fileprivate|an internal|%error|%error}2 type" ,
1365
1397
(bool , AccessLevel, AccessLevel, bool ))
1398
+ ERROR(subscript_type_usable_from_inline,none,
1399
+ " %select{index type|element type}0 of a '@usableFromInline' subscript "
1400
+ " must be '@usableFromInline' or public" ,
1401
+ (bool ))
1402
+ WARNING(subscript_type_usable_from_inline_warn,none,
1403
+ " %select{index type|element type}0 of a '@usableFromInline' subscript "
1404
+ " should be '@usableFromInline' or public" ,
1405
+ (bool ))
1366
1406
1367
1407
// Functions
1368
1408
ERROR(function_type_access,none,
@@ -1381,6 +1421,16 @@ WARNING(function_type_access_warn,none,
1381
1421
" because its %select{parameter|result}5 uses "
1382
1422
" %select{a private|a fileprivate|an internal|%error|%error}3 type" ,
1383
1423
(bool , AccessLevel, bool , AccessLevel, unsigned , bool ))
1424
+ ERROR(function_type_usable_from_inline,none,
1425
+ " the %select{parameter|result}1 of a "
1426
+ " '@usableFromInline' %select{function|method|initializer}0 "
1427
+ " must be '@usableFromInline' or public" ,
1428
+ (unsigned , bool ))
1429
+ WARNING(function_type_usable_from_inline_warn,none,
1430
+ " the %select{parameter|result}1 of a "
1431
+ " '@usableFromInline' %select{function|method|initializer}0 "
1432
+ " should be '@usableFromInline' or public" ,
1433
+ (unsigned , bool ))
1384
1434
ERROR(noreturn_not_supported,none,
1385
1435
" '@noreturn' has been removed; functions that never return should have a "
1386
1436
" return type of 'Never' instead" , ())
@@ -1585,6 +1635,12 @@ WARNING(protocol_access_warn,none,
1585
1635
" %select{protocol should not refine|protocol's 'where' clause should not use}2}0 "
1586
1636
" %select{a private|a fileprivate|an internal|%error|%error}3 protocol" ,
1587
1637
(bool , AccessLevel, bool , AccessLevel, bool ))
1638
+ ERROR(protocol_usable_from_inline,none,
1639
+ " protocol %select{refined|used}0 by '@usableFromInline' protocol "
1640
+ " must be '@usableForInline' or public" , (bool ))
1641
+ WARNING(protocol_usable_from_inline_warn,none,
1642
+ " protocol %select{refined|used}0 by '@usableFromInline' protocol "
1643
+ " should be '@usableForInline' or public" , (bool ))
1588
1644
ERROR(protocol_property_must_be_computed_var,none,
1589
1645
" immutable property requirement must be declared as 'var' with a "
1590
1646
" '{ get }' specifier" , ())
@@ -1627,6 +1683,16 @@ WARNING(associated_type_access_warn,none,
1627
1683
" %select{a private|a fileprivate|an internal|%error|%error}1 type in its "
1628
1684
" %select{default definition|requirement}2 " ,
1629
1685
(AccessLevel, AccessLevel, unsigned ))
1686
+ ERROR(associated_type_not_usable_from_inline,none,
1687
+ " type referenced from a "
1688
+ " %select{default definition|requirement}0 of an associated type in a "
1689
+ " '@usableFromInline' protocol must be '@usableFromInline' or public" ,
1690
+ (unsigned ))
1691
+ WARNING(associated_type_not_usable_from_inline_warn,none,
1692
+ " type referenced from a "
1693
+ " %select{default definition|requirement}0 of an associated type in a "
1694
+ " '@usableFromInline' protocol should be '@usableFromInline' or public" ,
1695
+ (unsigned ))
1630
1696
1631
1697
NOTE(bad_associated_type_deduction,none,
1632
1698
" unable to infer associated type %0 for protocol %1" ,
@@ -1879,6 +1945,16 @@ WARNING(generic_param_access_warn,none,
1879
1945
" because its generic %select{parameter|requirement}5 uses "
1880
1946
" %select{a private|a fileprivate|an internal|%error|%error}3 type" ,
1881
1947
(DescriptiveDeclKind, bool , AccessLevel, AccessLevel, bool , bool ))
1948
+ ERROR(generic_param_usable_from_inline,none,
1949
+ " type referenced from a "
1950
+ " generic %select{parameter|requirement}1 of a '@usableFromInline' %0 "
1951
+ " must be '@usableFromInline' or public" ,
1952
+ (DescriptiveDeclKind, bool ))
1953
+ WARNING(generic_param_usable_from_inline_warn,none,
1954
+ " type referenced from a "
1955
+ " generic %select{parameter|requirement}1 of a '@usableFromInline' %0 "
1956
+ " should be '@usableFromInline' or public" ,
1957
+ (DescriptiveDeclKind, bool ))
1882
1958
1883
1959
ERROR(override_multiple_decls_base,none,
1884
1960
" declaration %0 cannot override more than one superclass declaration" ,
@@ -2108,6 +2184,12 @@ WARNING(enum_case_access_warn,none,
2108
2184
" enum case in %select{a private|a fileprivate|an internal|a public|%error}0 enum "
2109
2185
" uses %select{a private|a fileprivate|an internal|%error|%error}1 type" ,
2110
2186
(AccessLevel, AccessLevel))
2187
+ ERROR(enum_case_usable_from_inline,none,
2188
+ " type of enum case in '@usableFromInline' enum "
2189
+ " must be '@usableFromInline' or public" , ())
2190
+ WARNING(enum_case_usable_from_inline_warn,none,
2191
+ " type of enum case in '@usableFromInline' enum "
2192
+ " should be '@usableFromInline' or public" , ())
2111
2193
ERROR(enum_stored_property,none,
2112
2194
" enums must not contain stored properties" , ())
2113
2195
@@ -2145,6 +2227,17 @@ WARNING(enum_raw_type_access_warn,none,
2145
2227
" %select{a private|a fileprivate|an internal|%error|%error}2 type" ,
2146
2228
(bool , AccessLevel, AccessLevel, bool ))
2147
2229
2230
+ ERROR(enum_raw_type_not_usable_from_inline,none,
2231
+ " type referenced from the raw type of a "
2232
+ " '@usableFromInline' enum "
2233
+ " must be '@usableFromInline' or public" ,
2234
+ ())
2235
+ WARNING(enum_raw_type_not_usable_from_inline_warn,none,
2236
+ " type referenced from the raw type of a "
2237
+ " '@usableFromInline' enum "
2238
+ " should be '@usableFromInline' or public" ,
2239
+ ())
2240
+
2148
2241
ERROR(empty_enum_raw_type,none,
2149
2242
" an enum with no cases cannot declare a raw type" , ())
2150
2243
ERROR(enum_raw_value_without_raw_type,none,
@@ -3263,6 +3356,17 @@ WARNING(class_super_access_warn,none,
3263
3356
" |uses %select{a private|a fileprivate|an internal|%error|%error}2 "
3264
3357
" type as a generic parameter}4" ,
3265
3358
(bool , AccessLevel, AccessLevel, bool , bool ))
3359
+ ERROR(class_super_not_usable_from_inline,none,
3360
+ " %select{type referenced from |}0the superclass of "
3361
+ " a '@usableFromInline' class "
3362
+ " must be '@usableFromInline' or public" ,
3363
+ (bool ))
3364
+ WARNING(class_super_not_usable_from_inline_warn,none,
3365
+ " %select{type referenced from |}0the superclass of "
3366
+ " a '@usableFromInline' class "
3367
+ " should be '@usableFromInline' or public" ,
3368
+ (bool ))
3369
+
3266
3370
ERROR(dot_protocol_on_non_existential,none,
3267
3371
" cannot use 'Protocol' with non-protocol type %0" , (Type))
3268
3372
ERROR(tuple_single_element,none,
0 commit comments