Files
kotlin-fork/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt.txt
T
2024-02-16 10:19:38 +00:00

99 lines
2.6 KiB
Kotlin
Vendored

fun interface KConsumer<T : Any?> {
abstract fun accept(x: T)
}
fun interface KRunnable {
abstract fun run()
}
fun interface KSupplier<T : Any?> {
abstract fun get(): T
}
fun test1(): KFunction1<@ParameterName(name = "function") Function0<Unit>, KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
}
}
fun test1a(): KFunction1<@ParameterName(name = "function") Function0<Unit>, KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
}
}
fun test1b(): KFunction<KRunnable> {
return { // BLOCK
local fun KRunnable(function: Function0<Unit>): KRunnable {
return CHECK_NOT_NULL<Function0<Unit>>(arg0 = function) /*-> KRunnable */
}
::KRunnable
}
}
fun test2(): Function1<Function0<String>, KSupplier<String>> {
return { // BLOCK
local fun KSupplier(function: Function0<String>): KSupplier<String> {
return CHECK_NOT_NULL<Function0<String>>(arg0 = function) /*-> KSupplier<String> */
}
::KSupplier
}
}
fun test2a(): Function1<Function0<String>, KSupplier<String>> {
return { // BLOCK
local fun KSupplier(function: Function0<String>): KSupplier<String> {
return CHECK_NOT_NULL<Function0<String>>(arg0 = function) /*-> KSupplier<String> */
}
::KSupplier
}
}
fun test3(): Function1<Function1<String, Unit>, KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<@ParameterName(name = "x") String, Unit>): KConsumer<String> {
return CHECK_NOT_NULL<Function1<@ParameterName(name = "x") String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
}
}
fun test3a(): Function1<Function1<String, Unit>, KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<@ParameterName(name = "x") String, Unit>): KConsumer<String> {
return CHECK_NOT_NULL<Function1<@ParameterName(name = "x") String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
}
}
fun test3b(): KFunction<KConsumer<String>> {
return { // BLOCK
local fun KConsumer(function: Function1<@ParameterName(name = "x") String, Unit>): KConsumer<String> {
return CHECK_NOT_NULL<Function1<@ParameterName(name = "x") String, Unit>>(arg0 = function) /*-> KConsumer<String> */
}
::KConsumer
}
}
typealias KCS = KConsumer<String>
typealias KR = KRunnable
typealias KSS = KSupplier<String>