From 0c984c5e62f255d0b34195112238ce870174619c Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 13 Feb 2020 13:03:54 +0300 Subject: [PATCH] PSI2IR tests for b29993739e85dbceb02d04a964741b1410a568f8 --- .../kotlin/fir/Fir2IrTextTestGenerated.java | 10 + .../arrayAsVarargAfterSamArgument_fi.fir.txt | 123 +++++++++++ .../arrayAsVarargAfterSamArgument_fi.kt | 24 +++ .../arrayAsVarargAfterSamArgument_fi.txt | 147 +++++++++++++ .../sam/arrayAsVarargAfterSamArgument.fir.txt | 138 +++++++++++++ .../sam/arrayAsVarargAfterSamArgument.kt | 40 ++++ .../sam/arrayAsVarargAfterSamArgument.txt | 195 ++++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 10 + 8 files changed, 687 insertions(+) create mode 100644 compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt create mode 100644 compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt create mode 100644 compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt create mode 100644 compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 424580c155f..4e6e7748f66 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1490,6 +1490,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("arrayAsVarargAfterSamArgument_fi.kt") + public void testArrayAsVarargAfterSamArgument_fi() throws Exception { + runTest("compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt"); + } + @TestMetadata("basicFunInterfaceConversion.kt") public void testBasicFunInterfaceConversion() throws Exception { runTest("compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt"); @@ -1533,6 +1538,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/sam"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("arrayAsVarargAfterSamArgument.kt") + public void testArrayAsVarargAfterSamArgument() throws Exception { + runTest("compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt"); + } + @TestMetadata("genericSamProjectedOut.kt") public void testGenericSamProjectedOut() throws Exception { runTest("compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt"); diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt new file mode 100644 index 00000000000..3f5f8220672 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.fir.txt @@ -0,0 +1,123 @@ +FILE fqName: fileName:/arrayAsVarargAfterSamArgument_fi.kt + CLASS INTERFACE name:IRunnable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IRunnable + FUN name:run visibility:public modality:ABSTRACT <> ($this:.IRunnable) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.IRunnable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:foo1 visibility:public modality:FINAL <> (r:.IRunnable, s:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:r index:0 type:.IRunnable + VALUE_PARAMETER name:s index:1 type:kotlin.Array varargElementType:kotlin.String [vararg] + BLOCK_BODY + FUN name:foo2 visibility:public modality:FINAL <> (r1:.IRunnable, r2:.IRunnable, s:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:r1 index:0 type:.IRunnable + VALUE_PARAMETER name:r2 index:1 type:.IRunnable + VALUE_PARAMETER name:s index:2 type:kotlin.Array varargElementType:kotlin.String [vararg] + BLOCK_BODY + FUN name:test visibility:public modality:FINAL <> (fn:kotlin.Function0, r:.IRunnable, s:kotlin.String, arr:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0 + VALUE_PARAMETER name:r index:1 type:.IRunnable + VALUE_PARAMETER name:s index:2 type:kotlin.String + VALUE_PARAMETER name:arr index:3 type:kotlin.Array + BLOCK_BODY + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt new file mode 100644 index 00000000000..b41780765f7 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt @@ -0,0 +1,24 @@ +// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions + +fun interface IRunnable { + fun run() +} + +fun foo1(r: IRunnable, vararg s: String) {} +fun foo2(r1: IRunnable, r2: IRunnable, vararg s: String) {} + +fun test(fn: () -> Unit, r: IRunnable, s: String, arr: Array) { + foo1({}, s) + foo1({}, *arr) + foo1(fn, s) + foo1(fn, *arr) + foo1(r, s) + foo1(r, *arr) + + foo2({}, {}, s) + foo2({}, {}, *arr) + foo2(fn, {}, s) + foo2(fn, {}, *arr) + foo2(r, {}, s) + foo2(r, {}, *arr) +} diff --git a/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.txt b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.txt new file mode 100644 index 00000000000..1ba2beb0eec --- /dev/null +++ b/compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.txt @@ -0,0 +1,147 @@ +FILE fqName: fileName:/arrayAsVarargAfterSamArgument_fi.kt + CLASS INTERFACE name:IRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IRunnable + FUN name:run visibility:public modality:ABSTRACT <> ($this:.IRunnable) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.IRunnable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:foo1 visibility:public modality:FINAL <> (r:.IRunnable, s:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:r index:0 type:.IRunnable + VALUE_PARAMETER name:s index:1 type:kotlin.Array varargElementType:kotlin.String [vararg] + BLOCK_BODY + FUN name:foo2 visibility:public modality:FINAL <> (r1:.IRunnable, r2:.IRunnable, s:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:r1 index:0 type:.IRunnable + VALUE_PARAMETER name:r2 index:1 type:.IRunnable + VALUE_PARAMETER name:s index:2 type:kotlin.Array varargElementType:kotlin.String [vararg] + BLOCK_BODY + FUN name:test visibility:public modality:FINAL <> (fn:kotlin.Function0, r:.IRunnable, s:kotlin.String, arr:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0 + VALUE_PARAMETER name:r index:1 type:.IRunnable + VALUE_PARAMETER name:s index:2 type:kotlin.String + VALUE_PARAMETER name:arr index:3 type:kotlin.Array + BLOCK_BODY + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo1 (r: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + GET_VAR 's: kotlin.String declared in .test' type=kotlin.String origin=null + CALL 'public final fun foo2 (r1: .IRunnable, r2: .IRunnable, vararg s: kotlin.String): kotlin.Unit declared in ' type=kotlin.Unit origin=null + r1: GET_VAR 'r: .IRunnable declared in .test' type=.IRunnable origin=null + r2: TYPE_OP type=.IRunnable origin=SAM_CONVERSION typeOperand=.IRunnable + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + s: VARARG type=kotlin.Array varargElementType=kotlin.String + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt new file mode 100644 index 00000000000..ec304bdbf29 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.txt @@ -0,0 +1,138 @@ +FILE fqName: fileName:/arrayAsVarargAfterSamArgument.kt + FUN name:test visibility:public modality:FINAL <> (fn:kotlin.Function0, r:java.lang.Runnable, arr:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0 + VALUE_PARAMETER name:r index:1 type:java.lang.Runnable + VALUE_PARAMETER name:arr index:2 type:kotlin.Array + BLOCK_BODY + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? [operator] declared in .Test' type=kotlin.String? origin=null + r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? [operator] declared in .Test' type=kotlin.String? origin=null + r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? [operator] declared in .Test' type=kotlin.String? origin=null + r: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + CONST String type=kotlin.String value="" + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? [operator] declared in .Test' type=kotlin.String? origin=null + r: GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? [operator] declared in .Test' type=kotlin.String? origin=null + r: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i1 type:IrErrorType [val] + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i2 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i3 type:IrErrorType [val] + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i4 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + CONST String type=kotlin.String value="" + VAR name:i5 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r1: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i6 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + r2: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + CONST String type=kotlin.String value="" + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt new file mode 100644 index 00000000000..f15facf43d1 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt @@ -0,0 +1,40 @@ +// !LANGUAGE: +NewInference +SamConversionPerArgument +SamConversionForKotlinFunctions +// WITH_JDK + +// FILE: arrayAsVarargAfterSamArgument.kt +fun test(fn: () -> Unit, r: Runnable, arr: Array) { + Test.foo1({}, arr) + Test.foo1({}, *arr) + + Test.foo1(fn, arr) + Test.foo1(fn, *arr) + Test.foo1(r, "") + + Test.foo1(fn, arr) + Test.foo1(fn, *arr) + Test.foo1(r, *arr) + + val i1 = Test({}, arr) + val i2 = Test({}, *arr) + val i3 = Test({}, {}, arr) + val i4 = Test(r, {}, "") + val i5 = Test({}, {}, *arr) + val i6 = Test(r, {}, *arr) + + i1.foo2({}, {}, arr) + i1.foo2(r, {}, "") + i1.foo2({}, {}, *arr) + i1.foo2(r, {}, *arr) +} + +// FILE: Test.java +public class Test { + public static String foo1(Runnable r, String... strs) { + return null; + } + public String foo2(Runnable r1, Runnable r2, String... strs) { + return null; + } + public Test(Runnable r, String... strs) {} + public Test(Runnable r1, Runnable r2, String... strs) {} +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.txt new file mode 100644 index 00000000000..a0c7ad6ab95 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.txt @@ -0,0 +1,195 @@ +FILE fqName: fileName:/arrayAsVarargAfterSamArgument.kt + FUN name:test visibility:public modality:FINAL <> (fn:kotlin.Function0, r:java.lang.Runnable, arr:kotlin.Array) returnType:kotlin.Unit + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0 + VALUE_PARAMETER name:r index:1 type:java.lang.Runnable + VALUE_PARAMETER name:arr index:2 type:kotlin.Array + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + strs: GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + CONST String type=kotlin.String value="" + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + strs: GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + GET_VAR 'fn: kotlin.Function0 declared in .test' type=kotlin.Function0 origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo1 (r: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + r: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i1 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i2 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i3 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r1: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i4 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + CONST String type=kotlin.String value="" + VAR name:i5 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r1: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + VAR name:i6 type:.Test [val] + CONSTRUCTOR_CALL 'public constructor (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?) declared in .Test' type=.Test origin=null + r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo2 (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + $this: GET_VAR 'val i1: .Test [val] declared in .test' type=.Test origin=null + r1: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo2 (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + $this: GET_VAR 'val i1: .Test [val] declared in .test' type=.Test origin=null + r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + CONST String type=kotlin.String value="" + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo2 (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + $this: GET_VAR 'val i1: .Test [val] declared in .test' type=.Test origin=null + r1: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public open fun foo2 (r1: java.lang.Runnable?, r2: java.lang.Runnable?, vararg strs: kotlin.String?): kotlin.String? declared in .Test' type=kotlin.String? origin=null + $this: GET_VAR 'val i1: .Test [val] declared in .test' type=.Test origin=null + r1: GET_VAR 'r: java.lang.Runnable declared in .test' type=java.lang.Runnable origin=null + r2: TYPE_OP type=java.lang.Runnable? origin=SAM_CONVERSION typeOperand=java.lang.Runnable? + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .test' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + strs: VARARG type=kotlin.Array? varargElementType=kotlin.String? + SPREAD_ELEMENT + GET_VAR 'arr: kotlin.Array declared in .test' type=kotlin.Array origin=null diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index a4f0ebbf208..b8d892ba1b6 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1489,6 +1489,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/funInterface"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("arrayAsVarargAfterSamArgument_fi.kt") + public void testArrayAsVarargAfterSamArgument_fi() throws Exception { + runTest("compiler/testData/ir/irText/expressions/funInterface/arrayAsVarargAfterSamArgument_fi.kt"); + } + @TestMetadata("basicFunInterfaceConversion.kt") public void testBasicFunInterfaceConversion() throws Exception { runTest("compiler/testData/ir/irText/expressions/funInterface/basicFunInterfaceConversion.kt"); @@ -1532,6 +1537,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/sam"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("arrayAsVarargAfterSamArgument.kt") + public void testArrayAsVarargAfterSamArgument() throws Exception { + runTest("compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.kt"); + } + @TestMetadata("genericSamProjectedOut.kt") public void testGenericSamProjectedOut() throws Exception { runTest("compiler/testData/ir/irText/expressions/sam/genericSamProjectedOut.kt");