Skip to content

fix(compiler): evaluate trailing empty switch cases - #90

Open
yavon007 wants to merge 1 commit into
swoole:masterfrom
yavon007:codex/fix-trailing-switch-case
Open

fix(compiler): evaluate trailing empty switch cases#90
yavon007 wants to merge 1 commit into
swoole:masterfrom
yavon007:codex/fix-trailing-switch-case

Conversation

@yavon007

Copy link
Copy Markdown

A trailing empty switch case was discarded during AOT lowering. Its condition was never evaluated, and even a matching trailing case could incorrectly execute an earlier default branch.

Keep trailing case/default labels as an empty case group so the existing ordered comparison logic evaluates them and suppresses the default when they match. Add a PHPT covering both observable condition side effects and default suppression.

Validation on Linux ARM64 with PHP 8.5.10:

  • New regression fails before the fix and passes afterward; its expected output matches plain PHP.
  • tests/compiler/switch: 7/7 passed with native AOT compilation.
  • Applied together with the separate switch-type-comparison fix: all three new PHPT regressions passed.
  • git diff --check passed.

Sign up for freeto 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.

1 participant

@yavon007