Skip to content
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

Scala 2.11: local val in value $anonfun is never used #37

Open
nigredo-tori opened this issue Sep 25, 2019 · 0 comments
Open

Scala 2.11: local val in value $anonfun is never used #37

nigredo-tori opened this issue Sep 25, 2019 · 0 comments

Comments

@nigredo-tori
Copy link

nigredo-tori commented Sep 25, 2019

When building tests for catsTests for Scala 2.11.12 with -Ywarn-unused, I get a following lint warning:

[warn] /tmp/better-monadic-for/cats-tests/src/test/scala/com/olegpy/bm4/CatsSyntaxTest.scala:37:13: local val in value $anonfun is never used
[warn]           _ <- "dummy".pure[F]
[warn]             ^

A minimal (?) example for this looks like this:

def f[F[_]: Monad] =
  for {
    _ <- "dummy".pure[F]
    a = 1
  } yield a

Additionally, under the same conditions this code:

import cats.Monad
import cats.implicits._

object Foo {
  def foo[F[_]: Monad]: F[Unit] =
    for {
      _ <- ().pure[F]
      (a, b) = (1, 2)
      _ = println(s"($a, $b)")
    } yield ()
}

also produces warnings:

[warn] /tmp/better-monadic-for/cats-tests/src/test/scala/com/olegpy/bm4/Foo.scala:8:7: local val in value $anonfun is never used
[warn]       (a, b) = (1, 2)
[warn]       ^
[warn] /tmp/better-monadic-for/cats-tests/src/test/scala/com/olegpy/bm4/Foo.scala:9:18: local val in value $anonfun is never used
[warn]       _ = println(s"($a, $b)")
[warn]                  ^

These two seem to be introduced in 5eba85b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant