jenkinsci / jenkinsci/workflow-cps-plugin
[JENKINS-70008] CPS-transformed "for" with empty termination never loops (should always)
- Dominant language
- Java
- Stars
- 186
- Forks
- 213
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 8
Description
An empty "for" termination is always looped (treated as true).
for (;;) {
// infinite loop
}
CPS transformed version never loops. Test for CpsTransformerTest currently fails:
@Test
public void emptyForCondition() throws Throwable {
assertEvaluate(true,
"boolean looped = false;\n"+
"for (;;) { looped = true; break; }\n"+
"looped");
}
---
Originally reported by
vallon, imported from: CPS-transformed "for" with empty termination never loops (should always)
Raw content of original issue
An empty "for" termination is always looped (treated as true).
for (;;) {
// infinite loop
}CPS transformed version never loops. Test for CpsTransformerTest currently fails:
@Test
public void emptyForCondition() throws Throwable {
assertEvaluate(true,
"boolean looped = false;\n"+
"for (;;) { looped = true; break; }\n"+
"looped");
}
- environment:
groovy-cps/master bd35d05
Contributor guide
Research direction
Start with the failing emptyForCondition test in CpsTransformerTest and trace how the CPS transformation handles a for loop with an empty condition. Confirm the expected behavior from the test, then make the test pass so the empty condition is treated as true and the loop executes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100