@@ -2733,13 +2733,13 @@ class ResultPlanner : public ExpanderBase<ResultPlanner> {
2733
2733
SmallVector<SILValue, 4 > &innerDirectResults);
2734
2734
2735
2735
void expandInnerTuple (AbstractionPattern innerOrigType,
2736
- CanType innerSubstType,
2736
+ CanTupleType innerSubstType,
2737
2737
AbstractionPattern outerOrigType,
2738
2738
CanType outerSubstType);
2739
2739
void expandOuterTuple (AbstractionPattern innerOrigType,
2740
2740
CanType innerSubstType,
2741
2741
AbstractionPattern outerOrigType,
2742
- CanType outerSubstType);
2742
+ CanTupleType outerSubstType);
2743
2743
2744
2744
void expandSingle (AbstractionPattern innerOrigType,
2745
2745
CanType innerSubstType,
@@ -3138,9 +3138,9 @@ void ExpanderBase<Impl>::expand(AbstractionPattern innerOrigType,
3138
3138
outerOrigType, outerSubstType);
3139
3139
} else if (outerIsExpanded) {
3140
3140
asImpl ().expandOuterTuple (innerOrigType, innerSubstType,
3141
- outerOrigType, outerSubstType);
3141
+ outerOrigType, cast<TupleType>( outerSubstType) );
3142
3142
} else if (innerIsExpanded) {
3143
- asImpl ().expandInnerTuple (innerOrigType, innerSubstType,
3143
+ asImpl ().expandInnerTuple (innerOrigType, cast<TupleType>( innerSubstType) ,
3144
3144
outerOrigType, outerSubstType);
3145
3145
} else {
3146
3146
asImpl ().expandSingle (innerOrigType, innerSubstType,
@@ -3480,7 +3480,7 @@ void ResultPlanner::Operation::emitReabstractTupleIntoPackExpansion(
3480
3480
void ResultPlanner::expandOuterTuple (AbstractionPattern innerOrigType,
3481
3481
CanType innerSubstType,
3482
3482
AbstractionPattern outerOrigType,
3483
- CanType outerSubstType) {
3483
+ CanTupleType outerSubstType) {
3484
3484
assert (outerOrigType.isTuple ());
3485
3485
assert (!outerOrigType.doesTupleVanish ());
3486
3486
assert (!innerOrigType.isTuple ());
@@ -3489,7 +3489,6 @@ void ResultPlanner::expandOuterTuple(AbstractionPattern innerOrigType,
3489
3489
// plan function filters that out), so the outer subst type must be a
3490
3490
// tuple. The inner subst type must also be a tuple because only tuples
3491
3491
// convert to tuples.
3492
- auto outerSubstTupleType = cast<TupleType>(outerSubstType);
3493
3492
auto innerSubstTupleType = cast<TupleType>(innerSubstType);
3494
3493
3495
3494
// The next inner result is not expanded, so there's a single result.
@@ -3498,30 +3497,27 @@ void ResultPlanner::expandOuterTuple(AbstractionPattern innerOrigType,
3498
3497
if (SGF.silConv .isSILIndirect (innerResult)) {
3499
3498
SILValue innerResultAddr = addInnerIndirectResultTemporary (innerResult);
3500
3499
expandParallelTuplesInnerIndirect (innerOrigType, innerSubstTupleType,
3501
- outerOrigType, outerSubstTupleType ,
3500
+ outerOrigType, outerSubstType ,
3502
3501
ManagedValue::forLValue (innerResultAddr));
3503
3502
} else {
3504
3503
assert (!SGF.silConv .useLoweredAddresses () &&
3505
3504
" Formal Indirect Results that are not SIL Indirect are only "
3506
3505
" allowed in opaque values mode" );
3507
3506
planExpandedFromDirect (innerOrigType, innerSubstTupleType,
3508
- outerOrigType, outerSubstTupleType ,
3507
+ outerOrigType, outerSubstType ,
3509
3508
innerResult);
3510
3509
}
3511
3510
}
3512
3511
3513
3512
void ResultPlanner::expandInnerTuple (AbstractionPattern innerOrigType,
3514
- CanType innerSubstType,
3513
+ CanTupleType innerSubstType,
3515
3514
AbstractionPattern outerOrigType,
3516
3515
CanType outerSubstType) {
3517
3516
assert (innerOrigType.isTuple ());
3518
3517
assert (!innerOrigType.doesTupleVanish ());
3519
3518
assert (!outerOrigType.isTuple ());
3520
3519
3521
- // We know that the inner tuple is not vanishing (because the top-level
3522
- // plan function filters that out), so the inner subst type must be a
3523
- // tuple. The outer subst type might not be a tuple if it's e.g. Any.
3524
- auto innerSubstTupleType = cast<TupleType>(innerSubstType);
3520
+ // The outer subst type might not be a tuple if it's e.g. Any.
3525
3521
3526
3522
// The next outer result is not expanded, so there's a single result.
3527
3523
auto outerResultPair = claimNextOuterResult ();
@@ -3531,12 +3527,12 @@ void ResultPlanner::expandInnerTuple(AbstractionPattern innerOrigType,
3531
3527
// Base the plan on whether the single result is direct or indirect.
3532
3528
if (SGF.silConv .isSILIndirect (outerResult)) {
3533
3529
assert (outerResultAddr);
3534
- expandInnerTupleOuterIndirect (innerOrigType, innerSubstTupleType ,
3530
+ expandInnerTupleOuterIndirect (innerOrigType, innerSubstType ,
3535
3531
outerOrigType, outerSubstType,
3536
3532
ManagedValue::forLValue (outerResultAddr));
3537
3533
} else {
3538
3534
assert (!outerResultAddr);
3539
- planExpandedIntoDirect (innerOrigType, innerSubstTupleType ,
3535
+ planExpandedIntoDirect (innerOrigType, innerSubstType ,
3540
3536
outerOrigType, outerSubstType,
3541
3537
outerResult);
3542
3538
}
0 commit comments