Open
Description
Reproduction steps
Scala version: 2.13.11
scala> List(42, "")
^
warning: a type was inferred to be `Any`; this may indicate a programming error.
val res0: List[Any] = List(42, "")
scala> val b = collection.mutable.ListBuffer.empty[Int]
val b: scala.collection.mutable.ListBuffer[Int] = ListBuffer()
scala> def f(i: Int, t: Boolean) = if (t) b += i
def f(i: Int, t: Boolean): Any
Problem
It inferred Any
, so it should tell me so. It may indicate a programming error!
In this case, b.+=
is not Unit
. The RHS and the result of f
is inferred Any
.
Noticed at scala/scala#10466 (comment)