Skip to content

Commit 40ecf39

Browse files
committed
Add test for new operators
Signed-off-by: Anna Rift <[email protected]>
1 parent ba288c6 commit 40ecf39

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

frontend/test/resolution/testResolve.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,29 @@ static void test27() {
17301730
assert(guard.realizeErrors() == 0);
17311731
}
17321732

1733+
// Test resolving logical AND/OR compound assignment operators
1734+
static void test28() {
1735+
Context* context = buildStdContext();
1736+
ErrorGuard guard(context);
1737+
1738+
std::string prog =
1739+
R"""(
1740+
proc baz() {
1741+
var ok = true;
1742+
ok &&= false;
1743+
ok ||= true;
1744+
return ok;
1745+
}
1746+
var x = baz();
1747+
)""";
1748+
1749+
auto t = resolveTypeOfXInit(context, prog);
1750+
CHPL_ASSERT(!t.isUnknownOrErroneous());
1751+
CHPL_ASSERT(t.type()->isBoolType());
1752+
1753+
assert(guard.realizeErrors() == 0);
1754+
}
1755+
17331756
// This bug is hard to replicate with queries alone, but does seem to show
17341757
// up in some cases of the query system.
17351758
static void testInfiniteCycleBug() {
@@ -2128,6 +2151,7 @@ int main() {
21282151
test25();
21292152
test26();
21302153
test27();
2154+
test28();
21312155

21322156
testInfiniteCycleBug();
21332157

0 commit comments

Comments
 (0)