2

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.

1

1 Answer 1

9

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"
)
1
  • 1
    Perhaps OP has an outdated version of sbt-tpolecat — that's a popular sbt plugin for setting up scalacOptions
    – Seth Tisue
    Commented Jul 23, 2020 at 22:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.