Skip to content

Language: traits/interfaces/abstract validation VM (#144) - #3304

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-144-traits-interfaces-abstract
May 30, 2026
Merged

Language: traits/interfaces/abstract validation VM (#144)#3304
PurHur merged 2 commits into
masterfrom
agent/issue-144-traits-interfaces-abstract

Conversation

@PurHur

@PurHur PurHur commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Registers interface method bodies on ClassEntry (previously interface declarations were name-only).
  • Adds VM validation after class definition: missing implements methods, unresolved abstract methods, and horizontal trait method conflicts (Zend-style messages).
  • Blocks new on abstract classes; packs abstract + readonly class flags via ClassFlags.

php-src reference

  • Zend/zend_compile.czend_compile_implements, abstract class checks
  • Zend/zend_inheritance.c — trait conflict resolution, interface inheritance
  • Zend/zend_execute.c — abstract instantiation guard

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/unit/TraitsInterfacesAbstractTest.php'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/compliance/VMTest.php --filter "interface_implements|abstract_class|trait_use_conflict"'

All 9 tests pass. JIT/AOT defer to VM fallback (same pattern as other OOP gaps).

Closes #144

Made with Cursor

@PurHur PurHur added enhancement New feature or request phase-2:language Phase 2 – language features area:compiler Compiler / CFG / JIT area:vm Virtual machine implementation-ready Spec complete: repro, php-src ref, done-when — safe for workers to claim labels May 30, 2026
PurHur and others added 2 commits May 30, 2026 18:39
Register interface methods, reject missing implements at class declaration,
block abstract instantiation, and detect horizontal trait method conflicts.

Co-authored-by: Cursor <cursoragent@cursor.com>
Master already rejects missing interface methods, abstract instantiation,
and trait collisions at parseAndCompile via CompileError.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur force-pushed the agent/issue-144-traits-interfaces-abstract branch from ef9b2ed to f0073ab Compare May 30, 2026 16:41
@PurHur
PurHur merged commit 14ea82c into master May 30, 2026
@PurHur
PurHur deleted the agent/issue-144-traits-interfaces-abstract branch May 30, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:compiler Compiler / CFG / JIT area:vm Virtual machine enhancement New feature or request implementation-ready Spec complete: repro, php-src ref, done-when — safe for workers to claim phase-2:language Phase 2 – language features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: Traits, abstract classes, and interfaces

1 participant