`experimental.modularity` breaks `as`-named infix type
Opened this issue · 0 comments
TomasMikula commented
Compiler version
3.5.0
Minimized code
// used only as phantoms
sealed trait JsString
sealed trait JsNumber
infix sealed trait as[J, S]
object as:
case object Str extends (JsString as String)
case object Num extends (JsNumber as Double)
def test[J, S](
repr: J as S,
value: S,
): Unit =
()
Output
Compiling without any compiler flags succeeds:
scala compile test.scala
Compiling with -source:future
also succeeds:
scala compile -source:future test.scala
Compiling with -language:experimental.modularity
fails:
% scala compile -source:future -language:experimental.modularity test.scala
Compiling project (Scala 3.5.0, JVM (21))
[error] ./test.scala:7:37
[error] ',' or ')' expected, but identifier found
[error] case object Str extends (JsString as String)
[error] ^^
[error] ./test.scala:8:37
[error] ',' or ')' expected, but identifier found
[error] case object Num extends (JsNumber as Double)
[error] ^^
[error] ./test.scala:11:11
[error] ',' or ')' expected, but identifier found
[error] repr: J as S,
[error] ^^
Error compiling project (Scala 3.5.0, JVM (21))
Compilation failed
Expectation
The modularity
feature should not break existing syntax.