Skip to content

[codex] run generator finalizers on abrupt close - #4380

Closed
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-generator-abrupt-finally
Closed

andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-generator-abrupt-finally

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Summary

  • add a generator FinallyRoute for non-yielding try/finally regions and split those finalizers into explicit state-machine states
  • run active pending finalizers from .return() and no-catch .throw() before completing/rethrowing
  • resume catch routes through same-try finalizers so caught .throw() continues to the next suspension point
  • add regression coverage for nested finalizers and finalizer return superseding abrupt completion

Refs #4374

Validation

  • cargo check -p perry-transform
  • cargo build --release --quiet -p perry -p perry-runtime -p perry-stdlib
  • tests/test_issue_4374_generator_abrupt_finally.sh
  • tests/test_issue_4036_async_try_catch_after_await.sh
  • bash tests/test_issue_3583_async_semantic_parity.sh
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh
  • focused Node 26/Perry repro comparison for generator .return() and .throw() through pending finally

@proggeramlug

Copy link
Copy Markdown
Contributor

Superseded by #4383 (fix for #4374, run pending try/finally on .return()/.throw() abrupt completion), already merged to main. Both rewrite generator/linearize.rs + lower.rs for the same abrupt-completion-finally behavior. Closing as duplicate.

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.

2 participants