Fix JuliaSyntax error handling for invalid dotted operators#60843
Open
riazation42 wants to merge 3 commits intoJuliaLang:masterfrom
Open
Fix JuliaSyntax error handling for invalid dotted operators#60843riazation42 wants to merge 3 commits intoJuliaLang:masterfrom
riazation42 wants to merge 3 commits intoJuliaLang:masterfrom
Conversation
When parsing invalid dotted operators like 'a .:= b', JuliaSyntax was calling error() which ignored the raise=false flag and caused crashes in contexts like REPL history search. Changed dotted() function to accept ps::ParseState parameter and use emit_diagnostic() instead of error() for graceful error handling. Updated all call sites to pass ParseState parameter and added tests. Fixes JuliaLang#60665
Keno
reviewed
Feb 3, 2026
Keno
reviewed
Feb 3, 2026
Keno
approved these changes
Feb 3, 2026
Member
Keno
left a comment
There was a problem hiding this comment.
Changes seems good in general, but specific comments above.
Co-authored-by: Keno Fischer <[email protected]>
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.
Fixes #60665
Problem
When parsing invalid dotted operators like
a .:= b, JuliaSyntax was callingerror()which ignored theraise=falseflag and caused crashes in contexts like REPL history search.Solution
dotted()function to acceptps::ParseStateparametererror()withemit_diagnostic()for error handlingK"error"marker instead of throwing exceptionparse_lazy_cond()andparse_assignment_with_initial_ex()to pass ParseStateTesting
Added test cases verifying invalid dotted operators return error expressions instead of crashing when
raise=falseis specified.Test Results
Meta.parse("a .:= b"; raise=false)returns error expression (doesn't crash).=continue to workraise=true, properly throws ParseErrorNote AI tools were used to learn parser internals and error handling; all code was written and tested by me.