fun <T: Any?> function(input: T): T = input
fun function2() {
val n = function(1)!!
}
Since T is declared as nullable, I expected the output to be nullable as well, but Lint produces Unnecessary non-null assertion (!!) on a non-null receiver of type Int warning.
Changing the output type signature to T? makes the warning go away.
Why does the output type not conform to the declaried nullability?