We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I had a question...
Scala version: 2.13.16
class C { def g = { val t = Option((27, 42)) for { ns <- t (i, j) = ns } yield 42 } }
Does not warn unused i, j under -Wunused.
i
j
-Wunused
It correctly does not warn for the unused "intermediates" during the tupling map, but should warn because they are not used after that.
The existing test only verifies that it does not yield a false positive under -Wunused:-patvars (turned off).
-Wunused:-patvars
package <empty> { class C extends scala.AnyRef { def <init>(): C = { C.super.<init>(); () }; def g: Option[Int] = { val t: Option[(Int, Int)] = scala.Option.apply[(Int, Int)](scala.Tuple2.apply[Int, Int](17, 42)); t.map[((Int, Int), (Int, Int))](((ns: (Int, Int)) => { <synthetic> <artifact> private[this] val x$2: ((Int, Int), Int, Int) = (ns: (Int, Int) @unchecked) match { case (x$1 @ (_1: Int, _2: Int): (Int, Int)((i @ _), (j @ _))) => scala.Tuple3.apply[(Int, Int), Int, Int](x$1, i, j) }; val x$1: (Int, Int) = x$2._1; val i: Int = x$2._2; val j: Int = x$2._3; scala.Tuple2.apply[(Int, Int), (Int, Int)](ns, x$1) })).map[Int](((x$3: ((Int, Int), (Int, Int))) => (x$3: ((Int, Int), (Int, Int)) @unchecked) match { case (_1: (Int, Int), _2: (Int, Int)): ((Int, Int), (Int, Int))((ns @ _), (_1: Int, _2: Int): (Int, Int)((i @ _), (j @ _))) => 42 })) } } }
The text was updated successfully, but these errors were encountered:
Verified it works under the port to dotty in scala/scala3#20894
-- [E198] Unused Symbol Warning: t13070.scala:7:7 ------------------------------ 7 | (i, j) = ns | ^ | unused pattern variable -- [E198] Unused Symbol Warning: t13070.scala:7:10 ----------------------------- 7 | (i, j) = ns | ^ | unused pattern variable 2 warnings found
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Questions are not bug reports
I had a question...
Reproduction steps
Scala version: 2.13.16
Problem
Does not warn unused
i
,j
under-Wunused
.It correctly does not warn for the unused "intermediates" during the tupling map, but should warn because they are not used after that.
The existing test only verifies that it does not yield a false positive under
-Wunused:-patvars
(turned off).The text was updated successfully, but these errors were encountered: