diff --git a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codegen/BytecodeTextUtils.kt b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codegen/BytecodeTextUtils.kt index cd4cd783711..eea99493de3 100644 --- a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codegen/BytecodeTextUtils.kt +++ b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codegen/BytecodeTextUtils.kt @@ -55,9 +55,10 @@ fun readExpectedOccurrences(lines: List): List { fun readExpectedOccurrencesForMultiFileTest( fileName: String, fileContent: String, - destination: MutableMap> + withGeneratedFile: MutableMap>, + global: MutableList ) { - var currentOccurrenceInfos: MutableList? = null + var currentOccurrenceInfos: MutableList = global var backend = TargetBackend.ANY for (line in fileContent.split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()) { if (line.contains(JVM_TEMPLATES)) backend = TargetBackend.JVM @@ -66,18 +67,15 @@ fun readExpectedOccurrencesForMultiFileTest( val atOutputFileMatcher = AT_OUTPUT_FILE_PATTERN.matcher(line) if (atOutputFileMatcher.matches()) { val outputFileName = atOutputFileMatcher.group(1) - if (destination.containsKey(outputFileName)) { + if (withGeneratedFile.containsKey(outputFileName)) { throw AssertionError("${fileName}: Expected occurrences for output file $outputFileName were already provided") } currentOccurrenceInfos = ArrayList() - destination[outputFileName] = currentOccurrenceInfos + withGeneratedFile[outputFileName] = currentOccurrenceInfos } val expectedOccurrencesMatcher = EXPECTED_OCCURRENCES_PATTERN.matcher(line) if (expectedOccurrencesMatcher.matches()) { - if (currentOccurrenceInfos == null) { - throw AssertionError("${fileName}: Should specify output file with '// @:' before expectations") - } val occurrenceInfo = parseOccurrenceInfo(expectedOccurrencesMatcher, backend) currentOccurrenceInfos.add(occurrenceInfo) } diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityExtLambda.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityExtLambda.kt index 7a446ba02d9..06b71618097 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityExtLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityExtLambda.kt @@ -4,6 +4,11 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class BigArityExtLambdaKt\$box\$1 + fun test( extFn: Int.( p0: String, p1: String, @@ -21,4 +26,4 @@ fun box() = p20: Int, p21: Int, p22: Int -> p0 + p1 - } \ No newline at end of file + } diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityLambda.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityLambda.kt index df283781112..71d42c7785d 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/bigArityLambda.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory\.metafactory +// 1 final class BigArityLambdaKt\$box\$1 + fun box() = { p0: String, p1: String, p2: Int, p3: Int, p4: Int, p5: Int, p6: Int, p7: Int, p8: Int, p9: Int, p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/capturedDispatchReceiver.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/capturedDispatchReceiver.kt index 7b5580d4c09..afac9463db0 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/capturedDispatchReceiver.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/capturedDispatchReceiver.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + class C(val x: String) { fun test() = { x } } diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/capturedExtensionReceiver.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/capturedExtensionReceiver.kt index 4ba7c831bea..191caf1954c 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/capturedExtensionReceiver.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/capturedExtensionReceiver.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + class C(val x: String) fun C.test() = { x } diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/capturingValue.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/capturingValue.kt index d043125b227..8170eb9fb1c 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/capturingValue.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/capturingValue.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun box(): String { val ok = "OK" return { ok }() diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/capturingVar.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/capturingVar.kt index a1d063d9d27..eed0926146f 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/capturingVar.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/capturingVar.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun box(): String { var ok = "Failed" { ok = "OK" }() diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/extensionLambda.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/extensionLambda.kt index ae44019e814..a7081703218 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/extensionLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/extensionLambda.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + class C(val x: String) fun boxLambda(lambda: C.() -> String) = lambda diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/genericLambdaSignature.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/genericLambdaSignature.kt index c5d94ebba3e..b77d57cc59c 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/genericLambdaSignature.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/genericLambdaSignature.kt @@ -2,9 +2,14 @@ // IGNORE_BACKEND: JVM // JVM_TARGET: 1.8 // LAMBDAS: INDY + // CHECK_BYTECODE_LISTING // WITH_SIGNATURES +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun call(value: T1, f: (T1) -> R): R { return f(value) } diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineAny.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineAny.kt index 3958133a62c..46422d85c8d 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineAny.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineAny.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class LambdaWithInlineAnyKt\$box\$t\$1 + inline class Z(val value: Any) fun foo1(fs: (Z) -> Z) = fs(Z(1)) diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineInt.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineInt.kt index 14206cb16ac..b7cde341f43 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineInt.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineInt.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: Int) fun foo1(fs: (Z) -> Z) = fs(Z(1)) diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNAny.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNAny.kt index 082f90a67ed..422370be62d 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNAny.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNAny.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: Any?) fun foo1(fs: (Z) -> Z) = fs(Z(1)) diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNInt.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNInt.kt index f371eded5f2..0f1fdf47e46 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNInt.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNInt.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: Int?) fun foo1(fs: (Z) -> Z) = fs(Z(1)) diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNString.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNString.kt index ffdf1eb303b..c0cb7510e79 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNString.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineNString.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: String?) fun foo1(fs: (Z) -> Z) = fs(Z("O")) diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineString.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineString.kt index 007188459df..7b6357370fa 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineString.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/inlineClassInSignature/lambdaWithInlineString.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class LambdaWithInlineStringKt\$box\$t\$1 + inline class Z(val value: String) fun foo1(fs: (Z) -> Z) = fs(Z("O")) diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaSerializable.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaSerializable.kt index dad517e3d5c..ea4a2ea2517 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaSerializable.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaSerializable.kt @@ -4,10 +4,14 @@ // LAMBDAS: INDY // FULL_JDK +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun lambdaIsSerializable(fn: () -> Unit) = fn is java.io.Serializable fun box(): String { if (lambdaIsSerializable {}) return "Failed: indy lambdas should not be serializable" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaToSting.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaToSting.kt index 80bfbb72ea5..4da73cf4bed 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaToSting.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/lambdaToSting.kt @@ -7,6 +7,10 @@ // desugaring on Android // IGNORE_BACKEND: ANDROID +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun lambdaToString(fn: () -> Unit) = fn.toString() fun box(): String { @@ -14,4 +18,4 @@ fun box(): String { if (!str.startsWith("LambdaToStingKt")) return "Failed: indy lambda toString is inherited from java.lang.Object: $str" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/nestedIndyLambdas.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/nestedIndyLambdas.kt index 5081ecf869a..02b7dc5e986 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/nestedIndyLambdas.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/nestedIndyLambdas.kt @@ -2,4 +2,8 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 3 java/lang/invoke/LambdaMetafactory + fun box() = { { "O" }() + { "K" }() }() diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/nullabilityAssertions.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/nullabilityAssertions.kt index aa4b937e701..341de8d02f4 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/nullabilityAssertions.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/nullabilityAssertions.kt @@ -2,7 +2,12 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY // WITH_RUNTIME +// CHECK_BYTECODE_TEXT + // FILE: nullabilityAssertions.kt +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun box(): String { val fn: (String) -> String = { it } try { diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/primitiveValueParameters.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/primitiveValueParameters.kt index 31755c370e5..90d85fc9d0d 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/primitiveValueParameters.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/primitiveValueParameters.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun box(): String { val test = { i: Int -> i + 40 }(2) if (test != 42) return "Failed: test=$test" diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/simpleIndyLambda.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/simpleIndyLambda.kt index 5c722ba6995..786456cd70f 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/simpleIndyLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/simpleIndyLambda.kt @@ -2,4 +2,8 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun box() = { "OK" }() diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/suspendLambda.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/suspendLambda.kt index 50ab4c25a4d..f6986d04f99 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/suspendLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/suspendLambda.kt @@ -2,15 +2,20 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY // WITH_RUNTIME -// WITH_COROUTINES + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class SuspendLambdaKt\$box\$1 import kotlin.coroutines.* var c: Continuation? = null -suspend fun suspendMe() = suspendCoroutine { continuation -> - c = continuation -} +suspend fun suspendMe() = + suspendCoroutine { continuation -> + c = continuation + } fun builder(c: suspend () -> Unit) { c.startCoroutine(object: Continuation { diff --git a/compiler/testData/codegen/box/invokedynamic/lambdas/voidReturnType.kt b/compiler/testData/codegen/box/invokedynamic/lambdas/voidReturnType.kt index 77fb0188c06..68d658093be 100644 --- a/compiler/testData/codegen/box/invokedynamic/lambdas/voidReturnType.kt +++ b/compiler/testData/codegen/box/invokedynamic/lambdas/voidReturnType.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // LAMBDAS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + var ok = "Failed" fun box(): String { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/boundFunctionReferenceEquality.kt b/compiler/testData/codegen/box/invokedynamic/sam/boundFunctionReferenceEquality.kt index 6cec5948027..58659bba597 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/boundFunctionReferenceEquality.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/boundFunctionReferenceEquality.kt @@ -2,7 +2,17 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY // WITH_RUNTIME + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 19 final synthetic class BoundAdaptedFunctionReferenceKt\$box\$[0-9]* +// 1 final synthetic class FromOtherFileKt\$target1FromOtherFile\$[0-9]* +// 1 final synthetic class FromOtherFileKt\$adapted1FromOtherFile\$[0-9]* +// 1 final synthetic class FromOtherFileKt\$adapted2FromOtherFile\$[0-9]* + // FILE: boundAdaptedFunctionReference.kt + fun checkEqual(x: Any, y: Any) { if (x != y || y != x) throw AssertionError("$x and $y should be equal") if (x.hashCode() != y.hashCode()) throw AssertionError("$x and $y should have the same hash code") diff --git a/compiler/testData/codegen/box/invokedynamic/sam/boundReference.kt b/compiler/testData/codegen/box/invokedynamic/sam/boundReference.kt index 52fc026fe86..60893abd175 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/boundReference.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/boundReference.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final synthetic class BoundReferenceKt\$box\$[0-9]* + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/builtinMemberReference.kt b/compiler/testData/codegen/box/invokedynamic/sam/builtinMemberReference.kt index b740f66d10d..6d9c88da451 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/builtinMemberReference.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/builtinMemberReference.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final synthetic class BuiltinMemberReferenceKt\$box\$test\$1 + fun interface IntFun { fun invoke(i: Int): Int } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/capturedDispatchReceiver.kt b/compiler/testData/codegen/box/invokedynamic/sam/capturedDispatchReceiver.kt index 9b019b39a8d..51f1cf10b82 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/capturedDispatchReceiver.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/capturedDispatchReceiver.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/capturedExtensionReceiver.kt b/compiler/testData/codegen/box/invokedynamic/sam/capturedExtensionReceiver.kt index 17a5655f0d3..8285db86068 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/capturedExtensionReceiver.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/capturedExtensionReceiver.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/capturingIndyFunInterface.kt b/compiler/testData/codegen/box/invokedynamic/sam/capturingIndyFunInterface.kt index aa1a5512b2f..2962a0d30ba 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/capturingIndyFunInterface.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/capturingIndyFunInterface.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/capturingIndySam.kt b/compiler/testData/codegen/box/invokedynamic/sam/capturingIndySam.kt index e31cdd70d48..b1b85b6996b 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/capturingIndySam.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/capturingIndySam.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: capturingIndySam.kt var test = "Failed" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/capturingVar.kt b/compiler/testData/codegen/box/invokedynamic/sam/capturingVar.kt index 154375280e5..e4778483a75 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/capturingVar.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/capturingVar.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/constructorReference.kt b/compiler/testData/codegen/box/invokedynamic/sam/constructorReference.kt index 2dc2e0eba45..4cc91915326 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/constructorReference.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/constructorReference.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final synthetic class ConstructorReferenceKt\$box\$1 + class C(val test: String) fun interface MakeC { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/covariantOverrideWithPrimitive.kt b/compiler/testData/codegen/box/invokedynamic/sam/covariantOverrideWithPrimitive.kt index 821d7df924f..c7231ed001d 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/covariantOverrideWithPrimitive.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/covariantOverrideWithPrimitive.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final class CovariantOverrideWithPrimitiveKt\$box\$test\$ + fun interface IFooAny { fun foo(): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/enhancedNullabilityMix.kt b/compiler/testData/codegen/box/invokedynamic/sam/enhancedNullabilityMix.kt index af1503754b8..6be670f4d51 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/enhancedNullabilityMix.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/enhancedNullabilityMix.kt @@ -1,6 +1,13 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final class EnhancedNullabilityKt\$box\$t1\$1 +// TODO check why EnhancedNullabilityKt\$box\$t1\$1 is not synthetic + // FILE: enhancedNullability.kt fun interface IGetInt { fun get(x: Int): Int diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturedSamArgument.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturedSamArgument.kt index 5577bb6d634..8f7c6e9fe42 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturedSamArgument.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturedSamArgument.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: capturedSamArgument.kt fun box(): String { var lambda = { "OK" } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturingLambda.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturingLambda.kt index 3498c335a9f..e20888ce2aa 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturingLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/capturingLambda.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: capturingLambda.kt fun box(): String { val co = 'O' diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda1.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda1.kt index 96efac5328e..bf435b00aac 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda1.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda1.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: extensionLambda1.kt fun samExtLambda(ext: String.() -> String) = Sam(ext) diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda2.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda2.kt index 0d844f42f48..54155a7ebeb 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda2.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/extensionLambda2.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: extensionLambda2.kt fun samExtLambda(ext: String.(String) -> String) = Sam(ext) diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam1.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam1.kt index 79a9fee256e..925698c8ff1 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam1.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam1.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: genericSam1.kt fun box(): String = Sam { "O" + it }.get("K") diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam2.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam2.kt index 7817b5d6021..7d735e081f9 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam2.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/genericSam2.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: genericSam2.kt fun test(lambda: (FT) -> FR) = Sam(lambda) diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/simple.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/simple.kt index 7c44f655db8..5eed45588d7 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/simple.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionExprToJavaInterface/simple.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: simple.kt val lambda = { "OK" } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithCoercionToUnit.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithCoercionToUnit.kt index 051139d22f3..18424d0718a 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithCoercionToUnit.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithCoercionToUnit.kt @@ -1,6 +1,12 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final synthetic class AdaptedFunRefWithCoercionToUnitKt\$box\$[0-9]+ + // FILE: adaptedFunRefWithCoercionToUnit.kt var ok = "Failed" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithDefaultParameters.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithDefaultParameters.kt index 1dece0518bd..993af3f5d6f 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithDefaultParameters.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithDefaultParameters.kt @@ -1,6 +1,12 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final synthetic class AdaptedFunRefWithDefaultParametersKt\$box\$[0-9]+ + // FILE: adaptedFunRefWithDefaultParameters.kt var ok = "Failed" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithVararg.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithVararg.kt index 6aedd90a58b..aea02d5c3d5 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithVararg.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/adaptedFunRefWithVararg.kt @@ -1,6 +1,12 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final synthetic class AdaptedFunRefWithVarargKt\$box\$[0-9]+ + // FILE: adaptedFunRefWithVararg.kt var ok = "Failed" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundExtFun.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundExtFun.kt index 37b2778d920..cd6fa24db19 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundExtFun.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundExtFun.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: boundExtFun.kt fun String.k(s: String) = this + s + "K" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundInnerConstructorRef.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundInnerConstructorRef.kt index a93ede92537..a7038f482b8 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundInnerConstructorRef.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundInnerConstructorRef.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: boundInnerConstructorRef.kt class Outer(val s1: String) { inner class Inner(val s2: String) { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundLocalExtFun.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundLocalExtFun.kt index d81e9f15824..0b77837ba9e 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundLocalExtFun.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundLocalExtFun.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: boundLocalExtFun.kt fun box(): String { fun String.k(s: String) = this + s + "K" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundMemberRef.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundMemberRef.kt index 09a7ccf3d88..3481fffae1c 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundMemberRef.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundMemberRef.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: boundMemberRef.kt class C(val t: String) { fun test() = t diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperClassMethod.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperClassMethod.kt index 7b8cf582c54..98a4683e571 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperClassMethod.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperClassMethod.kt @@ -4,6 +4,10 @@ // WITH_RUNTIME // FULL_JDK +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 2 java/lang/invoke/LambdaMetafactory + // FILE: boundRefToSuperClassMethod.kt class Impl(val set1: Set, val set2: Set) : JDerived() { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperInterfaceMethod.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperInterfaceMethod.kt index f5122da281d..7e17ede2780 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperInterfaceMethod.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/boundRefToSuperInterfaceMethod.kt @@ -4,6 +4,10 @@ // WITH_RUNTIME // FULL_JDK +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 2 java/lang/invoke/LambdaMetafactory + // FILE: boundRefToSuperInterfaceMethod.kt class Impl(val set1: Set, val set2: Set) : JDerived { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/constructorRef.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/constructorRef.kt index ddb91892162..5423fb729a0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/constructorRef.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/constructorRef.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: constructorRef.kt class C(val t: String) diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/enhancedNullability.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/enhancedNullability.kt index ee4031fb43a..faf9c9713d9 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/enhancedNullability.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/enhancedNullability.kt @@ -2,6 +2,11 @@ // IGNORE_BACKEND_FIR: JVM_IR // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: enhancedNullability.kt fun mul2(x: Int) = x * 2 diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt index 0a9ca2cd817..49e2189bb8c 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: innerConstructorRef.kt class Outer(val s1: String) { inner class Inner(val s2: String) { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt index 12034f04bdc..33a33881527 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: intReturnTypeAsNumber.kt fun box(): String { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/interfaceMemberRef.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/interfaceMemberRef.kt index d8c35b093c9..116f5689c2e 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/interfaceMemberRef.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/interfaceMemberRef.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: interfaceMemberRef.kt interface IFoo { fun foo(): String diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/kt45581.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/kt45581.kt index 191ebba39cc..a67c03bd0a0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/kt45581.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/kt45581.kt @@ -5,6 +5,11 @@ // FULL_JDK // IGNORE_DEXING // ^ D8 fails with AssertionError, possible reason: only Kotlin output files are passed to D8 + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: kt45581.kt fun box(): String = J.bar(emptySet()::contains) diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction1.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction1.kt index 3fa6e721122..56d3f13c60c 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction1.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction1.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: localFunction1.kt fun box(): String { fun ok() = "OK" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction2.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction2.kt index 8555c03b2f9..648d15ea403 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction2.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction2.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: localFunction2.kt fun box(): String { val t = "O" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/memberRef.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/memberRef.kt index fb96f2b3755..40141d6161b 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/memberRef.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/memberRef.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: memberRef.kt class C(val t: String) { fun test() = t diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt index 92bbfbfb287..bd5f4351121 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY // WITH_RUNTIME + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: JavaRunner.java public class JavaRunner { public static void runTwice(Runnable runnable) { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt index d57c0ceb449..7ddb3ac627c 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: nothingReturnTypeAsObject.kt fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt index 0ced755167e..84376f03a67 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: nothingReturnTypeAsString.kt fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt index 36fa4eb8c9c..d08d9eb7a2d 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: nullableNothingReturnTypeAsObject.kt fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt index f45b8ffeb3b..6573e82d351 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: nullableNothingReturnTypeAsString.kt fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt index 161c04b8c87..415e47b8e47 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: simple.kt fun ok() = "OK" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt index 550a82dd70c..cdb72f426a0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt @@ -1,6 +1,12 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final synthetic class VoidReturnTypeAsObjectKt\$box\$r\$[0-9]+ + // FILE: voidReturnTypeAsObject.kt var t = "Failed" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterface.kt b/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterface.kt index cad954025dc..41d0eaefc19 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterface.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterface.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface IFoo { fun foo(x: T): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt b/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt index 1e0089f0b94..8e64cc37833 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 2 java/lang/invoke/LambdaMetafactory + fun interface IFoo { fun foo(x: T): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/genericLambdaSignature.kt b/compiler/testData/codegen/box/invokedynamic/sam/genericLambdaSignature.kt index 15931a8964b..f4c317740f4 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/genericLambdaSignature.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/genericLambdaSignature.kt @@ -5,6 +5,10 @@ // CHECK_BYTECODE_LISTING // WITH_SIGNATURES +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface FunIFace { fun call(arg: T0): R } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineAny.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineAny.kt index b6a56cecbad..ebe1ee9df00 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineAny.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineAny.kt @@ -4,6 +4,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class FunInterfaceWithInlineAnyKt\$box\$t\$1 + inline class Z(val value: Any) fun interface IFooZ { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineInt.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineInt.kt index caa814094ed..a6e2182dbfa 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineInt.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineInt.kt @@ -4,6 +4,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class FunInterfaceWithInlineIntKt\$box\$t\$1 + inline class Z(val value: Int) fun interface IFooZ { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNAny.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNAny.kt index 7d76740d04b..4019bf94d16 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNAny.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNAny.kt @@ -4,6 +4,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class FunInterfaceWithInlineNAnyKt\$box\$t\$1 + inline class Z(val value: Any?) fun interface IFooZ { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNInt.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNInt.kt index 2ad8e8cce29..82dc889f679 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNInt.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNInt.kt @@ -4,6 +4,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class FunInterfaceWithInlineNIntKt\$box\$t\$1 + inline class Z(val value: Int?) fun interface IFooZ { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNString.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNString.kt index 47eae7cd1be..05179f8b1d6 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineNString.kt @@ -4,6 +4,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class FunInterfaceWithInlineNStringKt\$box\$t\$1 + inline class Z(val value: String?) fun interface IFooZ { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineString.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineString.kt index 6f6aa813c4b..30daa92393c 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/funInterfaceWithInlineString.kt @@ -4,6 +4,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class FunInterfaceWithInlineStringKt\$box\$t\$1 + inline class Z(val value: String) fun interface IFooZ { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineAny.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineAny.kt index fd947fd82a5..7a83ff590ea 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineAny.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineAny.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class GenericFunInterfaceWithInlineAnyKt\$box\$t\$1 + inline class Z(val value: Any) fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineInt.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineInt.kt index 09a6bdb34c8..a56852d14fe 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineInt.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineInt.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: Int) fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNAny.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNAny.kt index 1f78a6f08c5..9283bd0dadf 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNAny.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNAny.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: Any?) fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNInt.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNInt.kt index e25d329567e..a67170ffb83 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNInt.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNInt.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: Int?) fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNString.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNString.kt index 2117696068f..b83665661f6 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineNString.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + inline class Z(val value: String?) fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineString.kt b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineString.kt index 972673c3156..507ee372579 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature/genericFunInterfaceWithInlineString.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class GenericFunInterfaceWithInlineStringKt\$box\$t\$1 + inline class Z(val value: String) fun interface IFoo { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt b/compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt index 215988d3e0c..a77db5c506b 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory\.metafactory + fun interface INum { fun get(): Number } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/nullabilityAssertions.kt b/compiler/testData/codegen/box/invokedynamic/sam/nullabilityAssertions.kt index 9effb947012..5447073ef81 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/nullabilityAssertions.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/nullabilityAssertions.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: nullabilityAssertions.kt fun box(): String { try { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/possibleOverrideClash.kt b/compiler/testData/codegen/box/invokedynamic/sam/possibleOverrideClash.kt index 4220b4aa931..4a298217ae0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/possibleOverrideClash.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/possibleOverrideClash.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 2 java/lang/invoke/LambdaMetafactory + fun interface IFoo { fun foo(): String } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/primitiveVsWrapperInSam.kt b/compiler/testData/codegen/box/invokedynamic/sam/primitiveVsWrapperInSam.kt index 99f4aa59527..e96538f8ef2 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/primitiveVsWrapperInSam.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/primitiveVsWrapperInSam.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 4 java/lang/invoke/LambdaMetafactory + // FILE: primitiveVsWrapperInSam.kt var test = 0 diff --git a/compiler/testData/codegen/box/invokedynamic/sam/samConversionInsideSamConvertedLambda.kt b/compiler/testData/codegen/box/invokedynamic/sam/samConversionInsideSamConvertedLambda.kt index 760a18d50aa..1e7bb0962db 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/samConversionInsideSamConvertedLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/samConversionInsideSamConvertedLambda.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 3 java/lang/invoke/LambdaMetafactory + fun interface IFoo { fun foo(k: String): String } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/samConversionOnFunctionReference.kt b/compiler/testData/codegen/box/invokedynamic/sam/samConversionOnFunctionReference.kt index 5f3b249bd09..5bfcf3980e0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/samConversionOnFunctionReference.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/samConversionOnFunctionReference.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/samExtFunWithCapturingLambda.kt b/compiler/testData/codegen/box/invokedynamic/sam/samExtFunWithCapturingLambda.kt index 1f3a26e780b..f08e6282c00 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/samExtFunWithCapturingLambda.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/samExtFunWithCapturingLambda.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface IExtFun { fun String.foo(s: String) : String } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/simpleFunInterfaceConstructor.kt b/compiler/testData/codegen/box/invokedynamic/sam/simpleFunInterfaceConstructor.kt index 3cfb14ea8a4..963350da6da 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/simpleFunInterfaceConstructor.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/simpleFunInterfaceConstructor.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/simpleIndyFunInterface.kt b/compiler/testData/codegen/box/invokedynamic/sam/simpleIndyFunInterface.kt index a6ff2988ea1..12230dde993 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/simpleIndyFunInterface.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/simpleIndyFunInterface.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface KRunnable { fun run() } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/simpleIndySam.kt b/compiler/testData/codegen/box/invokedynamic/sam/simpleIndySam.kt index 0ced7703cc1..1f3f276af12 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/simpleIndySam.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/simpleIndySam.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + // FILE: simpleIndySam.kt var test = "Failed" diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverride.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverride.kt index 8589d7572d6..571b46e4d49 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverride.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverride.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface IFooAny { fun foo(x: Any): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt index c0d925020a0..778e2af4649 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class CovariantOverrideWithNNothingKt\$box\$1 + fun interface IFooNStr { fun foo(x: Any): String? } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt index 8ee40e71c35..3285a7475a5 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface Cmp { fun compare(a: T, b: T): Int } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt index 712f0afbceb..2031633f0b0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt @@ -1,6 +1,11 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface Cmp { fun compare(a: T, b: T): Int } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt index 1ad8a6c7630..48d7bce22f4 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface GenericToAny { fun invoke(x: T): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharDiamond.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharDiamond.kt index 7422e8b3bb5..1083cbc1a1b 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharDiamond.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharDiamond.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class InheritedWithCharDiamondKt\$box\$1 + fun interface GenericToAny { fun invoke(x: T): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharExplicitlyOverridden.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharExplicitlyOverridden.kt index 1e40c61d9c8..ccf1930efd9 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharExplicitlyOverridden.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithCharExplicitlyOverridden.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class InheritedWithCharExplicitlyOverriddenKt\$box\$1 + fun interface GenericToAny { fun invoke(x: T): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithInt.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithInt.kt index 6ecf41feff3..58114a7d7e0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithInt.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithInt.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface GenericToAny { fun invoke(x: T): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithString.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithString.kt index c122aeadce9..f301d28ea18 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithString.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface GenericToAny { fun invoke(x: T): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithUnit.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithUnit.kt index 22d0c781187..fa6dda3386c 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithUnit.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithUnit.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface IFoo { fun foo(): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndIntArray.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndIntArray.kt index 99ff969a98d..e1ef40ce477 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndIntArray.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndIntArray.kt @@ -3,6 +3,10 @@ // SAM_CONVERSIONS: INDY // WITH_RUNTIME +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 2 java/lang/invoke/LambdaMetafactory + fun interface IFooT { fun foo(x: T): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndString.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndString.kt index 21ca535bfc8..381c0a42dcd 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericAndString.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 2 java/lang/invoke/LambdaMetafactory + fun interface IFooT { fun foo(x: T): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericArrayAndArrayOfString.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericArrayAndArrayOfString.kt index 1d05b5df422..70362747f65 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericArrayAndArrayOfString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericArrayAndArrayOfString.kt @@ -3,6 +3,10 @@ // SAM_CONVERSIONS: INDY // WITH_RUNTIME +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 2 java/lang/invoke/LambdaMetafactory + fun interface IFooT { fun foo(x: Array): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixPrimitiveAndBoxed.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixPrimitiveAndBoxed.kt index b1db5015f9a..6c448e357fc 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixPrimitiveAndBoxed.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixPrimitiveAndBoxed.kt @@ -4,6 +4,12 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class MixPrimitiveAndBoxedKt\$box\$f0\$1 +// 1 class MixPrimitiveAndBoxedKt\$box\$f1\$1 + fun interface IFooT { fun foo(x: T): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt index c69addcf1c4..8f60afd70a3 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt @@ -2,6 +2,11 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 class NothingReturnTypeAsGenericKt\$box\$1 + fun interface IFoo { fun foo(): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt index 2c6280d91fc..b4ff2d1eb9f 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface IFoo { fun foo(): String } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt index 3084b7761d5..067848b2bd0 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface GenericToAny { fun invoke(Inner: T): Any } @@ -12,5 +16,3 @@ fun box(): String { foo2('.') { } return "OK" } - - diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt index 7366e524789..20831d7e700 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: CLASS +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory + fun interface GenericToAny { fun invoke(Inner: T): Any } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/voidReturnTypeAsGeneric.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/voidReturnTypeAsGeneric.kt index 73b1e97efd6..00fd306fcd3 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/voidReturnTypeAsGeneric.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/voidReturnTypeAsGeneric.kt @@ -2,6 +2,10 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + fun interface IFoo { fun foo(): T } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/streamApi1.kt b/compiler/testData/codegen/box/invokedynamic/sam/streamApi1.kt index 8e2807d3f4f..57b20b21ffb 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/streamApi1.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/streamApi1.kt @@ -7,6 +7,10 @@ // no stream api on Android // IGNORE_BACKEND: ANDROID +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 1 java/lang/invoke/LambdaMetafactory + import java.util.stream.Collectors fun box(): String { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/streamApi2.kt b/compiler/testData/codegen/box/invokedynamic/sam/streamApi2.kt index 5746bfd079b..e147b98d8a8 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/streamApi2.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/streamApi2.kt @@ -7,6 +7,10 @@ // no stream api on Android // IGNORE_BACKEND: ANDROID +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 4 java/lang/invoke/LambdaMetafactory + import java.util.stream.* fun box(): String { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/suspendFunInterface.kt b/compiler/testData/codegen/box/invokedynamic/sam/suspendFunInterface.kt index 99927451d01..b8b143a2259 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/suspendFunInterface.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/suspendFunInterface.kt @@ -5,14 +5,20 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY // WITH_RUNTIME -// WITH_COROUTINES + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 1 final class SuspendFunInterfaceKt\$box\$1 + import kotlin.coroutines.* var c: Continuation? = null -suspend fun suspendMe() = suspendCoroutine { continuation -> - c = continuation -} +suspend fun suspendMe() = + suspendCoroutine { continuation -> + c = continuation + } fun builder(c: suspend () -> Unit) { c.startCoroutine(object: Continuation { diff --git a/compiler/testData/codegen/box/invokedynamic/sam/unboundFunctionReferenceEquality.kt b/compiler/testData/codegen/box/invokedynamic/sam/unboundFunctionReferenceEquality.kt index 2058123e499..711d5c28fa5 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/unboundFunctionReferenceEquality.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/unboundFunctionReferenceEquality.kt @@ -2,6 +2,15 @@ // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY // WITH_RUNTIME + +// CHECK_BYTECODE_TEXT +// JVM_IR_TEMPLATES +// 0 java/lang/invoke/LambdaMetafactory +// 13 final synthetic class UnboundAdaptedFunctionReferenceKt\$box\$[0-9]+ +// 1 final synthetic class FromOtherFileKt\$target1FromOtherFile\$[0-9]* +// 1 final synthetic class FromOtherFileKt\$adapted1FromOtherFile\$[0-9]* +// 1 final synthetic class FromOtherFileKt\$adapted2FromOtherFile\$[0-9]* + // FILE: unboundAdaptedFunctionReference.kt fun checkEqual(x: Any, y: Any) { if (x != y || y != x) throw AssertionError("$x and $y should be equal") diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/BytecodeTextHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/BytecodeTextHandler.kt index 99e48999447..67b70266ff6 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/BytecodeTextHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/BytecodeTextHandler.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.test.backend.handlers import org.jetbrains.kotlin.codegen.* import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.test.directives.CodegenTestDirectives +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.CHECK_BYTECODE_TEXT import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.TREAT_AS_ONE_FILE import org.jetbrains.kotlin.test.directives.model.DirectivesContainer import org.jetbrains.kotlin.test.model.BinaryArtifacts @@ -17,7 +18,9 @@ import org.jetbrains.kotlin.test.services.TestServices import org.jetbrains.kotlin.test.services.isKtFile import java.util.LinkedHashMap -class BytecodeTextHandler(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) { +class BytecodeTextHandler(testServices: TestServices, private val shouldEnableExplicitly: Boolean = false) : + JvmBinaryArtifactHandler(testServices) { + companion object { private const val IGNORED_PREFIX = "helpers/" } @@ -26,6 +29,8 @@ class BytecodeTextHandler(testServices: TestServices) : JvmBinaryArtifactHandler get() = listOf(CodegenTestDirectives) override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) { + if (shouldEnableExplicitly && CHECK_BYTECODE_TEXT !in module.directives) return + val targetBackend = module.targetBackend!! val isIgnored = targetBackend in module.directives[CodegenTestDirectives.IGNORE_BACKEND] val files = module.files.filter { it.isKtFile } @@ -46,14 +51,20 @@ class BytecodeTextHandler(testServices: TestServices) : JvmBinaryArtifactHandler reportProblems: Boolean ) { val expectedOccurrencesByOutputFile = LinkedHashMap>() + val globalOccurrences = ArrayList() for (file in files) { - readExpectedOccurrencesForMultiFileTest(file.name, file.originalContent, expectedOccurrencesByOutputFile) + readExpectedOccurrencesForMultiFileTest(file.name, file.originalContent, expectedOccurrencesByOutputFile, globalOccurrences) } - val generated = info.classFileFactory.createTextForEachFile() + if (globalOccurrences.isNotEmpty()) { + val generatedText = info.classFileFactory.createText() + checkGeneratedTextAgainstExpectedOccurrences(generatedText, globalOccurrences, targetBackend, reportProblems, assertions) + } + + val generatedByFile = info.classFileFactory.createTextForEachFile() for (expectedOutputFile in expectedOccurrencesByOutputFile.keys) { - assertTextWasGenerated(expectedOutputFile, generated, assertions) - val generatedText = generated[expectedOutputFile]!! + assertTextWasGenerated(expectedOutputFile, generatedByFile, assertions) + val generatedText = generatedByFile[expectedOutputFile]!! val expectedOccurrences = expectedOccurrencesByOutputFile[expectedOutputFile]!! checkGeneratedTextAgainstExpectedOccurrences(generatedText, expectedOccurrences, targetBackend, reportProblems, assertions) } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt index 1af3dad97de..9f5bfe48775 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt @@ -47,6 +47,11 @@ object CodegenTestDirectives : SimpleDirectivesContainer() { """.trimIndent() ) + val CHECK_BYTECODE_TEXT by directive( + description = "Check for particular patterns present in generated bytecode", + applicability = Global + ) + val CHECK_BYTECODE_LISTING by directive( description = "Dump generated classes to .txt or _ir.txt file", applicability = Global diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractBytecodeTextTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractBytecodeTextTest.kt index 898ee7bcaf8..ec6fd084665 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractBytecodeTextTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractBytecodeTextTest.kt @@ -10,11 +10,8 @@ import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade import org.jetbrains.kotlin.test.backend.handlers.BytecodeTextHandler -import org.jetbrains.kotlin.test.backend.handlers.NoCompilationErrorsHandler -import org.jetbrains.kotlin.test.backend.handlers.NoFirCompilationErrorsHandler import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder -import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_REFLECT import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB @@ -44,7 +41,7 @@ abstract class AbstractBytecodeTextTestBase, reportProblems: Boolean) { val expectedOccurrencesByOutputFile = LinkedHashMap>() + val globalOccurrences = ArrayList() for (file in files) { - readExpectedOccurrencesForMultiFileTest(file.name, file.content, expectedOccurrencesByOutputFile) + readExpectedOccurrencesForMultiFileTest(file.name, file.content, expectedOccurrencesByOutputFile, globalOccurrences) + } + + if (globalOccurrences.isNotEmpty()) { + val generatedText = generateToText() + checkGeneratedTextAgainstExpectedOccurrences(generatedText, globalOccurrences, backend, reportProblems, JUnit4Assertions) } val generated = generateEachFileToText()