-
Notifications
You must be signed in to change notification settings - Fork 1.1k
-Wunused: false positive for pure expressions in for-yield #16823
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
Comments
same as scala/bug#10287 perhaps? cc @som-snytt |
The comment on the feature PR (at some point) was that fidelity of representation should make analysis easier in Scala 3, so hopefully this ticket is not as discouraging. |
Doesn't seem to be exactly the same, but could be same root cause? |
What compiler settings are needed to reproduce this? I'm not able to reproduce it with: //> using scala "3.3.0-RC2"
//> using option "-Wunused:all"
object O:
for
x <- List(1,2,3)
y = x * 2
yield y |
@SethTisue not sure how output works, but
|
same result (no warning) with |
I intended to show that if REPL reporter doesn't report, it's conceivable that the command runner reporter doesn't report, so possibly only |
I tried to minimize it, but I can't seem to provoke it now. I'll see if it persists in my larger project. |
It seems to happen in cross-projects: // plugins.sbt
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
// build.sbt
val scala3Version = "3.3.0-RC2"
lazy val root = crossProject(JSPlatform,JVMPlatform)
.in(file("."))
.settings(
name := "wunused-repro",
version := "0.1.0-SNAPSHOT",
scalaVersion := scala3Version,
scalacOptions ++= Seq("-Wunused:unsafe-warn-patvars")
)
// jvm/src/main/scala/Main.scala
@main def run = println("HEY")
val xs =
for
x <- List(1,2,3) // unused pattern variable
y = x * 2
yield y |
Fixed with #17020 |
Compiler version
3.3.0-RC2
Minimized code
Expectation
no warning since the pattern variable is used in the pure expression
The text was updated successfully, but these errors were encountered: