playground#5
Merged
Merged
Conversation
playground/ is a self-contained sandbox app with its own composer.json that depends on xphp-lang/xphp-parser via a Composer path repository pointing at the repo root — the same shape any downstream consumer would use. `make playground` (or playground/bin/run) compiles every .xphp under src/, then runs four demos covering the supported feature buckets: single-type generics, multi-type generics, T[] / ?T sugar, and transitive specialization via Wrapper<T> referencing Box<T>. Wiring the playground up surfaced a real bug: the T[] sugar treated any Name followed by `[]` as a type-hint, including `$this->keys[]` array-append (where `keys` is a T_STRING after `->`). The destructive rewrite turned property writes into writes to a dynamic `$array` slot. Add an isMemberAccessContext guard that walks back past whitespace and comments from the Name token; if the previous meaningful token is `->`, `?->`, or `::`, skip the sugar. Cover the three operators plus the walk-back-past-comment path in unit tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0f466f0 to
55bc231
Compare
70fddbe to
ccf08d6
Compare
… the generated files
ccf08d6 to
89421d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.