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

-source choices passed to scalac 3.* via space instead of colon and gets ignored. #144

Open
seigert opened this issue Mar 31, 2023 · 1 comment

Comments

@seigert
Copy link

seigert commented Mar 31, 2023

scalac respects -source option choices only if they are passed via colon to it: -source:future, -source:future-migration, etc.

As far as I could understand, sbt-tpolecat passes all options along with arguments to scalac as one big List[String] turn lead to ignore or such options.

Could be shown with this scala-cli scripts:

  1. Working one:

    //> using scala "3.2.1"
    //> using option "-source:future"
    
    def method[A: Numeric](a: A): A => A = { a1 =>
      implicitly[Numeric[A]].plus(a, a1)
    }
    
    println(s"method(1)(1) = ${method(1)(1)}")
  2. Incorrect:

    //> using scala "3.2.1"
    //> using option "-source future"
    
    def method[A: Numeric](a: A): A => A = { a1 =>
      implicitly[Numeric[A]].plus(a, a1)
    }
    
    println(s"method(1)(1) = ${method(1)(1)}")

    Compilation fails with:

    Compiling project (Scala 3.2.1, JVM)
    Warning: bad option '-source future' was ignored
    [error] ./space.sc:9:38
    [error] Found:    (1 : Int)
    [error] Required: Numeric[Int]
    [error] println(s"method(1)(1) = ${method(1)(1)}")
    [error]                                      ^
    Error compiling project (Scala 3.2.1, JVM)
    Compilation failed

P.S. the same could be said about -Ykind-projector:underscores and other : options.

@DavidGregory084
Copy link
Member

Hmm...that's frustrating. I wonder when this changed?

In fact, Scala 3.x's own compilation tests provide these as space-separated tokens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants