scala / bug

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

Missing warning infer-any in function result #12861

Open som-snytt opened 9 months ago

som-snytt commented 9 months ago

Reproduction steps

Scala version: 2.13.11

$ scala -Vprint -Xlint -Dscala.repl.info

scala 2.13.11> import scala.collection.{AnyStepper, Stepper}

scala 2.13.11> def f[A, B](x: => AnyStepper[A], y: => Stepper[B]): Unit = {
             | List(() => x, () => y)
             | }
[[syntax trees at end of                     typer]] // <console>

      def f[A, B](x: => scala.collection.AnyStepper[A], y: => scala.collection.Stepper[B]): Unit = {
        scala.`package`.List.apply[() => scala.collection.Stepper[Any]]((() => x), (() => y));
        ()
      }

Problem

It inferred Any but did not warn.