forked from ircmaxell/php-compiler
-
Notifications
You must be signed in to change notification settings - Fork 1
Language: match expression (PHP 8) #143
Copy link
Copy link
Closed
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITenhancementNew feature or requestNew feature or requestphase-2:languagePhase 2 – language featuresPhase 2 – language features
Description
Activity
Metadata
Metadata
Assignees
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITenhancementNew feature or requestNew feature or requestphase-2:languagePhase 2 – language featuresPhase 2 – language features
Problem
match ($x) { ... }is not compiled (Expr_Matchmaps to #143 inUnsupportedRegistry). Routers and modern PHP usematchfor clean path dispatch; 003-MiniWebApp usesswitchtoday (#96 ✅) but future refactors may prefermatch.Goal
matchwith literal / int / string arms and adefaultarm (no guard expressions in v1):VM + JIT + AOT parity with Zend for simple arms.
Implementation hints
lib/Compiler.phpcompileExprExpr_Matcharmsdefaultas fall-throughlib/VM.phpTYPE_SWITCHlib/JIT.phplib/Lint/UnsupportedRegistry.phpExpr_Match→ 143 when doneTests
test/compliance/cases/language_match_*.phptexamples/003-MiniWebApponly after VM green (Reference app: MiniWebApp runtime green (lint 0, VM serve, routes) #539)Acceptance criteria
Prints
b. JIT/AOT compile the same snippet without throw.Dependencies
Verification
./script/ci-local.sh --filter VMTest— local/Docker only (#394 GHA off).Links