Skip to content

feat(opy): complete collection mutation and control flow - #335

Merged
Teakowa merged 4 commits into
mainfrom
codex/issue-328
Sep 19, 2026
Merged

Teakowa merged 4 commits into
mainfrom
codex/issue-328

Conversation

@e54-bot

@e54-bot e54-bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • complete del lowering for global/player variables through three dimensions
  • support accepted continue, goto RULE_START, and dynamic loc+ control-flow forms
  • add pinned OverPy 9.7.10 differential fixtures, diagnostics, provenance coverage, and support documentation

Validation

  • cargo test -p opy-rs
  • pinned-oracle differential corpus

Fixes #328

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking findings:

  1. crates/opy-rs/src/lower/statements.rs / crates/opy-rs/src/compiler/lowering.rs — the new del depth boundary is one indexed level too strict. Pinned OverPy 9.7.10 rewrites the final deletion first, accepts a source target with four indexes through its three-dimensional reconstruction path, and only reaches Cannot delete index of 4d array when there is one additional nested __valueInArray__. This patch rejects every target with indexed_expr_depth >= 4 / indices.len() > 3, so an upstream-accepted core form is rejected while the support row is promoted to Supported. The same upstream reconstruction also explicitly rejects random outer/middle indexes; the new native path has no equivalent boundary. Add pinned acceptance/rejection probes for these nested forms and match the 9.7.10 boundary before marking del Supported.

  2. crates/opy-rs/src/compiler/lowering.rs — continue still fails when a switch is nested inside an enclosing for / while / do ... while. contains_loop_continue only descends through Stmt::If; a switch falls through to lower_switch_body, which sends its statements to lower_action(..., BreakTarget::Switch), where Stmt::Continue is rejected. Pinned OverPy's continue.ts walks parents through intervening structures until it reaches the enclosing loop, so this is an established accepted nesting form. Add an oracle-backed switch-in-loop case and preserve the enclosing-loop continue semantics before promoting the row to Supported.

  3. crates/opy-rs/src/compiler/lowering.rs / crates/opy-rs/src/compiler/tests/control_flow.rs — the new conditional dynamic goto loc+... path is only protected by a native-output assertion. The pinned fixture covers an unconditional dynamic goto, not if condition: goto loc+expr. This matters because loc+ is action-relative and pinned OverPy deliberately tracks variable gotos at rule scope to preserve surrounding control-flow/action positions. #328 requires independent upstream/differential evidence for completed behavior, so the implementation currently self-specifies this new path. Add a pinned 9.7.10 differential case with surrounding actions/structure and make the lowering match that action-distance behavior; do not rely on the single-Skip If assertion as completion evidence.

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: findings 2 and 3 are fixed, and the del depth/random-index cases now match the pinned oracle. One compatibility gap remains in finding 1: lower_delete checks randomness only in indices[..indices.len() - 1], but pinned OverPy 9.7.10 __del__.ts also calls astContainsRandom(content.args[0]) on the indexed array/root expression. That matters for player-variable targets because the parser permits an arbitrary player expression as the __playerVar__ receiver (for example a random player expression). A nested target such as del random.choice(getAllPlayers()).values[0][0][0] is therefore rejected upstream but is not rejected by this native guard. Include the root/player receiver in the nested-random check and add a pinned rejection probe for this form. After that, the previous review findings are otherwise resolved.

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teakowa
Teakowa merged commit c07d4e4 into main Sep 19, 2026
5 checks passed
@Teakowa
Teakowa deleted the codex/issue-328 branch September 19, 2026 16:14
@e54-bot e54-bot mentioned this pull request Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Complete core collection mutation and control-flow semantics

2 participants