scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

Unused warning does not include -uniqid #12720

Closed som-snytt closed 1 year ago

som-snytt commented 1 year ago

Reproduction steps

See https://github.com/scala/bug/issues/10287

scala> for (x <- Option(42); y <- Option(27) if x < 17; res = x - y) yield res
                             ^
       warning: parameter value y in anonymous function is never used
[[syntax trees at end of                     typer]] // <console>
[snip]
      private[this] val res1#27309: Option#1223[Int#1208] = scala#24.Option#1224.apply#22145[Int#1208](42).flatMap#22159[Int#1208](((x#27319: Int#1208) => scala#24.Option#1224.apply#22145[Int#1208](27).withFilter#22164(((y#27327: Int#1208) => x#27319.<#8594(17))#27326).map#22168[(Int#1208, Int#1208)](((y#27333: Int#1208) => {
  val res#27334: Int#1208 = x#27319.-#8644(y#27333);
  scala#24.Tuple2#1401.apply#10868[Int#1208, Int#1208](y#27333, res#27334)
})#27332).map#22157[Int#1208](((x$1#27347: (Int#1208, Int#1208)) => (x$1#27347: (Int#1208, Int#1208) @unchecked#1955) match {
        case (_1#27351: Int#1208, _2#27352: Int#1208): (Int#1208, Int#1208)((y#27353 @ _), (res#27354 @ _)) => res#27354
      })#27346))#27318);
      <stable> <accessor> def res1#27310: Option#1223[Int#1208] = $iw#27304.this.res1#27309
    };

Problem

Which y warns?