Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/implicitInvokeInObjectWithFunctionalArgument.fir.kt
T

15 lines
358 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
object TestClass {
inline operator fun <T> invoke(task: () -> T) = task()
}
fun test(s: String): String {
val a = TestClass { TestClass { TestClass } }
a checkType { _<TestClass>() }
val b = TestClass { return s }
b checkType { _<Nothing>() }
}