Files
kotlin/compiler/testData/codegen/box/callableReference/function/genericCallableReferencesWithOverload.kt
Juan Chen 9dd8eda1c9 [FIR]: fix library methods in packages
Library methods such as 'listOf' are resolved
to have the package fragments as their parents,
but JVM expects their containing file classes as parents.
This fix generates those file classes and
uses them as parent replacements for such library methods.
2020-02-20 14:24:02 +03:00

22 lines
434 B
Kotlin
Vendored

// WITH_RUNTIME
// WITH_REFLECT
import kotlin.test.assertEquals
fun foo(x: Int?) {}
fun foo(y: String?) {}
fun foo(z: Boolean) {}
inline fun <reified T> bar(f: (T) -> Unit, tType: String): T? {
assertEquals(tType, T::class.simpleName)
return null
}
fun box(): String {
val a1: Int? = bar(::foo, "Int")
val a2: String? = bar(::foo, "String")
val a3: Boolean? = bar<Boolean>(::foo, "Boolean")
return "OK"
}