File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,9 @@ class SILType {
492
492
// / Returns the underlying referent SILType of an @sil_unowned or @sil_weak
493
493
// / Type.
494
494
SILType getReferentType (SILModule &M) const ;
495
+
496
+ // / Returns a SILType with any archetypes mapped out of context.
497
+ SILType mapTypeOutOfContext () const ;
495
498
496
499
// / Given two SIL types which are representations of the same type,
497
500
// / check whether they have an abstraction difference.
Original file line number Diff line number Diff line change @@ -1558,10 +1558,7 @@ class FixedBoxTypeInfoBase : public BoxTypeInfo {
1558
1558
// Allocate a new object using the layout.
1559
1559
auto boxedInterfaceType = boxedType;
1560
1560
if (env) {
1561
- boxedInterfaceType = SILType::getPrimitiveType (
1562
- boxedType.getSwiftRValueType ()->mapTypeOutOfContext ()
1563
- ->getCanonicalType (),
1564
- boxedType.getCategory ());
1561
+ boxedInterfaceType = boxedType.mapTypeOutOfContext ();
1565
1562
}
1566
1563
1567
1564
auto boxDescriptor = IGF.IGM .getAddrOfBoxDescriptor (
Original file line number Diff line number Diff line change @@ -390,6 +390,12 @@ SILType SILType::getReferentType(SILModule &M) const {
390
390
return M.Types .getLoweredType (Ty->getReferentType ()->getCanonicalType ());
391
391
}
392
392
393
+ SILType SILType::mapTypeOutOfContext () const {
394
+ return SILType::getPrimitiveType (getSwiftRValueType ()->mapTypeOutOfContext ()
395
+ ->getCanonicalType (),
396
+ getCategory ());
397
+ }
398
+
393
399
CanType
394
400
SILBoxType::getFieldLoweredType (SILModule &M, unsigned index) const {
395
401
auto fieldTy = getLayout ()->getFields ()[index].getLoweredType ();
Original file line number Diff line number Diff line change @@ -3764,10 +3764,7 @@ lowerKeyPathSubscriptIndexTypes(
3764
3764
auto indexLoweredTy = SGM.Types .getLoweredType (
3765
3765
AbstractionPattern::getOpaque (),
3766
3766
indexTy);
3767
- indexLoweredTy = SILType::getPrimitiveType (
3768
- indexLoweredTy.getSwiftRValueType ()->mapTypeOutOfContext ()
3769
- ->getCanonicalType (),
3770
- indexLoweredTy.getCategory ());
3767
+ indexLoweredTy = indexLoweredTy.mapTypeOutOfContext ();
3771
3768
indexPatterns.push_back ({indexTy->mapTypeOutOfContext ()
3772
3769
->getCanonicalType (),
3773
3770
indexLoweredTy});
You can’t perform that action at this time.
0 commit comments