Repository navigation
fix: allow match expressions as cast and clone operands - #309
Open
akashchamp wants to merge 2 commits into
Open
akashchamp wants to merge 2 commits into
akashchamp wants to merge 2 commits into
Conversation
(int)match($x) { ... } and clone match($x) { ... } are valid PHP 8
but were parsed as errors, because cast_expression and clone_expression
only accepted unary/primary expressions.
Fixes tree-sitter#308
This branch has not been deployed
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.
(int)match($x) { ... }andclone match($x) { ... }are valid PHP but parsed as errors, becausecast_expressionandclone_expressiondid not accept amatch_expressionoperand. This adds it to both.Fixes #308. I left
(int)yield(also listed there) out, since it is a separate construct.Checked with
tree-sitter test(149/149 parses pass) andnpm run lint. The new corpus test fails on the old parser and passes on the new one. Parser files are rebuilt by tree-sitter 0.27.1 in a separatechore: generatecommit.