Skip to content

Commit 8b79650

Browse files
djbretteclaude
andcommitted
doc/todo: track labeled break/continue, record test suite run
The full `cd test && make` suite now runs against a JDK (Temurin 25) and passes 100/100, so move that item out of "To Do" and into "Done". The run surfaced one real defect: `acceptBreak` and `acceptContinue` drop the label and emit a bare `break`/`continue`, and the statement label itself is never emitted. `test/Break0.java` passes only because its `break foo;` happens to target the innermost loop; a label naming an outer loop, or a labeled block, generates silently wrong code. Record it as the new item 1 along with the possible fixes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 983b288 commit 8b79650

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎doc/todo.md‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@ Status of the Python 3.14 / uv modernization and what is still open.
1313
literals, Java integer division via an inlined `jdiv()` helper.
1414
- All 100 `test/*.java` programs translate, compile, and run without errors on
1515
Python 3.14.8. The selector unit tests pass.
16+
- The full `cd test && make` suite has been run against a JDK (Temurin 25):
17+
100/100 `[PASS]`, with the Python output diffing clean against the Java
18+
output. `make selectors` passes (11 tests).
1619

1720
### To Do
1821

19-
1. **Run the real test suite.** `cd test && make` diffs the Python output
20-
against the Java output, and it hasn't been run since the port because no
21-
JDK was installed. Install one (`brew install openjdk`), then run the full
22-
suite and fix any `[PASS]` misses.
22+
1. **Labeled `break` and `continue`.** Python has no labeled loop control, so
23+
`acceptBreak` and `acceptContinue` drop the label and emit a bare `break` /
24+
`continue` (`java2python/compiler/visitor.py:375` and `:406`), each warning
25+
`Detected unhandled break statement with label; generated code incorrect.`
26+
The statement label itself (`foo:`) is dropped too, so `test/Break0.java`
27+
translates to a plain `break` inside the `while`. That test passes only
28+
because its `break foo;` targets the innermost loop; a label naming an
29+
*outer* loop from a nested one, or a labeled block, generates silently wrong
30+
code. Fixing it needs a real rewrite -- a sentinel flag checked by each
31+
enclosing loop, a label-specific exception raised and caught around the
32+
labeled statement, or hoisting the labeled loop into a function so the jump
33+
becomes a `return`. A test with a nested loop would catch regressions.
2334
2. **Java `%` semantics.** Java `%` truncates toward zero, while Python `%`
2435
floors, so the results differ when an operand is negative. Consider a
2536
`jmod()` helper alongside `jdiv()`

0 commit comments

Comments
 (0)