Skip to content

Commit b697afa

Browse files
mbovelclaude
authored andcommitted
Fix parseFlags to handle constant-folded flag values
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>
1 parent 0f8e77e commit b697afa

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

oolong-core/src/main/scala/oolong/Utils.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ private[oolong] object Utils:
143143
parseFlagsRec(term)(flags :+ mapNameToFlag(flag))
144144
case Select(term, "|") => parseFlagsRec(term)(flags)
145145
case Select(Ident("Pattern"), flag) => flags :+ mapNameToFlag(flag)
146+
case Literal(IntConstant(n)) =>
147+
flags ++ (0 until 30).map(1 << _).filter(b => (n & b) != 0)
146148

147149
parseFlagsRec(term)(List.empty)
148150

0 commit comments

Comments
 (0)