Skip to content

Language: null coalescing operator (??) — closes #99 - #334

Merged
PurHur merged 2 commits into
masterfrom
issue-99-null-coalescing
May 20, 2026
Merged

Language: null coalescing operator (??) — closes #99#334
PurHur merged 2 commits into
masterfrom
issue-99-null-coalescing

Conversation

@PurHur

@PurHur PurHur commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implements ?? (null coalescing) in the CFG → VM pipeline via TYPE_COALESCE branch lowering with PHP isset() semantics for variables and array offsets.
  • Adds php-types reconstruction for Expr_BinaryOp_Coalesce and removes the construct from UnsupportedRegistry / docs/unsupported-syntax.md.
  • Adds compliance coverage in test/compliance/cases/language/coalesce.phpt and updates lint unit tests.

Test plan

  • docker run … php bin/vm.php -r '$b=null; echo $b ?? "Guest";'Guest
  • vendor/bin/phpunit test/compliance/ --filter coalesce
  • vendor/bin/phpunit test/unit/LintTest.php
  • JIT ?? merge lowering (TYPE_COALESCE in lib/JIT.php) — LLVM phi/terminator fixes still needed; VM path is complete

Verified locally with ./script/docker-ci-local.sh (tar fallback) on compliance + lint suites.

Closes #99

Made with Cursor

PurHur and others added 2 commits May 20, 2026 10:52
Closes #99 by lowering Coalesce CFG nodes through TYPE_COALESCE branch
blocks with isset semantics, adding php-types reconstruction support, and
compliance coverage; JIT merge lowering is started but still needs phi fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve VM.php conflict (keep TYPE_COALESCE + TYPE_EXIT) and regenerate
bootstrap-inventory.md after master landed die()/exit() support.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 30fe34d into master May 20, 2026
@PurHur
PurHur deleted the issue-99-null-coalescing branch July 16, 2026 00:13
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.

Language: Null coalescing operator (??) in compiler pipeline

1 participant