@@ -1267,10 +1267,20 @@ namespace {
1267
1267
if (handleResilience (structType, D, properties))
1268
1268
return handleAddressOnly (structType, properties);
1269
1269
1270
+ auto subMap = structType->getContextSubstitutionMap (
1271
+ M.getSwiftModule (), D);
1272
+
1270
1273
// Classify the type according to its stored properties.
1271
1274
for (auto field : D->getStoredProperties ()) {
1275
+ // FIXME: Remove this once getInterfaceType() is a request.
1276
+ if (!field->hasInterfaceType ())
1277
+ M.getASTContext ().getLazyResolver ()->resolveDeclSignature (field);
1278
+
1272
1279
auto substFieldType =
1273
- structType->getTypeOfMember (D->getModuleContext (), field, nullptr );
1280
+ field->getInterfaceType ()
1281
+ .subst (subMap, SubstFlags::UseErrorType)
1282
+ ->getCanonicalType ();
1283
+
1274
1284
properties.addSubobject (classifyType (substFieldType->getCanonicalType (),
1275
1285
M, Sig, Expansion));
1276
1286
}
@@ -1297,6 +1307,9 @@ namespace {
1297
1307
Expansion);
1298
1308
}
1299
1309
1310
+ auto subMap = enumType->getContextSubstitutionMap (
1311
+ M.getSwiftModule (), D);
1312
+
1300
1313
// Accumulate the properties of all direct payloads.
1301
1314
for (auto elt : D->getAllElements ()) {
1302
1315
// No-payload elements do not affect any recursive properties.
@@ -1308,11 +1321,15 @@ namespace {
1308
1321
properties.setNonTrivial ();
1309
1322
continue ;
1310
1323
}
1311
-
1312
- auto substEltType = enumType->getTypeOfMember (
1313
- D->getModuleContext (), elt,
1314
- elt->getArgumentInterfaceType ())
1315
- ->getCanonicalType ();
1324
+
1325
+ // FIXME: Remove this once getInterfaceType() is a request.
1326
+ if (!elt->hasInterfaceType ())
1327
+ M.getASTContext ().getLazyResolver ()->resolveDeclSignature (elt);
1328
+
1329
+ auto substEltType =
1330
+ elt->getArgumentInterfaceType ()
1331
+ .subst (subMap, SubstFlags::UseErrorType)
1332
+ ->getCanonicalType ();
1316
1333
1317
1334
properties.addSubobject (classifyType (substEltType, M, Sig, Expansion));
1318
1335
}
@@ -2591,6 +2608,10 @@ CanSILBoxType TypeConverter::getBoxTypeForEnumElement(SILType enumType,
2591
2608
2592
2609
auto &C = M.getASTContext ();
2593
2610
2611
+ // FIXME: Remove this once getInterfaceType() is a request.
2612
+ if (!elt->hasInterfaceType ())
2613
+ C.getLazyResolver ()->resolveDeclSignature (elt);
2614
+
2594
2615
auto boxSignature = getEffectiveGenericSignature (enumDecl);
2595
2616
2596
2617
if (boxSignature == CanGenericSignature ()) {
@@ -2655,12 +2676,15 @@ static void countNumberOfInnerFields(unsigned &fieldsCount, SILModule &Module,
2655
2676
unsigned fieldsCountBefore = fieldsCount;
2656
2677
unsigned maxEnumCount = 0 ;
2657
2678
for (auto elt : enumDecl->getAllElements ()) {
2658
- if (!elt->getArgumentInterfaceType ()) {
2679
+ if (!elt->hasAssociatedValues ())
2659
2680
continue ;
2660
- }
2661
- if (elt->isIndirect ()) {
2681
+
2682
+ if (elt->isIndirect ())
2662
2683
continue ;
2663
- }
2684
+
2685
+ if (!elt->hasInterfaceType ())
2686
+ enumDecl->getASTContext ().getLazyResolver ()->resolveDeclSignature (elt);
2687
+
2664
2688
// Although one might assume enums have a fields count of 1
2665
2689
// Which holds true for current uses of this code
2666
2690
// (we shouldn't expand enums)
0 commit comments