Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental.modularity breaks as-named infix type #21426

Closed
TomasMikula opened this issue Aug 23, 2024 · 1 comment
Closed

experimental.modularity breaks as-named infix type #21426

TomasMikula opened this issue Aug 23, 2024 · 1 comment
Assignees

Comments

@TomasMikula
Copy link
Contributor

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.

@TomasMikula TomasMikula added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 23, 2024
@Gedochao Gedochao added area:experimental area:experimental:modularity Issues related to the modularity extension. and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 23, 2024
@hamzaremmal hamzaremmal self-assigned this Aug 23, 2024
@Gedochao
Copy link
Contributor

Let's track this under #21769

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants