@@ -3064,6 +3064,7 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3064
3064
// unowned(unsafe) var o: AnyObject
3065
3065
// }
3066
3066
// (5) being defined in a different module
3067
+ // (6) being defined in a module built from interface
3067
3068
bool hasNoNonconformingNode = visitAggregateLeaves (
3068
3069
origType, substType, forExpansion,
3069
3070
/* isLeafAggregate=*/
@@ -3085,8 +3086,15 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3085
3086
if (nominal->isResilient ())
3086
3087
return true ;
3087
3088
3089
+ auto *module = nominal->getModuleContext ();
3090
+
3091
+ // Types in modules built from interfaces may not conform (case (6)).
3092
+ if (module && module ->isBuiltFromInterface ()) {
3093
+ return false ;
3094
+ }
3095
+
3088
3096
// Trivial types from other modules may not conform (case (5)).
3089
- return nominal-> getModuleContext () != &M;
3097
+ return module != &M;
3090
3098
},
3091
3099
/* visit=*/
3092
3100
[&](auto ty, auto origTy, auto *field, auto index) -> bool {
@@ -3145,8 +3153,15 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3145
3153
if (nominal->isResilient ())
3146
3154
return false ;
3147
3155
3156
+ auto *module = nominal->getModuleContext ();
3157
+
3158
+ // Types in modules built from interfaces may not conform (case (6)).
3159
+ if (module && module ->isBuiltFromInterface ()) {
3160
+ return false ;
3161
+ }
3162
+
3148
3163
// Trivial types from other modules may not conform (case (5)).
3149
- return nominal-> getModuleContext () == &M;
3164
+ return module == &M;
3150
3165
});
3151
3166
if (hasNoNonconformingNode) {
3152
3167
llvm::errs () << " Trivial type without a BitwiseCopyable conformance!?:\n "
0 commit comments