Configurable warnings, warning suppression

We’re hoping to land the following PR in time for 2.13.2: https://github.com/scala/scala/pull/8373

The starting point was @ghik’s immensely useful “silencer” plugin. We’re very grateful to Roman for pioneering this.

Feedback welcome.

8 Likes

Note that if you want to actually try it out, you can:

resolvers += "pr" at
  "https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/"
scalaVersion := "2.13.2-bin-59cf05f-SNAPSHOT"

At least, that’s the SHA of the PR’s HEAD at the moment. (There might be newer commits by the time you read this.)

3 Likes

Seems to work on my machine, where

scala --scala-version 2.13.2-bin-59cf05f-SNAPSHOT -e "def t = { 0; 1 }"
warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
def t = { 0; 1 }
          ^

whilst

scala --scala-version 2.13.2-bin-59cf05f-SNAPSHOT -e "def t = { 0: @scala.annotation.silent; 1 }"

raises no warning. I updated SO Is there an equivalent to SuppressWarnings in Scala?

5 Likes

(Note that Mario is using https://github.com/dwijnand/scala-runners ; that’s what makes scala --scala-version work.)

7 Likes

The PR is now merged, but there is still time for further testing and feedback before the 2.13.2 release.

2 Likes