Skip to content

Commit

Permalink
Test different returns in different iterations
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 Oct 29, 2024
1 parent f5410d5 commit 2a94ec4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions frontend/test/resolution/testReturnTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,29 @@ static void testParamLoop() {
ensureParamString(qt, "asdf");
}

// Different returns in subsequent iterations
{
Context ctx;
Context* context = &ctx;
ErrorGuard guard(context);

std::string program = ops + R"""(
proc foo() param {
for param i in 0..2 {
if i == 1 {
return "asdf";
} else {
return true;
}
}
}
param x = foo();
)""";
QualifiedType qt = resolveTypeOfXInit(context,
program);
ensureParamBool(qt, true);
}

// Return in param TRUE conditional inside param loop iteration
{
Context ctx;
Expand Down

0 comments on commit 2a94ec4

Please sign in to comment.