-
Notifications
You must be signed in to change notification settings - Fork 55
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
@nowarn annotations behavior change between 0.5.0 and 0.5.1 #210
Comments
Here is my build.sbt
my plugins.sbt config
and my dependencies
|
This flag got in by default when updating //> using scala 3.4.1
//> using toolkit typelevel::latest
//> using option -Wnonunit-statement
import cats.effect.*
object Main extends IOApp.Simple:
def run: IO[Unit] =
IO.pure("discarded") // <-- you'll get a warn here
IO.println("foo") *> IO.println("bar") As per your case, I'll try to reproduce it with sbt, as with scala-cli it doesn't appear to be faulty: //> using scala 3.3.3
//> using dep org.scalatest::scalatest::3.2.18
//> using option -Wnonunit-statement, -Wunused:nowarn
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import scala.annotation.nowarn
@nowarn("msg=unused value of type org\\.scalatest\\.Assertion")
class MainSpec extends AnyFreeSpec with Matchers:
"unused value warnings" in {
"3".toInt shouldBe 3
"4".toInt shouldBe 4
} A thing to bear in mind is that the syntax for nowarn is |
As @Daenyth made me notice, this is probably related to a 3.3.x bug: scala/scala3#18804. |
In version 0.5.0, we were able to suppress unused value warnings in scalacheck tests like so:
This complies and runs with 0.5.0 of the plugin, but under version 0.5.1 we see the following compiler error:
I see from the README that we can disable this in built.sbt with
Test / tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement
But we have many projects that are suppressing on a per file basis via annotations.
Is this a regression issue or a desired functionality change between 0.5.0 and 0.5.1?
The text was updated successfully, but these errors were encountered: