@@ -3056,7 +3056,7 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
30563056
30573057 if (lowering.isTrivial () && !conformance) {
30583058 // 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
30603060 // (2) containing or being a generic type which doesn't conform
30613061 // unconditionally but in this particular instantiation is trivial
30623062 // (3) being a special type that's not worth forming a conformance for
@@ -3072,13 +3072,21 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
30723072 // }
30733073 // (5) being defined in a different module
30743074 // (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
30753078 bool hasNoNonconformingNode = visitAggregateLeaves (
30763079 origType, substType, forExpansion,
30773080 /* isLeafAggregate=*/
30783081 [&](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+
30793087 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 .
30823090 if (!nominal)
30833091 return false ;
30843092
@@ -3089,11 +3097,11 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
30893097 return true ;
30903098 }
30913099
3092- // Public , non-frozen trivial types may not conform (case (1)).
3100+ // Exported , non-frozen trivial types may not conform (case (1)).
30933101 if (nominal
30943102 ->getFormalAccessScope (/* useDC=*/ nullptr ,
30953103 /* treatUsableFromInlineAsPublic=*/ true )
3096- .isPublic ())
3104+ .isPublicOrPackage ())
30973105 return true ;
30983106
30993107 auto *module = nominal->getModuleContext ();
@@ -3113,6 +3121,15 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
31133121
31143122 auto isTopLevel = !field;
31153123
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+
31163133 // A BitwiseCopyable conformer appearing within its layout doesn't
31173134 // explain why substType doesn't itself conform.
31183135 if (M.checkConformance (ty, bitwiseCopyableProtocol))
@@ -3159,11 +3176,11 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
31593176 return false ;
31603177 }
31613178
3162- // Public , non-frozen trivial types may not conform (case (1)).
3179+ // Exported , non-frozen trivial types may not conform (case (1)).
31633180 if (nominal
31643181 ->getFormalAccessScope (/* useDC=*/ nullptr ,
31653182 /* treatUsableFromInlineAsPublic=*/ true )
3166- .isPublic ())
3183+ .isPublicOrPackage ())
31673184 return false ;
31683185
31693186 auto *module = nominal->getModuleContext ();
0 commit comments