diff --git a/frontend/test/resolution/testMethodCalls.cpp b/frontend/test/resolution/testMethodCalls.cpp index e581697ede0a..f02fb2a1c778 100644 --- a/frontend/test/resolution/testMethodCalls.cpp +++ b/frontend/test/resolution/testMethodCalls.cpp @@ -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(); @@ -754,6 +782,7 @@ int main() { test13(); test14(); test14b(); + test15(); return 0; }