@@ -3056,7 +3056,7 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3056
3056
3057
3057
if (lowering.isTrivial () && !conformance) {
3058
3058
// A trivial type can lack a conformance in a few cases:
3059
- // (1) containing or being a public , non-frozen type
3059
+ // (1) containing or being a exported , non-frozen type
3060
3060
// (2) containing or being a generic type which doesn't conform
3061
3061
// unconditionally but in this particular instantiation is trivial
3062
3062
// (3) being a special type that's not worth forming a conformance for
@@ -3072,13 +3072,21 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3072
3072
// }
3073
3073
// (5) being defined in a different module
3074
3074
// (6) being defined in a module built from interface
3075
+ // (7) being or containing a variadic generic type which doesn't conform
3076
+ // unconditionally but does in this case
3077
+ // (8) being or containing the error type
3075
3078
bool hasNoNonconformingNode = visitAggregateLeaves (
3076
3079
origType, substType, forExpansion,
3077
3080
/* isLeafAggregate=*/
3078
3081
[&](auto ty, auto origTy, auto *field, auto index) -> bool {
3082
+ // These show up in the context of non-conforming variadic generics
3083
+ // which may lack a conformance (case (7)).
3084
+ if (isa<SILPackType>(ty) || isa<PackExpansionType>(ty))
3085
+ return true ;
3086
+
3079
3087
auto *nominal = ty.getAnyNominal ();
3080
- // Non- nominal aggregates must not be responsible for non-conformance;
3081
- // walk into them .
3088
+ // Only pack-related non- nominal aggregates may be responsible for
3089
+ // non-conformance; walk into the rest .
3082
3090
if (!nominal)
3083
3091
return false ;
3084
3092
@@ -3089,11 +3097,11 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3089
3097
return true ;
3090
3098
}
3091
3099
3092
- // Public , non-frozen trivial types may not conform (case (1)).
3100
+ // Exported , non-frozen trivial types may not conform (case (1)).
3093
3101
if (nominal
3094
3102
->getFormalAccessScope (/* useDC=*/ nullptr ,
3095
3103
/* treatUsableFromInlineAsPublic=*/ true )
3096
- .isPublic ())
3104
+ .isPublicOrPackage ())
3097
3105
return true ;
3098
3106
3099
3107
auto *module = nominal->getModuleContext ();
@@ -3113,6 +3121,15 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3113
3121
3114
3122
auto isTopLevel = !field;
3115
3123
3124
+ // The error type doesn't conform but is trivial (case (8)).
3125
+ if (isa<ErrorType>(ty))
3126
+ return false ;
3127
+
3128
+ // These show up in the context of non-conforming variadic generics
3129
+ // which may lack a conformance (case (7)).
3130
+ if (isa<SILPackType>(ty) || isa<PackExpansionType>(ty))
3131
+ return false ;
3132
+
3116
3133
// A BitwiseCopyable conformer appearing within its layout doesn't
3117
3134
// explain why substType doesn't itself conform.
3118
3135
if (M.checkConformance (ty, bitwiseCopyableProtocol))
@@ -3159,11 +3176,11 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3159
3176
return false ;
3160
3177
}
3161
3178
3162
- // Public , non-frozen trivial types may not conform (case (1)).
3179
+ // Exported , non-frozen trivial types may not conform (case (1)).
3163
3180
if (nominal
3164
3181
->getFormalAccessScope (/* useDC=*/ nullptr ,
3165
3182
/* treatUsableFromInlineAsPublic=*/ true )
3166
- .isPublic ())
3183
+ .isPublicOrPackage ())
3167
3184
return false ;
3168
3185
3169
3186
auto *module = nominal->getModuleContext ();
0 commit comments