Skip to content

"never used" warning in for comprehension with filter even though variable is used #12050

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

Closed
gaeljw opened this issue Jun 23, 2020 · 1 comment

Comments

@gaeljw
Copy link

gaeljw commented Jun 23, 2020

reproduction steps

Using Scala 2.12.11 (with Ywarn-unused... and -Xfatal-warnings flags),

def getA(): Future[String] = ???
def getB(a: String): Future[Int] = ???

for {
  a <- getA() if a == "foo"
  b <- getB(a) if b == 0
} yield a
Error:(28, 7) parameter value b in value $anonfun is never used
      b <- getB(a) if b == 0

problem

Hi

I believe the above piece of code which triggers the "never used" warning should not.
Am I right or am I missing something?

I didn't try on 2.13 yet.

@SethTisue
Copy link
Member

duplicate of #11175 which we consolidated under #10287

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

2 participants