Closed
Description
Questions are not bug reports
I had a question...
Reproduction steps
Scala version: 2.13.16
class C {
def g = {
val t = Option((27, 42))
for {
ns <- t
(i, j) = ns
} yield 42
}
}
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).
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
}))
}
}
}
Metadata
Metadata
Assignees
Labels
No labels