References to generic functions

2020-02-07 00:56发布

问题:

Is it possible to make reference to generic functions in Kotlin?

For example, let's say I have a function:

fun inline <reified T> appendToString(a: T, b: T) = a.toString() + b.toString

How can you reference this function? This will not compile

var a = ::appendToString<Int>

回答1:

Currently it is not supported. But there is a feature request you can support if you would like to see it implemented :) KT-12140