Fix parseFlags to handle constant-folded flag values#61
Merged
danslapman merged 1 commit intoleviysoft:mainfrom Apr 9, 2026
Merged
Fix parseFlags to handle constant-folded flag values#61danslapman merged 1 commit intoleviysoft:mainfrom
danslapman merged 1 commit intoleviysoft:mainfrom
Conversation
ec49f2a to
b697afa
Compare
When the compiler constant-folds `Pattern.CASE_INSENSITIVE | Pattern.COMMENTS` into a single IntConstant (e.g. 6), parseFlags failed to match. This adds a case to decompose the constant back into individual flag bits. See scala/scala3#25731 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b697afa to
8bf6cae
Compare
Member
|
Thank you for your contribution @mbovel! |
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.
Problem
If the compiler constant-folds a flags expression (e.g.
Pattern.CASE_INSENSITIVE | Pattern.COMMENTS) into a single IntConstant (e.g.6),parseFlagfailed to match.Solution
This PR adds a case to decompose the constant back into individual flag bits.
Notes
This issue was found while enhancing constant-folding in the Scala 3 compiler:
leviysoft/oolong:MatchErrorin quotedPattern.compileflag arguments scala/scala3#25697Checklist
README.mdif applicable[WIP]to the pull request title if it's work in progress@oolong/maintainers