Skip to content

Commit

Permalink
Test resolving parenless call within param loop
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Rift <anna.rift@hpe.com>
  • Loading branch information
riftEmber committed Sep 23, 2024
1 parent b301fa0 commit 4d38829
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions frontend/test/resolution/testMethodCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,34 @@ static void test14b() {
assert(guard.realizeErrors() == 2);
}

static void test15() {
// Test resolving parenless calls from within param for loop.
Context ctx;
Context* context = &ctx;
ErrorGuard guard(context);

std::string program = R"""(
class Foo {
proc asdf do return 3;
proc doSomething() {
for param i in 0..2 do
return asdf;
}
}
var f = new Foo();
var x = f.doSomething();
)""";

QualifiedType initType = resolveTypeOfXInit(context, program);
assert(initType.type());
assert(initType.type()->isIntType());

assert(guard.realizeErrors() == 0);
}


int main() {
test1();
test2();
Expand All @@ -754,6 +782,7 @@ int main() {
test13();
test14();
test14b();
test15();

return 0;
}
Expand Down

0 comments on commit 4d38829

Please sign in to comment.