Type mismatch: inferred type is T but kotlin.Any was expected
<p>I have the following code:</p>

<pre><code>val map = HashMap&lt;Int, Any&gt;()
fun &lt;T&gt; test(t: T) = map.put(0, t) // Type mismatch: inferred type is T but kotlin.Any was expected
</code></pre>

<p>But <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/" rel="noreferrer">every Kotlin class has Any as a superclass</a>, so why this error?</p>