Skip to content

Unused warning for used variable in for comprehension filter #12912

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
esgott opened this issue Nov 23, 2023 · 2 comments
Closed

Unused warning for used variable in for comprehension filter #12912

esgott opened this issue Nov 23, 2023 · 2 comments

Comments

@esgott
Copy link

esgott commented Nov 23, 2023

Reproduction steps

Scala version: 2.13.12

build.sbt:

scalaVersion := "2.13.12"

addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")

scalacOptions ++= Seq(
  "-Wunused"
)

src.scala:

object src {
  val foo = for {
    a <- Some("a")
    if a == "b"
  } yield ()
}

Problem

a is actually used, but it's reported as unused

[warn] src.scala:3:5: parameter a in anonymous function is never used
[warn]     a <- Some("a")
[warn]     ^
[warn] one warning found
@esgott
Copy link
Author

esgott commented Nov 23, 2023

Actually, you don't even need the better-monadic-for plugin. I assumed it must be in connection with that, but the warning is there even without that.

@esgott esgott changed the title Unused warning for used variable with better-monadic-for Unused warning for used variable in for comprehension filter Nov 23, 2023
@som-snytt
Copy link

Duplicates #10287

@som-snytt som-snytt closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
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