3

We have problems when using Scalac -Xfatal-warnings in the following cases:

  1. Implicit vals used by macros internally
  2. Internal vals that macros auto-generate

In both cases, we see Scalac failing to compile because it detects some values are not used, while we know they are (simply, when we remove them, the code doesn't compile anymore)

Although the two might be symptoms of the same problem in Scalac, they boil down to the same issue for us: we need to disable the -Ywarn-unused in Scala 2.11.12

Is there a way to exclude specific class files so they won't be affected by the compiler flag?

Edmondo
  • 19,559
  • 13
  • 62
  • 115

1 Answers1

1

As far as I know there is no way of disabling scalac flag for just one file (if you compile your whole project at once by e.g sbt). You can extract class into separate module with different compile flags.

In case of implicit vals used internally in macros, personally I use -Ywarn-macros:after flag, which make these implicits used in macro count as used. (Talking about Scala 2.12.4).

Mateusz Kubuszok
  • 24,995
  • 4
  • 42
  • 64