Skip to content

Commit 3204411

Browse files
authored
Explicitly upcast intermediate result to aid program elaboration (#230)
See scala/scala3#18130 for context. We add an explicit type ascription to help the compiler infer contextual arguments.
1 parent 7111c61 commit 3204411

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/main/scala/weaponregex/parser/ParserJVM.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ class ParserJVM private[parser] (pattern: String) extends Parser(pattern) {
8989
* `"[abc]"`
9090
*/
9191
override def charClass[A: P]: P[CharacterClass] =
92-
Indexed("[" ~ "^".!.? ~ (charClassIntersection.rep(exactly = 1) | classItem.rep(minCharClassItem)) ~ "]")
92+
Indexed(
93+
"[" ~ "^".!.? ~ ((charClassIntersection.rep(exactly = 1): P[Seq[RegexTree]]) | classItem.rep(
94+
minCharClassItem
95+
)) ~ "]"
96+
)
9397
.map { case (loc, (hat, nodes)) => CharacterClass(nodes, loc, isPositive = hat.isEmpty) }
9498

9599
/** Intermediate parsing rule for special construct tokens which can parse either `namedGroup`, `nonCapturingGroup`,

0 commit comments

Comments
 (0)