Skip to content

Commit 2f842ef

Browse files
committed
Test normal assignment rather than split-init
Signed-off-by: Anna Rift <[email protected]>
1 parent 8054afc commit 2f842ef

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

frontend/test/resolution/testCallInitDeinit.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,7 @@ static void test30() {
19861986
});
19871987
}
19881988

1989-
// Split-init with tuple destructuring, copying out of tuple
1989+
// Assignment with tuple destructuring, copying out of tuple
19901990
static void test31() {
19911991
testActions("test31",
19921992
R""""(
@@ -1997,24 +1997,25 @@ static void test31() {
19971997
19981998
var tup = (1, r);
19991999
2000-
var a : int;
2001-
var b : R;
2000+
var a = 1;
2001+
var b = new R();
20022002
(a, b) = tup;
20032003
tup;
20042004
}
20052005
}
20062006
)"""",
20072007
{
20082008
{AssociatedAction::NEW_INIT, "M.test@2", ""},
2009-
{AssociatedAction::INIT_OTHER, "tup", ""},
2010-
{AssociatedAction::ASSIGN, "M.test@12", ""},
2011-
{AssociatedAction::COPY_INIT, "b", ""},
2009+
{AssociatedAction::INIT_OTHER, "tup", ""},
2010+
{AssociatedAction::NEW_INIT, "M.test@12", ""},
2011+
{AssociatedAction::ASSIGN, "M.test@14", ""},
2012+
{AssociatedAction::COPY_INIT, "b", ""},
20122013
{AssociatedAction::DEINIT, "M.test@18", "r"},
20132014
{AssociatedAction::DEINIT, "M.test@18", "b"}
20142015
});
20152016
}
20162017

2017-
// Split-init with tuple destructuring, moving out of tuple
2018+
// Assignment with tuple destructuring, moving out of tuple
20182019
static void test32() {
20192020
testActions("test32",
20202021
R""""(
@@ -2025,21 +2026,22 @@ static void test32() {
20252026
20262027
var tup = (1, r);
20272028
2028-
var a : int;
2029-
var b : R;
2029+
var a = 1;
2030+
var b = new R();
20302031
(a, b) = tup;
20312032
}
20322033
}
20332034
)"""",
20342035
{
20352036
{AssociatedAction::NEW_INIT, "M.test@2", ""},
2036-
{AssociatedAction::INIT_OTHER, "tup", ""},
2037-
{AssociatedAction::ASSIGN, "M.test@12", ""},
2038-
{AssociatedAction::DEINIT, "M.test@18", "b"}
2037+
{AssociatedAction::INIT_OTHER, "tup", ""},
2038+
{AssociatedAction::NEW_INIT, "M.test@12", ""},
2039+
{AssociatedAction::ASSIGN, "M.test@14", ""},
2040+
{AssociatedAction::DEINIT, "M.test@18", "b"},
20392041
});
20402042
}
20412043

2042-
// Declaring with tuple destructuring, copying out of tuple
2044+
// Init with tuple destructuring, copying out of tuple
20432045
static void test33() {
20442046
testActions("test33",
20452047
R""""(
@@ -2057,14 +2059,14 @@ static void test33() {
20572059
)"""",
20582060
{
20592061
{AssociatedAction::NEW_INIT, "M.test@2", ""},
2060-
{AssociatedAction::INIT_OTHER, "tup", ""},
2061-
{AssociatedAction::COPY_INIT, "b", ""},
2062+
{AssociatedAction::INIT_OTHER, "tup", ""},
2063+
{AssociatedAction::COPY_INIT, "b", ""},
20622064
{AssociatedAction::DEINIT, "M.test@18", "r"},
20632065
{AssociatedAction::DEINIT, "M.test@18", "b"}
20642066
});
20652067
}
20662068

2067-
// Declaring with tuple destructuring, moving out of tuple
2069+
// Init with tuple destructuring, moving out of tuple
20682070
static void test34() {
20692071
testActions("test34",
20702072
R""""(
@@ -2081,7 +2083,7 @@ static void test34() {
20812083
)"""",
20822084
{
20832085
{AssociatedAction::NEW_INIT, "M.test@2", ""},
2084-
{AssociatedAction::INIT_OTHER, "tup", ""},
2086+
{AssociatedAction::INIT_OTHER, "tup", ""},
20852087
{AssociatedAction::DEINIT, "M.test@18", "r"},
20862088
{AssociatedAction::DEINIT, "M.test@18", "b"}
20872089
});

0 commit comments

Comments
 (0)