Repository navigation
Merged
Conversation
…compound assignment (#2525) Root cause: the `/` branch of Lexer.next_token (src/Lexer.w) returned TK_SLASH_EQ for `/=` before it asked lexer_slash_starts_regex whether a regex can start there, so `/=> Some\((.*)\)/.replace(line, ...)` lexed as `/=` and failed with "expected expression". In a regex position `/=` has no left operand to divide; the regex decision now comes first and `/=` is the operator everywhere else (`n /= 2` is unchanged). Evidence: before behav_2525_regex_starting_with_eq.w:11: error: expected expression after Some(x) => x / true / 5 (stage1) Test: test/behavior/behav_2525_regex_starting_with_eq.w
/= begins a regex literal, not the compound assignment (#2525)
ehartford
marked this pull request as ready for review
October 25, 2026 20:07
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.
Root cause: the
/branch of Lexer.next_token (src/Lexer.w) returnedTK_SLASH_EQ for
/=before it asked lexer_slash_starts_regex whether aregex can start there, so
/=> Some\((.*)\)/.replace(line, ...)lexed as/=and failed with "expected expression". In a regex position/=hasno left operand to divide; the regex decision now comes first and
/=isthe operator everywhere else (
n /= 2is unchanged).Evidence:
before behav_2525_regex_starting_with_eq.w:11: error: expected expression
after Some(x) => x / true / 5 (stage1)
Test: test/behavior/behav_2525_regex_starting_with_eq.w
Closes #2525