Aamir
Aamir

Reputation: 2424

Upgrading to Scala 2.13 giving scalaoptions error

I just upgraded to Scala latest version 2.13.2, now I resolved all dependencies. Inside IntelliJ sbt refresh is working fine, but when I build the project I am getting this error:

Error: scalac: 'by-name-right-associative' is not a valid choice for '-Xlint'
Error: scalac: 'nullary-override' is not a valid choice for '-Xlint'
Error: scalar: 'unsound-match' is not a valid choice for '-Xlint'
Error: scala: bad option: '-Yno-adapted-args'

Not, sure what to do about it, I tried checking everywhere, but I am not able to resolve it. Can someone please help.

Upvotes: 2

Views: 2040

Answers (1)

Mateusz Kubuszok
Mateusz Kubuszok

Reputation: 27595

Your build.sbt (or some plugin imported in it) is setting up these options for scalac. You can find there something like:

scalacOptions ++= Seq(
  ...
  "-Xlint:by-name-right-associative",
  ...
  "-Xlint:nullary-override",
  ...
  "-Xlint:unsound-match",
  ...
  "-Yno-adapted-args",
 ...
)

which adds options that aren't valid for Scala 2.13. Once you remove them things should be ok.

To find them you can use inspect scalacOptions to list all places where this settings where modified, and then look there to get rid of them. If this is in some plugin that you cannot edit you can always remove them "manually":

scalacOptions --= Seq(
  "-Xlint:by-name-right-associative",
  "-Xlint:nullary-override",
  "-Xlint:unsound-match",
  "-Yno-adapted-args"
)

Upvotes: 9

Related Questions