bug icon indicating copy to clipboard operation
bug copied to clipboard

Missing warning infer-any in function result

Open som-snytt opened this issue 2 years ago • 0 comments

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.

som-snytt avatar Sep 03 '23 20:09 som-snytt