Scala: close parser gaps for Super, ForYield, Alternative, and other AST nodes#7398
Open
jkschneider wants to merge 1 commit intomainfrom
Open
Scala: close parser gaps for Super, ForYield, Alternative, and other AST nodes#7398jkschneider wants to merge 1 commit intomainfrom
jkschneider wants to merge 1 commit intomainfrom
Conversation
Fixes ScalaParser gaps surfaced by real-world parse testing. Adds visitors for Trees.Super, Trees.Alternative, Trees.SingletonTypeTree, Trees.RefinedTypeTree, Trees.Annotated, untpd.MacroTree, untpd.ExtMethods, and untpd.ForYield, plus fallbacks for multi-generator/guarded ForDo and unrecognized Apply forms. Tightens compound-assign detection so user-defined operators like ===, =:=, and := route to infix method calls instead of failing.
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.
Summary
Super,Alternative,SingletonTypeTree,RefinedTypeTree,Annotated,MacroTree,ExtMethods,ForYield) so real-world Scala sources with these constructs no longer fail to parse.visitForDoto handle multi-generator, guarded, and destructured forms via source preservation.visitApplyfor forms likesuper(args)/this(args)that the existing dispatch didn't cover.visitInfixOpso user-defined operators like===,=:=,<:<,:=correctly route to infix method calls instead of being mis-treated as compound assignments.The preserve-as-text mappings follow the existing pattern used by
visitBind,visitInterpolatedString,visitTypeAlias, etc. Proper S-types for these constructs remain as follow-up work (perrewrite-scala/CLAUDE.mdguidance).Test plan
SuperTest,TypeApplyTest,InfixOpTest,AlternativePatternTest,SingletonTypeTreeTest,RefinedTypeTreeTest,AnnotatedExprTest,ForYieldTest,ComplexForDoTest./gradlew :rewrite-scala:testpasses