tests: Add loop and AnnAssign xfail tests

- process_stmt now raises NotImplementedError on an unsupported statement
  instead of warning: a dropped statement silently changes what the
  program means (a for/while loop compiled to nothing).
- failing_tests/loops/: 8 xfail tests for for/while/break/continue/nested
  loops and map iteration
- failing_tests/assign/annotated_assign.py: xfail for `x: c_int64 = 0`
  (ast.AnnAssign is not handled)
This commit is contained in:
2026-09-23 17:50:06 +05:30
parent a949a90d0e
commit 3effae93b8
11 changed files with 224 additions and 5 deletions

View File

@ -401,11 +401,11 @@ def process_stmt(
builder, stmt, local_sym_tab, ret_type, compilation_context
)
else:
# Silently dropping a statement makes the program mean something other
# than what it says, so say so.
logger.warning(
f"Unsupported statement on line {getattr(stmt, 'lineno', '?')}, "
f"ignored: {type(stmt).__name__}"
# Dropping a statement makes the program mean something other than what
# it says (a loop compiles to nothing), so refuse rather than warn.
raise NotImplementedError(
f"Unsupported statement on line {getattr(stmt, 'lineno', '?')}: "
f"{type(stmt).__name__}"
)
return did_return