@@ -551,7 +551,7 @@ void CallInitDeinit::resolveDefaultInit(const VarLikeDecl* ast, RV& rv) {
551551 }
552552}
553553
554- // Adjusts LHS tuple type so that its components are all references .
554+ // Adjusts LHS tuple type so that its components are all values .
555555// Does no sanity checks.
556556static QualifiedType
557557getLhsForTupleUnpackAssign (Context* context,
@@ -576,7 +576,7 @@ getLhsForTupleUnpackAssign(Context* context,
576576 } else {
577577 // Otherwise, turn its qualifier into 'ref' / 'const ref'
578578 auto eqt = lhsT->elementType (i);
579- auto kind = KindProperties::addRefness (eqt.kind ());
579+ auto kind = KindProperties::removeRef (eqt.kind ());
580580 qt = { kind, eqt.type (), eqt.param () };
581581 }
582582
@@ -596,6 +596,8 @@ void CallInitDeinit::resolveTupleUnpackAssign(const Tuple* lhsTuple,
596596 const QualifiedType& initialLhsType,
597597 const QualifiedType& rhsType,
598598 RV& rv) {
599+ VarFrame* frame = currentFrame ();
600+
599601 // Make sure that both the LHS and RHS have types
600602 if (!initialLhsType.hasTypePtr ()) {
601603 context->error (lhsTuple, " Unknown lhs tuple type in split tuple assign" );
@@ -626,9 +628,6 @@ void CallInitDeinit::resolveTupleUnpackAssign(const Tuple* lhsTuple,
626628 return ;
627629 }
628630
629- // Then, make sure that the LHS is valid and adjust its intent.
630- // It recomputes the LHS tuple type and sets it in 'byPostorder'.
631- // It does not recompute intents for component sub-expressions.
632631 auto lhsType = getLhsForTupleUnpackAssign (context, astForErr, lhsTuple,
633632 initialLhsType);
634633 rv.byPostorder ().byAst (lhsTuple).setType (lhsType);
@@ -651,7 +650,7 @@ void CallInitDeinit::resolveTupleUnpackAssign(const Tuple* lhsTuple,
651650 continue ;
652651 }
653652
654- resolveAssign ( actual, lhsEltType, rhsEltType, rv);
653+ processInit (frame, actual, lhsEltType, rhsEltType, rv);
655654 }
656655}
657656
0 commit comments