Repository navigation
fix(hy-syntax): prevent parse_binary from folding binary operators across newlines (fixes #4327) - #4452
Open
SuperPiIot wants to merge 1 commit into
Open
fix(hy-syntax): prevent parse_binary from folding binary operators across newlines (fixes #4327)#4452SuperPiIot wants to merge 1 commit into
SuperPiIot wants to merge 1 commit into
Conversation
…ross newlines (fixes limitlessprojects#4327)
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 #4327
Summary
if !self.same_line_as_prev() || prec < min_precinParser::parse_binary(compiler/crates/hy-syntax/src/parser.rs) so that binary operator tokens starting a new line do not silently continue the previous expression across statement boundaries.a +\nb), where the binary operator remains on the same line aslhs.line_leading_binary_ops_do_not_fold_across_newlines: ensuresc := a\n-bandd := a\n&bparse as separate statements rather than folding into binary expressions.trailing_binary_op_before_newline_continues_onto_next_line: ensuresc := a +\nbcontinues onto the next line as expected.Verification
cargo test -p hy-syntax(118/118 passing, 0 failed).Settlement Coords
0xf084cF0076F91AA48C2370F427C399dAA8C1f07F