Skip to content

Language: AOT throw/catch with user-defined class (007 ValidationError execute) #2157

Description

@PurHur

Problem

examples/007-ThrowsWeb/example.php uses an empty user class ValidationError with throw new ValidationError() / catch (ValidationError $e). VM + phpc serve are green (#2076 ✅, #2084 ✅).

Native AOT link/execute still skips in ThrowsWebAotExecuteTest / ExamplesCompileTest::test007ThrowsWebAotLink via PhpcBuild::isUserClassAotBlocked() — gates #2101 ✅ wired but THROWSWEB_AOT_* remain opt-in (#2135).

This is the language blocker for 007 AOT, distinct from gate-flip issues.

Goal

THROWSWEB_AOT_LINK_GATE=1 ./phpc build --project examples/007-ThrowsWeb
THROWSWEB_AOT_SMOKE_GATE=1 vendor/bin/phpunit --filter ThrowsWebAotExecute

Both green on php-compiler:22.04-dev without skip messages.

Implementation hints

Layer Files Notes
AOT compile lib/AOT/, lib/Compiler.php Lower empty class + new + throw + typed catch
Objects lib/JIT/Builtin/Type/Object_.php, linker Avoid __object__ unsupported native type for empty classes
Try/catch lib/JIT/TryCatchHelper.php (AOT path) Reuse VM lowering from #2084
Lint lib/Lint/UnsupportedRegistry.php Allow empty class in project entry
Tests test/unit/ThrowsWebAotExecuteTest.php Remove skip when build succeeds

Minimal v1 scope

Acceptance criteria

Verification (local / Docker only)

make docker-build-22
./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  THROWSWEB_AOT_LINK_GATE=1 THROWSWEB_AOT_SMOKE_GATE=1 \
    vendor/bin/phpunit --filter ThrowsWebAotExecute
'

Do not require GitHub Actions.

Dependencies

Links

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions