fix: allow scoped type identifiers in record patterns - #232
Open
mihailkirov wants to merge 1 commit into
Open
mihailkirov wants to merge 1 commit into
mihailkirov wants to merge 1 commit into
Conversation
A record pattern headed by a qualified type name — case A.B.Authorized(Id id) -> in a switch, or o instanceof R.Found(Doc d) — produces an ERROR node, because record_pattern's head choice is identifier / _reserved_identifier / generic_type with no scoped_type_identifier. Java 21 codebases use the qualified form whenever the record is a nested type named through its enclosing type. Add scoped_type_identifier to the choice, mirroring what _unannotated_type already allows in a type_pattern. Regenerated with tree-sitter CLI 0.26.13 at the committed ABI (14); adds a corpus test covering both the instanceof and the switch-label form. Reported downstream as semgrep/semgrep#11954.
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.
A record pattern headed by a qualified type name produces an ERROR node:
record_pattern's head choice isidentifier / _reserved_identifier / generic_type— noscoped_type_identifier— whiletype_patternalready accepts any_unannotated_type(which includesscoped_type_identifier). Java 21 codebases use the qualified form whenever the record is a nested type named through its enclosing type, and every upstream tag back to v0.20.2 errors on it (reported downstream as semgrep/semgrep#11954).This PR adds
scoped_type_identifierto the choice. Regenerated with tree-sitter CLI 0.26.13 at the committed ABI (14): no new conflicts (only the pre-existing_simple_typesupertype warning), STATE_COUNT 1378 → 1388. Adds a corpus test covering both theinstanceofand the switch-label form;tree-sitter testpasses 109/109.