Skip to content

Commit

Permalink
Dyno: add test for issue #11225 (#26464)
Browse files Browse the repository at this point in the history
In production, the issue (presumably) persists. However, in Dyno
everything looks like it works as we'd expect. So, locking down the test
case to ensure subsequent changes to Dyno don't break it.

Trivial, will not be reviewed.

## Testing
- [x] dyno tests
  • Loading branch information
DanilaFe authored Jan 6, 2025
2 parents ce20881 + 2ab61d1 commit 79bebb9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions frontend/test/resolution/testPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,39 @@ static void test18() {

}

static void test19() {
// promotion on multiple arguments with default arguments
runProgram(
{ "proc foo(x: int = 1, y: int = 2) do return true;",
"for i in foo(1, new R()) {}" },
[](ErrorGuard& guard, const QualifiedType& t) {
assert(!t.isUnknownOrErroneous());
assert(t.type()->isBoolType());
},
IterableType("R").definePromotionType("int")
.defineSerialIterator("1"));

runProgram(
{ "proc foo(x: int = 1, y: int = 2) do return true;",
"for i in foo(x=new R()) {}" },
[](ErrorGuard& guard, const QualifiedType& t) {
assert(!t.isUnknownOrErroneous());
assert(t.type()->isBoolType());
},
IterableType("R").definePromotionType("int")
.defineSerialIterator("1"));

runProgram(
{ "proc foo(x: int = 1, y: int = 2) do return true;",
"for i in foo(y=new R()) {}" },
[](ErrorGuard& guard, const QualifiedType& t) {
assert(!t.isUnknownOrErroneous());
assert(t.type()->isBoolType());
},
IterableType("R").definePromotionType("int")
.defineSerialIterator("1"));
}

static void testTertiaryMethod() {
// tertiary method definitions of chpl__promotionType
// (defined in the scope of iteration) are not allowed.
Expand Down Expand Up @@ -449,6 +482,7 @@ int main() {
test16();
test17();
test18();
test19();
}

testTertiaryMethod();
Expand Down

0 comments on commit 79bebb9

Please sign in to comment.