How to pass a type parameter to a generic class constructor reference?
问题 Assume the following code: class ConstructMe<T> {} data class Test<T> constructor(var supplier: () -> ConstructMe<T>) {} fun main(args: Array<String>) { works<Int>() breaks<Int>() } fun <T> works() { Test<T>({ ConstructMe<T>() }) // (1) any one class type parameter can be removed like: Test({ ConstructMe<T>() }) // (2) still works (class type inferred by argument type) Test<T>({ ConstructMe() }) // (3) still works (argument type inferred by class type) } fun <T> breaks() { Test<T>(: