diff --git a/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructedObjectsEquality.kt b/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructedObjectsEquality.kt index 2f41e40ff81..a9442c5eb6e 100644 --- a/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructedObjectsEquality.kt +++ b/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructedObjectsEquality.kt @@ -6,6 +6,7 @@ // IGNORE_BACKEND: WASM // ^ wasm-function[1893]:0x1cf8a: RuntimeError: dereferencing a null pointer +// IGNORE_BACKEND: JS // IGNORE_BACKEND: JS_IR // ^ TypeError: tmp is not a function diff --git a/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorEquality.kt b/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorEquality.kt index 39071f2e06a..5b28880fb4e 100644 --- a/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorEquality.kt +++ b/compiler/testData/codegen/box/callableReference/funInterfaceConstructor/funInterfaceConstructorEquality.kt @@ -6,6 +6,7 @@ // IGNORE_BACKEND: WASM // ^ Failed: ks1 != ks2 (same file, same SAM type) +// IGNORE_BACKEND: JS // IGNORE_BACKEND: JS_IR // ^ Failed: ks1 != ks2 (same file, same SAM type) diff --git a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.ir.txt b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.ir.txt index 3c0314d3c60..df07c6c07c4 100644 --- a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.ir.txt +++ b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.ir.txt @@ -133,3 +133,14 @@ FILE fqName: fileName:/funInterfaceConstructorReference.kt TYPE_OP type=.KConsumer origin=SAM_CONVERSION typeOperand=.KConsumer GET_VAR 'function: kotlin.Function1 declared in .test3a.KConsumer' type=kotlin.Function1 origin=null FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1): .KConsumer declared in .test3a' type=kotlin.reflect.KFunction1, .KConsumer> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget= + FUN name:test3b visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction<.KConsumer> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test3b (): kotlin.reflect.KFunction<.KConsumer> declared in ' + BLOCK type=kotlin.reflect.KFunction1, .KConsumer> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE + FUN ADAPTER_FOR_FUN_INTERFACE_CONSTRUCTOR name:KConsumer visibility:local modality:FINAL <> (function:kotlin.Function1) returnType:.KConsumer + VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:function index:0 type:kotlin.Function1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1): .KConsumer declared in .test3b' + TYPE_OP type=.KConsumer origin=SAM_CONVERSION typeOperand=.KConsumer + GET_VAR 'function: kotlin.Function1 declared in .test3b.KConsumer' type=kotlin.Function1 origin=null + FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1): .KConsumer declared in .test3b' type=kotlin.reflect.KFunction1, .KConsumer> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget= diff --git a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.kt.txt index f1dcde7bcf4..a111cd7808b 100644 --- a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.fir.kt.txt @@ -86,3 +86,13 @@ fun test3a(): Function1, KConsumer> { } } +fun test3b(): KFunction> { + return { // BLOCK + local fun KConsumer(function: Function1): KConsumer { + return function /*-> KConsumer */ + } + + ::KConsumer + } +} + diff --git a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.ir.txt b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.ir.txt index 676f2df7d48..13c14ed2405 100644 --- a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.ir.txt +++ b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.ir.txt @@ -133,3 +133,14 @@ FILE fqName: fileName:/funInterfaceConstructorReference.kt TYPE_OP type=.KConsumer origin=SAM_CONVERSION typeOperand=.KConsumer GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in .test3a.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): .KConsumer declared in .test3a' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, .KConsumer> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget= + FUN name:test3b visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction<.KConsumer> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test3b (): kotlin.reflect.KFunction<.KConsumer> declared in ' + BLOCK type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, .KConsumer> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE + FUN ADAPTER_FOR_FUN_INTERFACE_CONSTRUCTOR name:KConsumer visibility:local modality:FINAL <> (function:kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>) returnType:.KConsumer + VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:function index:0 type:kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): .KConsumer declared in .test3b' + TYPE_OP type=.KConsumer origin=SAM_CONVERSION typeOperand=.KConsumer + GET_VAR 'function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> declared in .test3b.KConsumer' type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit> origin=null + FUNCTION_REFERENCE 'local final fun KConsumer (function: kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>): .KConsumer declared in .test3b' type=kotlin.reflect.KFunction1<@[ParameterName(name = 'function')] kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String, kotlin.Unit>, .KConsumer> origin=FUN_INTERFACE_CONSTRUCTOR_REFERENCE reflectionTarget= diff --git a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt index cf8957dc747..8790fe24c40 100644 --- a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt +++ b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt @@ -34,3 +34,4 @@ fun test3(): ((String) -> Unit) -> KConsumer = ::KConsumer fun test3a(): ((String) -> Unit) -> KConsumer = ::KCS +fun test3b(): KFunction> = ::KConsumer diff --git a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt.txt b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt.txt index da23c407847..bbebf64d22b 100644 --- a/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt.txt +++ b/compiler/testData/ir/irText/expressions/funInterfaceConstructorReference.kt.txt @@ -86,3 +86,13 @@ fun test3a(): Function1, KConsumer> { } } +fun test3b(): KFunction> { + return { // BLOCK + local fun KConsumer(function: Function1<@ParameterName(name = "x") String, Unit>): KConsumer { + return function /*-> KConsumer */ + } + + ::KConsumer + } +} +