From e9c9d5731eb700467df54b817eb566db7c034b2c Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Thu, 14 Oct 2021 12:45:38 +0200 Subject: [PATCH] [JVM] Port Stepping and LocalVariable tests to new test infra. This is in preparation for enabling the tests for FIR which will be easier to do when the tests are on the new infrastructure. --- .../debug/localVariables/catchClause.kt | 2 +- .../debug/localVariables/copyFunction.kt | 2 +- .../localVariables/destructuringInFor.kt | 6 +- .../localVariables/destructuringInLambdas.kt | 2 +- .../testData/debug/localVariables/emptyFun.kt | 2 +- .../debug/localVariables/inlineProperty.kt | 2 +- .../debug/localVariables/jvmOverloads.kt | 6 +- .../testData/debug/localVariables/localFun.kt | 19 +- .../debug/localVariables/localFunUnused.kt | 6 +- .../receiverMangling/capturedThisField.kt | 2 +- .../labeledThisParameterLabel.kt | 6 +- .../lambdaWithExtensionReceiver.kt | 2 +- .../receiverMangling/receiverParameter.kt | 2 +- .../localVariables/receiverMangling/simple.kt | 2 +- .../simpleCapturedReceiver.kt | 6 +- .../simpleCapturedReceiverWithLabel.kt | 6 +- .../simpleCapturedReceiverWithParenthesis.kt | 6 +- .../suspend/completion/nonStaticSimple.kt | 16 +- .../completion/nonStaticStateMachine.kt | 24 +- .../suspend/completion/staticSimple.kt | 8 +- .../completion/staticSimpleReceiver.kt | 16 +- .../suspend/completion/staticStateMachine.kt | 22 +- .../completion/staticStateMachineReceiver.kt | 22 +- .../inlineLocalsStateMachineTransform.kt | 13 +- .../suspend/localsStateMachineTransform.kt | 58 ++- .../debug/localVariables/suspend/mergeLvt.kt | 17 +- .../debug/localVariables/suspend/simple.kt | 8 +- .../localVariables/suspend/underscoreNames.kt | 48 +-- .../debug/localVariables/tryFinally.kt | 27 +- .../debug/localVariables/tryFinally10.kt | 40 +- .../debug/localVariables/tryFinally11.kt | 30 +- .../debug/localVariables/tryFinally12.kt | 30 +- .../debug/localVariables/tryFinally13.kt | 26 +- .../debug/localVariables/tryFinally14.kt | 4 +- .../debug/localVariables/tryFinally15.kt | 10 +- .../debug/localVariables/tryFinally16.kt | 23 +- .../debug/localVariables/tryFinally17.kt | 18 +- .../debug/localVariables/tryFinally2.kt | 42 +-- .../debug/localVariables/tryFinally3.kt | 32 +- .../debug/localVariables/tryFinally4.kt | 42 +-- .../debug/localVariables/tryFinally5.kt | 31 +- .../debug/localVariables/tryFinally6.kt | 44 +-- .../debug/localVariables/tryFinally7.kt | 38 +- .../debug/localVariables/tryFinally8.kt | 40 +- .../debug/localVariables/tryFinally9.kt | 46 +-- .../debug/localVariables/underscoreNames.kt | 48 ++- .../debug/stepping/IfTrueThenFalse.kt | 2 +- .../debug/stepping/anonymousFunction.kt | 4 +- .../debug/stepping/anonymousFunctionDirect.kt | 8 +- compiler/testData/debug/stepping/assertion.kt | 2 +- .../debug/stepping/beforeGotoToWhileStart.kt | 2 +- .../debug/stepping/callWithCallInArguments.kt | 2 +- .../debug/stepping/callWithReceiver.kt | 2 +- .../debug/stepping/callableReference.kt | 2 +- compiler/testData/debug/stepping/chainCall.kt | 2 +- compiler/testData/debug/stepping/class.kt | 6 +- .../testData/debug/stepping/classObject.kt | 2 +- .../debug/stepping/compileTimeConstant.kt | 2 +- .../testData/debug/stepping/conjunction.kt | 2 +- .../debug/stepping/constantConditions.kt | 6 +- .../debug/stepping/constructorCall.kt | 2 +- .../testData/debug/stepping/constructors.kt | 62 ++-- compiler/testData/debug/stepping/dataClass.kt | 2 +- .../debug/stepping/defaultParameter.kt | 2 +- compiler/testData/debug/stepping/enum.kt | 10 +- compiler/testData/debug/stepping/for.kt | 2 +- .../debug/stepping/functionCallWithDefault.kt | 2 +- .../functionCallWithInlinedLambdaParam.kt | 2 +- .../stepping/functionCallWithLambdaParam.kt | 2 +- .../debug/stepping/functionInAnotherFile.kt | 18 +- compiler/testData/debug/stepping/if.kt | 2 +- compiler/testData/debug/stepping/if2.kt | 2 +- compiler/testData/debug/stepping/ifThen.kt | 2 +- .../testData/debug/stepping/ifThenElse.kt | 2 +- .../debug/stepping/ifThenElseFalse.kt | 2 +- .../debug/stepping/ifWithInlineInCondition.kt | 2 +- .../testData/debug/stepping/iincStepping.kt | 20 +- .../inTheEndOfLambdaArgumentOfInlineCall.kt | 2 +- .../testData/debug/stepping/initBlocks.kt | 18 +- .../debug/stepping/initBlocksCompanion.kt | 2 +- .../debug/stepping/inlineCallableReference.kt | 2 +- .../stepping/inlineNamedCallableReference.kt | 2 +- .../debug/stepping/inlineSimpleCall.kt | 2 +- compiler/testData/debug/stepping/kt42208.kt | 14 +- compiler/testData/debug/stepping/kt42208b.kt | 16 +- compiler/testData/debug/stepping/kt42208c.kt | 36 +- .../debug/stepping/lambdaStepInline.kt | 2 +- .../stepping/lambdaStepInlineWithDefaults.kt | 2 +- .../debug/stepping/lineNumberAfterInline.kt | 2 +- .../linenumberForOneParametersArgumentCall.kt | 2 +- .../testData/debug/stepping/localFunction.kt | 12 +- .../localFunctionWIthOnelineExpressionBody.kt | 12 +- .../debug/stepping/multilineExpression.kt | 6 +- .../debug/stepping/multilineFunctionCall.kt | 2 +- .../debug/stepping/multilineInfixCall.kt | 2 +- .../debug/stepping/namedCallableReference.kt | 6 +- .../testData/debug/stepping/nestedInline.kt | 20 +- .../noParametersArgumentCallInExpression.kt | 2 +- .../debug/stepping/primitiveNullChecks.kt | 2 +- .../debug/stepping/propertyAccessor.kt | 2 +- compiler/testData/debug/stepping/psvm.kt | 2 +- compiler/testData/debug/stepping/recursion.kt | 2 +- .../debug/stepping/simpleDefaultArg.kt | 2 +- .../stepping/simpleDefaultArgWithInline.kt | 2 +- .../debug/stepping/simpleInlineDefaultArg.kt | 6 +- .../testData/debug/stepping/simpleSmap.kt | 2 +- .../debug/stepping/smapInlineAsArgument.kt | 2 +- .../stepping/smapInlineAsInfixArgument.kt | 2 +- .../stepping/smapInlineAsInlineArgument.kt | 2 +- .../stepping/smapInlineInIntrinsicArgument.kt | 8 +- .../testData/debug/stepping/stringSwitches.kt | 30 +- .../debug/stepping/stringSwitchesSmall.kt | 22 +- .../stepping/suspendFunWithLambdaParameter.kt | 4 +- .../suspendFunWithSuspendLambdaParameter.kt | 18 +- .../testData/debug/stepping/throwException.kt | 2 +- compiler/testData/debug/stepping/topLevel.kt | 2 +- compiler/testData/debug/stepping/trait.kt | 2 +- compiler/testData/debug/stepping/tryCatch.kt | 2 +- .../debug/stepping/tryCatchExpression.kt | 2 +- .../debug/stepping/tryCatchFinally.kt | 2 +- .../testData/debug/stepping/tryFinally.kt | 10 +- .../stepping/variablesWithoutInitializer.kt | 6 +- .../debug/stepping/voidLambdaStepInline.kt | 2 +- compiler/testData/debug/stepping/when.kt | 50 +-- .../debug/stepping/whenComplicatedSubject.kt | 10 +- .../testData/debug/stepping/whenConstant.kt | 6 +- .../testData/debug/stepping/whenIsChecks.kt | 2 +- .../testData/debug/stepping/whenMultiLine.kt | 26 +- .../debug/stepping/whenMultiLineSubject.kt | 2 +- .../debug/stepping/whenNullalbeSubject.kt | 2 +- .../testData/debug/stepping/whenSubject.kt | 2 +- .../testData/debug/stepping/whenSubject2.kt | 58 +-- .../stepping/whenWithInlineInCondition.kt | 14 +- compiler/testData/debug/stepping/while.kt | 2 +- compiler/tests-common-new/build.gradle.kts | 3 +- .../IrLocalVariableTestGenerated.java | 39 +- .../codegen}/IrSteppingTestGenerated.java | 15 +- .../codegen}/LocalVariableTestGenerated.java | 39 +- .../codegen}/SteppingTestGenerated.java | 15 +- .../test/backend/handlers/DebugRunner.kt | 349 ++++++++++++++++++ .../test/backend/handlers/JvmBoxRunner.kt | 31 +- .../codegen/AbstractLocalVariableTest.kt | 58 +++ .../codegen/AbstractLocalVariableTestBase.kt | 39 ++ .../runners/codegen/AbstractSteppingTest.kt | 58 +++ .../codegen/AbstractSteppingTestBase.kt | 39 ++ .../codegen/BaseCodegenConfiguration.kt | 71 +++- ...nFunctionForBlackBoxTestsSourceProvider.kt | 33 +- ...MainFunctionForDebugTestsSourceProvider.kt | 24 ++ .../debugInformation/AbstractDebugTest.kt | 305 --------------- .../AbstractIrLocalVariableTest.kt | 13 - .../AbstractIrSteppingTest.kt | 13 - .../AbstractLocalVariableTest.kt | 150 -------- .../debugInformation/AbstractSteppingTest.kt | 103 ------ .../generators/GenerateJUnit3CompilerTests.kt | 20 - .../generators/GenerateJUnit5CompilerTests.kt | 16 + 155 files changed, 1468 insertions(+), 1523 deletions(-) rename compiler/{tests-gen/org/jetbrains/kotlin/codegen/debugInformation => tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen}/IrLocalVariableTestGenerated.java (89%) rename compiler/{tests-gen/org/jetbrains/kotlin/codegen/debugInformation => tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen}/IrSteppingTestGenerated.java (97%) rename compiler/{tests-gen/org/jetbrains/kotlin/codegen/debugInformation => tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen}/LocalVariableTestGenerated.java (89%) rename compiler/{tests-gen/org/jetbrains/kotlin/codegen/debugInformation => tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen}/SteppingTestGenerated.java (97%) create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/DebugRunner.kt create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTest.kt create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTestBase.kt create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTest.kt create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTestBase.kt create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForDebugTestsSourceProvider.kt delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrLocalVariableTest.kt delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrSteppingTest.kt delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractLocalVariableTest.kt delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractSteppingTest.kt diff --git a/compiler/testData/debug/localVariables/catchClause.kt b/compiler/testData/debug/localVariables/catchClause.kt index d3e93aff10a..7cc48c75d4e 100644 --- a/compiler/testData/debug/localVariables/catchClause.kt +++ b/compiler/testData/debug/localVariables/catchClause.kt @@ -9,7 +9,7 @@ fun box() { } } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:3 box: // test.kt:4 box: // test.kt:5 box: a:int=1:int diff --git a/compiler/testData/debug/localVariables/copyFunction.kt b/compiler/testData/debug/localVariables/copyFunction.kt index a87960d3b5f..5c1a9e473c4 100644 --- a/compiler/testData/debug/localVariables/copyFunction.kt +++ b/compiler/testData/debug/localVariables/copyFunction.kt @@ -7,7 +7,7 @@ fun box() { val b = a.copy(b = 3.0) } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:6 box: // test.kt:3 : a:double=1.0:double, b:double=2.0:double // test.kt:6 box: diff --git a/compiler/testData/debug/localVariables/destructuringInFor.kt b/compiler/testData/debug/localVariables/destructuringInFor.kt index 82e63627456..0bb3fb2998c 100644 --- a/compiler/testData/debug/localVariables/destructuringInFor.kt +++ b/compiler/testData/debug/localVariables/destructuringInFor.kt @@ -1,4 +1,4 @@ - +// WITH_RUNTIME //FILE: test.kt fun box() { @@ -8,9 +8,9 @@ fun box() { } } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:5 box: // test.kt:6 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:7 box: map:java.util.Map=java.util.Collections$SingletonMap, a:java.lang.String="1":java.lang.String, b:java.lang.String="23":java.lang.String // test.kt:6 box: map:java.util.Map=java.util.Collections$SingletonMap -// test.kt:9 box: map:java.util.Map=java.util.Collections$SingletonMap \ No newline at end of file +// test.kt:9 box: map:java.util.Map=java.util.Collections$SingletonMap diff --git a/compiler/testData/debug/localVariables/destructuringInLambdas.kt b/compiler/testData/debug/localVariables/destructuringInLambdas.kt index 3436e806768..5f16e679c54 100644 --- a/compiler/testData/debug/localVariables/destructuringInLambdas.kt +++ b/compiler/testData/debug/localVariables/destructuringInLambdas.kt @@ -8,7 +8,7 @@ fun box() { foo(A("O", 123)) { (x, y) -> x + y } } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:8 box: // test.kt:3 : x:java.lang.String="O":java.lang.String, y:int=123:int // test.kt:8 box: diff --git a/compiler/testData/debug/localVariables/emptyFun.kt b/compiler/testData/debug/localVariables/emptyFun.kt index 96113cacffa..4598ff15b82 100644 --- a/compiler/testData/debug/localVariables/emptyFun.kt +++ b/compiler/testData/debug/localVariables/emptyFun.kt @@ -7,7 +7,7 @@ fun box() { foo() } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:7 box: // test.kt:4 foo: // test.kt:8 box: \ No newline at end of file diff --git a/compiler/testData/debug/localVariables/inlineProperty.kt b/compiler/testData/debug/localVariables/inlineProperty.kt index bed55267726..79754832a83 100644 --- a/compiler/testData/debug/localVariables/inlineProperty.kt +++ b/compiler/testData/debug/localVariables/inlineProperty.kt @@ -10,7 +10,7 @@ fun box() { y++ } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:8 box: // test.kt:2 : // test.kt:8 box: diff --git a/compiler/testData/debug/localVariables/jvmOverloads.kt b/compiler/testData/debug/localVariables/jvmOverloads.kt index 0bfa6de8ed8..3ddbe92b943 100644 --- a/compiler/testData/debug/localVariables/jvmOverloads.kt +++ b/compiler/testData/debug/localVariables/jvmOverloads.kt @@ -1,5 +1,5 @@ -// FILE: test.kt // WITH_RUNTIME +// FILE: test.kt class C { @kotlin.jvm.JvmOverloads fun foo(firstParam: Int, secondParam: String = "") { } @@ -9,9 +9,9 @@ fun box() { C().foo(4) } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:9 box: // test.kt:3 : // test.kt:9 box: // test.kt:5 foo: firstParam:int=4:int, secondParam:java.lang.String="":java.lang.String -// test.kt:10 box: \ No newline at end of file +// test.kt:10 box: diff --git a/compiler/testData/debug/localVariables/localFun.kt b/compiler/testData/debug/localVariables/localFun.kt index 12816a47206..4309c736694 100644 --- a/compiler/testData/debug/localVariables/localFun.kt +++ b/compiler/testData/debug/localVariables/localFun.kt @@ -27,28 +27,27 @@ fun box() { // variables local to the function, and hence need no name mangling to // properly figure in the debugger. -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:13 box: // test.kt:5 foo: -// LOCAL VARIABLES JVM +// EXPECTATIONS JVM // test.kt:6 foo: x:int=1:int - -// LOCAL VARIABLES JVM // test.kt:9 foo: x:int=1:int, $fun$bar$1:TestKt$foo$1=TestKt$foo$1 -// LOCAL VARIABLES JVM_IR + +// EXPECTATIONS JVM_IR // test.kt:9 foo: x:int=1:int -// LOCAL VARIABLES JVM +// EXPECTATIONS JVM // test.kt:7 invoke: // test.kt:8 invoke: y:int=1:int -// LOCAL VARIABLES JVM_IR +// EXPECTATIONS JVM_IR // test.kt:7 foo$bar: x:int=1:int // test.kt:8 foo$bar: x:int=1:int, y:int=1:int -// LOCAL VARIABLES JVM +// EXPECTATIONS JVM // test.kt:10 foo: x:int=1:int, $fun$bar$1:TestKt$foo$1=TestKt$foo$1 // test.kt:14 box: -// LOCAL VARIABLES JVM_IR +// EXPECTATIONS JVM_IR // test.kt:10 foo: x:int=1:int -// test.kt:14 box: \ No newline at end of file +// test.kt:14 box: diff --git a/compiler/testData/debug/localVariables/localFunUnused.kt b/compiler/testData/debug/localVariables/localFunUnused.kt index 594a4695a32..7a9ecc4e852 100644 --- a/compiler/testData/debug/localVariables/localFunUnused.kt +++ b/compiler/testData/debug/localVariables/localFunUnused.kt @@ -18,14 +18,14 @@ fun box() { // - the _declaration_ of the local function does not figure in the byte code // of the outer function and hence, has no line number -// LOCAL VARIABLES -// LOCAL VARIABLES JVM +// EXPECTATIONS +// EXPECTATIONS JVM // test.kt:10 box: // test.kt:5 foo: // test.kt:7 foo: $fun$bar$1:TestKt$foo$1=TestKt$foo$1 // test.kt:11 box: -// LOCAL VARIABLES JVM_IR +// EXPECTATIONS JVM_IR // test.kt:10 box: // test.kt:7 foo: // test.kt:11 box: \ No newline at end of file diff --git a/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt b/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt index 4dd7c6e5df2..a518eb2ce27 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt @@ -11,7 +11,7 @@ fun box() { x.Bar() } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:10 box: // test.kt:4 : // test.kt:10 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt b/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt index 00023618456..9faf915225d 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt @@ -6,14 +6,14 @@ fun blockFun(blockArg: String.() -> Unit) = fun box() { blockFun { - println(this) + this } } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 -// test.kt:11 box: \ No newline at end of file +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt b/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt index 43b04b00f66..08b89b73409 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt @@ -10,7 +10,7 @@ fun box() { } } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:8 box: // test.kt:4 foo: block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$foo:long=1:long diff --git a/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt b/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt index 951d95a57f2..4def4eeec36 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt @@ -7,7 +7,7 @@ fun box() { "OK".test() } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:7 box: // test.kt:4 test: $this$test:java.lang.String="OK":java.lang.String // test.kt:8 box: \ No newline at end of file diff --git a/compiler/testData/debug/localVariables/receiverMangling/simple.kt b/compiler/testData/debug/localVariables/receiverMangling/simple.kt index bf01739bc59..72bf99e79e8 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simple.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simple.kt @@ -7,7 +7,7 @@ fun box() { "OK".foo(42) } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:7 box: // test.kt:4 foo: $this$foo:java.lang.String="OK":java.lang.String, a:int=42:int // test.kt:8 box: \ No newline at end of file diff --git a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt index 00023618456..9faf915225d 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt @@ -6,14 +6,14 @@ fun blockFun(blockArg: String.() -> Unit) = fun box() { blockFun { - println(this) + this } } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 -// test.kt:11 box: \ No newline at end of file +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt index 30f489b6375..8ebe70b39bb 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt @@ -6,14 +6,14 @@ fun blockFun(blockArg: String.() -> Unit) = fun box() { blockFun label@{ - println(this) + this } } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$label:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$label:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 -// test.kt:11 box: \ No newline at end of file +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt index b955fc00b56..1c82b191191 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt @@ -6,14 +6,14 @@ fun blockFun(blockArg: String.() -> Unit) = fun box() { blockFun ({ - println(this) + this }) } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 -// test.kt:11 box: \ No newline at end of file +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt b/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt index 6e62ee0f772..f444b63e8e7 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt @@ -1,5 +1,5 @@ - -// WITH_COROUTINES +// Code generation problem with JVM backend. +// IGNORE_BACKEND: JVM // FILE: test.kt class A { suspend fun foo() {} @@ -9,10 +9,10 @@ suspend fun box() { A().foo() } -// LOCAL VARIABLES -// test.kt:9 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// EXPECTATIONS +// test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : -// test.kt:9 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:5 foo: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:9 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:10 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation \ No newline at end of file +// test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:5 foo: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:10 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 diff --git a/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt b/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt index 9b4c26f5fa7..7f4d629b661 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt @@ -1,5 +1,5 @@ - -// WITH_COROUTINES +// Code generation problem with JVM backend. +// IGNORE_BACKEND: JVM // FILE: test.kt class A { suspend fun foo() {} @@ -14,20 +14,10 @@ suspend fun box() { A().foo1(42) } -// The lambda object constructor has a local variables table on the IR backend. - -// LOCAL VARIABLES -// test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// EXPECTATIONS +// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : -// test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:6 foo1: - -// LOCAL VARIABLES JVM -// test.kt:-1 : -// LOCAL VARIABLES JVM_IR -// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES +// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:6 foo1: // test.kt:7 foo1: $continuation:kotlin.coroutines.Continuation=A$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:5 foo: $completion:kotlin.coroutines.Continuation=A$foo1$1 @@ -37,5 +27,5 @@ suspend fun box() { // test.kt:8 foo1: $continuation:kotlin.coroutines.Continuation=A$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:9 foo1: $continuation:kotlin.coroutines.Continuation=A$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:10 foo1: $continuation:kotlin.coroutines.Continuation=A$foo1$1, $result:java.lang.Object=null, l:long=42:long -// test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:15 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:15 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt b/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt index 0418c042856..19531a27f06 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt @@ -1,8 +1,8 @@ - -// WITH_COROUTINES +// Code generation problem with JVM backend. +// IGNORE_BACKEND: JVM // FILE: test.kt suspend fun box() {} -// LOCAL VARIABLES -// test.kt:4 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation \ No newline at end of file +// EXPECTATIONS +// test.kt:4 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt b/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt index 07fd19a09be..25b548f8d36 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt @@ -1,5 +1,5 @@ - -// WITH_COROUTINES +// Code generation problem with JVM backend. +// IGNORE_BACKEND: JVM // FILE: test.kt class A @@ -10,10 +10,10 @@ suspend fun box() { } -// LOCAL VARIABLES -// test.kt:9 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// EXPECTATIONS +// test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : -// test.kt:9 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:6 foo: $this$foo:A=A, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:9 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:10 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation \ No newline at end of file +// test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:6 foo: $this$foo:A=A, $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:10 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt index 4620d3efd81..7cf09ba685e 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt @@ -1,5 +1,5 @@ - -// WITH_COROUTINES +// Code generation problem with JVM backend. +// IGNORE_BACKEND: JVM // FILE: test.kt suspend fun foo() {} suspend fun foo1(l: Long) { @@ -12,18 +12,8 @@ suspend fun box() { foo1(42) } -// The lambda object constructor has a local variables table on the IR backend. - -// LOCAL VARIABLES -// test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:5 foo1: - -// LOCAL VARIABLES JVM -// test.kt:-1 : -// LOCAL VARIABLES JVM_IR -// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES +// EXPECTATIONS +// test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:5 foo1: // test.kt:6 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:4 foo: $completion:kotlin.coroutines.Continuation=TestKt$foo1$1 @@ -33,5 +23,5 @@ suspend fun box() { // test.kt:7 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:8 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:9 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long -// test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:13 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:13 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt index 14f8129e98d..039e6c85554 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt @@ -1,5 +1,5 @@ - -// WITH_COROUTINES +// Code generation problem with JVM backend. +// IGNORE_BACKEND: JVM // FILE: test.kt class A @@ -16,18 +16,10 @@ suspend fun box() { // The lambda object constructor has a local variables table on the IR backend. -// LOCAL VARIABLES -// test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// EXPECTATIONS +// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : -// test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:7 foo1: - -// LOCAL VARIABLES JVM -// test.kt:-1 : -// LOCAL VARIABLES JVM_IR -// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES +// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:7 foo1: // test.kt:8 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, $this$foo1:A=A, l:long=42:long // test.kt:6 foo: $this$foo:A=A, $completion:kotlin.coroutines.Continuation=TestKt$foo1$1 @@ -37,5 +29,5 @@ suspend fun box() { // test.kt:9 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:10 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:11 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long -// test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:15 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:15 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 diff --git a/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt index eeb92a97a7f..96e4d59c59e 100644 --- a/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt +++ b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt @@ -1,4 +1,4 @@ -// WITH_COROUTINES +// WITH_RUNTIME // FILE: test.kt inline fun hasLocal(): Int { val x = 41 @@ -18,16 +18,7 @@ suspend fun box() { hasLocal() } -// LOCAL VARIABLES -// test.kt:10 box: - -// LOCAL VARIABLES JVM_IR -// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES JVM -// test.kt:-1 : - -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:10 box: // test.kt:12 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:8 h: $completion:kotlin.coroutines.Continuation=TestKt$box$1 diff --git a/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt index c29155d9f0a..277a2560fa7 100644 --- a/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt +++ b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt @@ -1,4 +1,7 @@ -// WITH_COROUTINES +// The JVM backend does not have `x` visible in the locals table for the for loop at all. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME + // FILE: test.kt suspend fun h() { } @@ -17,33 +20,28 @@ suspend fun box() { } } -// The current backend does not have `x` visible in the locals table for the for loop at all. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:7 box: -// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:7 box: -// test.kt:9 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null -// test.kt:3 h: $completion:kotlin.coroutines.Continuation=TestKt$box$1 -// test.kt:9 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null -// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null -// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int -// test.kt:5 f: x:int=0:int -// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int -// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int -// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:5 f: x:int=1:int -// test.kt:11 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:10 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null -// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null -// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int -// test.kt:5 f: x:int=0:int -// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int -// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int -// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:5 f: x:int=1:int -// test.kt:16 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int -// test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// EXPECTATIONS +// test.kt:10 box: +// test.kt:12 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:6 h: $completion:kotlin.coroutines.Continuation=TestKt$box$1 +// test.kt:12 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:13 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:8 f: x:int=0:int +// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:13 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:8 f: x:int=1:int +// test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:13 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:17 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null +// test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:8 f: x:int=0:int +// test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=0:int +// test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:8 f: x:int=1:int +// test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int +// test.kt:21 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null diff --git a/compiler/testData/debug/localVariables/suspend/mergeLvt.kt b/compiler/testData/debug/localVariables/suspend/mergeLvt.kt index de09eb50226..4a0e4caf66e 100644 --- a/compiler/testData/debug/localVariables/suspend/mergeLvt.kt +++ b/compiler/testData/debug/localVariables/suspend/mergeLvt.kt @@ -1,4 +1,4 @@ -// WITH_COROUTINES +// WITH_RUNTIME // FILE: test.kt import kotlin.coroutines.intrinsics.* @@ -26,23 +26,14 @@ suspend fun box() { val a = suspendBar() } -// LOCAL VARIABLES -// test.kt:25 box: - -// LOCAL VARIABLES JVM_IR -// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES JVM -// test.kt:-1 : - -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:25 box: // test.kt:26 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int -// LOCAL VARIABLES JVM +// EXPECTATIONS JVM // test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int // test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int, $this$extensionFun$iv$iv:AtomicInt=AtomicInt, $i$f$extensionFun:int=0:int -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int, $this$extensionFun$iv$iv:AtomicInt=AtomicInt, $i$f$extensionFun:int=0:int // test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int, $this$extensionFun$iv$iv:AtomicInt=AtomicInt, $i$f$extensionFun:int=0:int // test.kt:6 getValue: diff --git a/compiler/testData/debug/localVariables/suspend/simple.kt b/compiler/testData/debug/localVariables/suspend/simple.kt index 56f5657c19b..d8b234d6398 100644 --- a/compiler/testData/debug/localVariables/suspend/simple.kt +++ b/compiler/testData/debug/localVariables/suspend/simple.kt @@ -1,10 +1,10 @@ -// WITH_COROUTINES +// WITH_RUNTIME // FILE: test.kt suspend fun box() { var x = 1 } -// LOCAL VARIABLES -// test.kt:5 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:6 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation, x:int=1:int \ No newline at end of file +// EXPECTATIONS +// test.kt:5 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:6 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1, x:int=1:int diff --git a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt index 87d41e12227..69dd35fd49c 100644 --- a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt @@ -1,5 +1,5 @@ // WITH_RUNTIME -// WITH_COROUTINES + // FILE: test.kt class A { operator fun component1() = "O" @@ -13,46 +13,28 @@ suspend fun box() = foo(A()) { (x_param, _, y_param) -> x_param + y_param } -// TODO: The backends disagree on the local variables in invoke/invokeSuspend methods - - -// LOCAL VARIABLES -// test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// EXPECTATIONS +// test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : -// test.kt:12 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES JVM -// test.kt:-1 : -// test.kt:-1 create: value:java.lang.Object=A, completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:-1 invoke: - -// LOCAL VARIABLES JVM_IR -// test.kt:-1 : $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:-1 create: value:java.lang.Object=A, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES -// test.kt:12 invokeSuspend: +// test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:5 component1: // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A // test.kt:7 component3: -// LOCAL VARIABLES JVM +// EXPECTATIONS JVM_IR +// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A, x_param:java.lang.String="O":java.lang.String +// EXPECTATIONS JVM // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A -// LOCAL VARIABLES JVM_IR -// test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A, x_param:java.lang.String="O":java.lang.String - -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:13 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A, x_param:java.lang.String="O":java.lang.String, y_param:java.lang.String="K":java.lang.String -// LOCAL VARIABLES JVM +// EXPECTATIONS JVM_IR +// test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// EXPECTATIONS JVM // test.kt:-1 invoke: -// LOCAL VARIABLES JVM_IR -// test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=helpers.ResultContinuation - -// LOCAL VARIABLES -// test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation -// test.kt:14 box: $completion:kotlin.coroutines.Continuation=helpers.ResultContinuation +// EXPECTATIONS +// test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 +// test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 diff --git a/compiler/testData/debug/localVariables/tryFinally.kt b/compiler/testData/debug/localVariables/tryFinally.kt index eda08436d14..3bd926210ed 100644 --- a/compiler/testData/debug/localVariables/tryFinally.kt +++ b/compiler/testData/debug/localVariables/tryFinally.kt @@ -1,3 +1,7 @@ +// The old backend has the local y covering the finally block as well. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME + // FILE: test.kt fun box() { var result = "" @@ -14,16 +18,13 @@ fun box() { } } -// The old backend has the local y covering the finally block as well. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:3 box: -// test.kt:4 box: result:java.lang.String="":java.lang.String -// test.kt:5 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:6 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:7 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:8 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:11 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:12 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, z:java.lang.String="z":java.lang.String -// test.kt:15 box: result:java.lang.String="yz":java.lang.String +// EXPECTATIONS +// test.kt:7 box: +// test.kt:8 box: result:java.lang.String="":java.lang.String +// test.kt:9 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:10 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:11 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:12 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:15 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:16 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, z:java.lang.String="z":java.lang.String +// test.kt:19 box: result:java.lang.String="yz":java.lang.String diff --git a/compiler/testData/debug/localVariables/tryFinally10.kt b/compiler/testData/debug/localVariables/tryFinally10.kt index 17b462d3d2b..161039b3f38 100644 --- a/compiler/testData/debug/localVariables/tryFinally10.kt +++ b/compiler/testData/debug/localVariables/tryFinally10.kt @@ -1,3 +1,6 @@ +// The local variables `y` and `i` are visible in the finally block with old backend. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt inline fun f(block: () -> Unit) { @@ -33,23 +36,20 @@ fun box() { val localX = x } -// The local variables `y` and `i` are visible in the finally block with old backend. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:32 box: -// test.kt:17 compute: -// test.kt:18 compute: -// test.kt:19 compute: y:int=42:int -// test.kt:20 compute: y:int=42:int, i:int=0:int -// test.kt:4 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int -// test.kt:5 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int -// test.kt:6 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int -// test.kt:7 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int, j$iv:int=0:int -// test.kt:10 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int -// test.kt:21 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, $i$a$-f-TestKt$compute$1:int=0:int -// test.kt:25 compute: -// test.kt:26 compute: s2:java.lang.String="OK":java.lang.String -// test.kt:32 box: -// test.kt:33 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String -// test.kt:34 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String +// EXPECTATIONS +// test.kt:35 box: +// test.kt:20 compute: +// test.kt:21 compute: +// test.kt:22 compute: y:int=42:int +// test.kt:23 compute: y:int=42:int, i:int=0:int +// test.kt:7 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int +// test.kt:8 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int +// test.kt:9 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int +// test.kt:10 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int, j$iv:int=0:int +// test.kt:13 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int +// test.kt:24 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, $i$a$-f-TestKt$compute$1:int=0:int +// test.kt:28 compute: +// test.kt:29 compute: s2:java.lang.String="OK":java.lang.String +// test.kt:35 box: +// test.kt:36 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String +// test.kt:37 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String diff --git a/compiler/testData/debug/localVariables/tryFinally11.kt b/compiler/testData/debug/localVariables/tryFinally11.kt index 4fd36cc4286..319ad6ac98a 100644 --- a/compiler/testData/debug/localVariables/tryFinally11.kt +++ b/compiler/testData/debug/localVariables/tryFinally11.kt @@ -1,3 +1,6 @@ +// The local variables `z` and `y` are visible in the finally block with old backend. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt fun box(): String { @@ -20,19 +23,16 @@ fun box(): String { return "FAIL" } -// The local variables `z` and `y` are visible in the finally block with old backend. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:4 box: -// test.kt:5 box: -// test.kt:6 box: i:int=0:int -// test.kt:7 box: i:int=0:int -// test.kt:8 box: i:int=0:int, x:java.lang.String="x":java.lang.String +// EXPECTATIONS +// test.kt:7 box: +// test.kt:8 box: // test.kt:9 box: i:int=0:int -// test.kt:10 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException -// test.kt:11 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String -// test.kt:12 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String, z:java.lang.String="z":java.lang.String -// test.kt:14 box: i:int=0:int -// test.kt:17 box: -// test.kt:18 box: +// test.kt:10 box: i:int=0:int +// test.kt:11 box: i:int=0:int, x:java.lang.String="x":java.lang.String +// test.kt:12 box: i:int=0:int +// test.kt:13 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException +// test.kt:14 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String +// test.kt:15 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String, z:java.lang.String="z":java.lang.String +// test.kt:17 box: i:int=0:int +// test.kt:20 box: +// test.kt:21 box: diff --git a/compiler/testData/debug/localVariables/tryFinally12.kt b/compiler/testData/debug/localVariables/tryFinally12.kt index f17db5026ca..e3869f225f1 100644 --- a/compiler/testData/debug/localVariables/tryFinally12.kt +++ b/compiler/testData/debug/localVariables/tryFinally12.kt @@ -1,3 +1,6 @@ +// The local variables `z` and `y` are visible in the finally block with old backend. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt fun box(): String { @@ -20,19 +23,16 @@ fun box(): String { return "FAIL" } -// The local variables `z` and `y` are visible in the finally block with old backend. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:4 box: -// test.kt:5 box: -// test.kt:6 box: i:int=0:int -// test.kt:7 box: i:int=0:int -// test.kt:8 box: i:int=0:int, x:java.lang.String="x":java.lang.String +// EXPECTATIONS +// test.kt:7 box: +// test.kt:8 box: // test.kt:9 box: i:int=0:int -// test.kt:10 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException -// test.kt:11 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String -// test.kt:12 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String, z:java.lang.String="z":java.lang.String -// test.kt:14 box: i:int=0:int -// test.kt:17 box: -// test.kt:18 box: +// test.kt:10 box: i:int=0:int +// test.kt:11 box: i:int=0:int, x:java.lang.String="x":java.lang.String +// test.kt:12 box: i:int=0:int +// test.kt:13 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException +// test.kt:14 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String +// test.kt:15 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String, z:java.lang.String="z":java.lang.String +// test.kt:17 box: i:int=0:int +// test.kt:20 box: +// test.kt:21 box: diff --git a/compiler/testData/debug/localVariables/tryFinally13.kt b/compiler/testData/debug/localVariables/tryFinally13.kt index 91e0a46ada9..5eb2d0f0e55 100644 --- a/compiler/testData/debug/localVariables/tryFinally13.kt +++ b/compiler/testData/debug/localVariables/tryFinally13.kt @@ -1,3 +1,6 @@ +// The local variables `y` and `i` are visible in finally blocks with old backend. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt fun box(): String { @@ -19,17 +22,14 @@ fun box(): String { return "FAIL3" } -// The local variables `y` and `i` are visible in finally blocks with old backend. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:4 box: -// test.kt:5 box: -// test.kt:6 box: i:int=0:int -// test.kt:7 box: i:int=0:int -// test.kt:8 box: i:int=0:int, x:java.lang.String="x":java.lang.String +// EXPECTATIONS +// test.kt:7 box: +// test.kt:8 box: // test.kt:9 box: i:int=0:int -// test.kt:10 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException -// test.kt:11 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String -// test.kt:13 box: i:int=0:int -// test.kt:17 box: +// test.kt:10 box: i:int=0:int +// test.kt:11 box: i:int=0:int, x:java.lang.String="x":java.lang.String +// test.kt:12 box: i:int=0:int +// test.kt:13 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException +// test.kt:14 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String +// test.kt:16 box: i:int=0:int +// test.kt:20 box: diff --git a/compiler/testData/debug/localVariables/tryFinally14.kt b/compiler/testData/debug/localVariables/tryFinally14.kt index 06680871fc3..ad479bc9975 100644 --- a/compiler/testData/debug/localVariables/tryFinally14.kt +++ b/compiler/testData/debug/localVariables/tryFinally14.kt @@ -1,5 +1,5 @@ +// WITH_RUNTIME // FILE: test.kt - fun box(): String { try { for (i in 0 until 1) { @@ -16,7 +16,7 @@ fun box(): String { return "FAIL" } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:4 box: // test.kt:5 box: // test.kt:6 box: i:int=0:int diff --git a/compiler/testData/debug/localVariables/tryFinally15.kt b/compiler/testData/debug/localVariables/tryFinally15.kt index 5026c02938a..241981974b3 100644 --- a/compiler/testData/debug/localVariables/tryFinally15.kt +++ b/compiler/testData/debug/localVariables/tryFinally15.kt @@ -1,5 +1,5 @@ +// WITH_RUNTIME // FILE: test.kt - fun box(): String { try { for (i in 0 until 1) { @@ -16,16 +16,16 @@ fun box(): String { return "FAIL" } -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:4 box: // test.kt:5 box: // test.kt:6 box: i:int=0:int // test.kt:7 box: i:int=0:int // test.kt:8 box: i:int=0:int, x:java.lang.String="x":java.lang.String // test.kt:10 box: i:int=0:int -// LOCAL VARIABLES JVM +// EXPECTATIONS JVM // test.kt:5 box: i:int=0:int -// LOCAL VARIABLES JVM_IR +// EXPECTATIONS JVM_IR // test.kt:5 box: i:int=0:int -// LOCAL VARIABLES +// EXPECTATIONS // test.kt:14 box: diff --git a/compiler/testData/debug/localVariables/tryFinally16.kt b/compiler/testData/debug/localVariables/tryFinally16.kt index 901b44b8765..5e7649e89f1 100644 --- a/compiler/testData/debug/localVariables/tryFinally16.kt +++ b/compiler/testData/debug/localVariables/tryFinally16.kt @@ -1,5 +1,7 @@ +// The local `i` is visible in the finally block with old backend. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt - fun box(): String { try { for (i in 0 until 1) { @@ -16,14 +18,11 @@ fun box(): String { return "FAIL2" } -// The local `i` is visible in the finally block with old backend. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:4 box: -// test.kt:5 box: -// test.kt:6 box: i:int=0:int -// test.kt:7 box: i:int=0:int -// test.kt:8 box: i:int=0:int, x:java.lang.String="x":java.lang.String -// test.kt:10 box: i:int=0:int -// test.kt:14 box: +// EXPECTATIONS +// test.kt:6 box: +// test.kt:7 box: +// test.kt:8 box: i:int=0:int +// test.kt:9 box: i:int=0:int +// test.kt:10 box: i:int=0:int, x:java.lang.String="x":java.lang.String +// test.kt:12 box: i:int=0:int +// test.kt:16 box: diff --git a/compiler/testData/debug/localVariables/tryFinally17.kt b/compiler/testData/debug/localVariables/tryFinally17.kt index d35a789450b..b1e934ab58c 100644 --- a/compiler/testData/debug/localVariables/tryFinally17.kt +++ b/compiler/testData/debug/localVariables/tryFinally17.kt @@ -1,3 +1,7 @@ +// IGNORE_BACKEND: JVM +// The old backend steps on line 4, 5, 9, and 8. No step on the throw, and a step on the end +// brace of the finally before going into the actual finally code. + // FILE: test.kt fun box(): String { @@ -10,13 +14,9 @@ fun box(): String { return "FAIL" } -// IGNORE_BACKEND: JVM -// The old backend steps on line 4, 5, 9, and 8. No step on the throw, and a step on the end -// brace of the finally before going into the actual finally code. - -// LOCAL VARIABLES -// test.kt:4 box: -// test.kt:5 box: -// test.kt:6 box: x:java.lang.String="x":java.lang.String -// test.kt:7 box: +// EXPECTATIONS // test.kt:8 box: +// test.kt:9 box: +// test.kt:10 box: x:java.lang.String="x":java.lang.String +// test.kt:11 box: +// test.kt:12 box: diff --git a/compiler/testData/debug/localVariables/tryFinally2.kt b/compiler/testData/debug/localVariables/tryFinally2.kt index 67893453d81..db148e5ee18 100644 --- a/compiler/testData/debug/localVariables/tryFinally2.kt +++ b/compiler/testData/debug/localVariables/tryFinally2.kt @@ -1,3 +1,6 @@ +// The old backend has the local y covering the finally block as well. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt fun box() { var result = "" @@ -14,24 +17,21 @@ fun box() { } } -// The old backend has the local y covering the finally block as well. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:3 box: -// test.kt:4 box: result:java.lang.String="":java.lang.String -// test.kt:5 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:6 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:7 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:8 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:11 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:12 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, z:java.lang.String="z":java.lang.String -// test.kt:4 box: result:java.lang.String="yz":java.lang.String -// test.kt:5 box: result:java.lang.String="yz":java.lang.String, x:java.lang.String="B":java.lang.String -// test.kt:6 box: result:java.lang.String="yz":java.lang.String, x:java.lang.String="B":java.lang.String -// test.kt:7 box: result:java.lang.String="yz":java.lang.String, x:java.lang.String="B":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:8 box: result:java.lang.String="yzy":java.lang.String, x:java.lang.String="B":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:11 box: result:java.lang.String="yzy":java.lang.String, x:java.lang.String="B":java.lang.String -// test.kt:12 box: result:java.lang.String="yzy":java.lang.String, x:java.lang.String="B":java.lang.String, z:java.lang.String="z":java.lang.String -// test.kt:4 box: result:java.lang.String="yzyz":java.lang.String -// test.kt:15 box: result:java.lang.String="yzyz":java.lang.String +// EXPECTATIONS +// test.kt:6 box: +// test.kt:7 box: result:java.lang.String="":java.lang.String +// test.kt:8 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:9 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:10 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:11 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:14 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:15 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, z:java.lang.String="z":java.lang.String +// test.kt:7 box: result:java.lang.String="yz":java.lang.String +// test.kt:8 box: result:java.lang.String="yz":java.lang.String, x:java.lang.String="B":java.lang.String +// test.kt:9 box: result:java.lang.String="yz":java.lang.String, x:java.lang.String="B":java.lang.String +// test.kt:10 box: result:java.lang.String="yz":java.lang.String, x:java.lang.String="B":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:11 box: result:java.lang.String="yzy":java.lang.String, x:java.lang.String="B":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:14 box: result:java.lang.String="yzy":java.lang.String, x:java.lang.String="B":java.lang.String +// test.kt:15 box: result:java.lang.String="yzy":java.lang.String, x:java.lang.String="B":java.lang.String, z:java.lang.String="z":java.lang.String +// test.kt:7 box: result:java.lang.String="yzyz":java.lang.String +// test.kt:18 box: result:java.lang.String="yzyz":java.lang.String diff --git a/compiler/testData/debug/localVariables/tryFinally3.kt b/compiler/testData/debug/localVariables/tryFinally3.kt index 810bdca09bd..c58b24c4834 100644 --- a/compiler/testData/debug/localVariables/tryFinally3.kt +++ b/compiler/testData/debug/localVariables/tryFinally3.kt @@ -1,3 +1,6 @@ +// The old backend has the local y covering the finally block as well. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt fun compute(): String { @@ -20,19 +23,16 @@ fun box() { compute() } -// The old backend has the local y covering the finally block as well. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:20 box: -// test.kt:4 compute: -// test.kt:5 compute: result:java.lang.String="":java.lang.String -// test.kt:6 compute: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:7 compute: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:8 compute: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:9 compute: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:12 compute: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String -// test.kt:13 compute: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, z:java.lang.String="z":java.lang.String -// test.kt:9 compute: result:java.lang.String="yz":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String -// test.kt:20 box: -// test.kt:21 box: +// EXPECTATIONS +// test.kt:23 box: +// test.kt:7 compute: +// test.kt:8 compute: result:java.lang.String="":java.lang.String +// test.kt:9 compute: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:10 compute: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:11 compute: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:12 compute: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:15 compute: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String +// test.kt:16 compute: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, z:java.lang.String="z":java.lang.String +// test.kt:12 compute: result:java.lang.String="yz":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String +// test.kt:23 box: +// test.kt:24 box: diff --git a/compiler/testData/debug/localVariables/tryFinally4.kt b/compiler/testData/debug/localVariables/tryFinally4.kt index 250b105c5c9..82250498713 100644 --- a/compiler/testData/debug/localVariables/tryFinally4.kt +++ b/compiler/testData/debug/localVariables/tryFinally4.kt @@ -1,3 +1,6 @@ +// The old backend gets the local variables for finally blocks wrong. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt fun compute(): String { @@ -26,24 +29,21 @@ fun box() { compute() } -// The old backend gets the local variables for finally blocks wrong. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:26 box: -// test.kt:4 compute: -// test.kt:5 compute: result:java.lang.String="":java.lang.String -// test.kt:6 compute: result:java.lang.String="":java.lang.String -// test.kt:7 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String -// test.kt:8 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String -// test.kt:9 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String -// test.kt:10 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int -// test.kt:11 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int, e:java.lang.String="e":java.lang.String -// test.kt:12 compute: result:java.lang.String="b":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int, e:java.lang.String="e":java.lang.String -// test.kt:15 compute: result:java.lang.String="b":java.lang.String, a:java.lang.String="a":java.lang.String -// test.kt:16 compute: result:java.lang.String="b":java.lang.String, a:java.lang.String="a":java.lang.String, c:java.lang.String="c":java.lang.String -// test.kt:19 compute: result:java.lang.String="bc":java.lang.String -// test.kt:20 compute: result:java.lang.String="bc":java.lang.String, d:java.lang.String="d":java.lang.String -// test.kt:12 compute: result:java.lang.String="bcd":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int, e:java.lang.String="e":java.lang.String -// test.kt:26 box: -// test.kt:27 box: +// EXPECTATIONS +// test.kt:29 box: +// test.kt:7 compute: +// test.kt:8 compute: result:java.lang.String="":java.lang.String +// test.kt:9 compute: result:java.lang.String="":java.lang.String +// test.kt:10 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String +// test.kt:11 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String +// test.kt:12 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String +// test.kt:13 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int +// test.kt:14 compute: result:java.lang.String="":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int, e:java.lang.String="e":java.lang.String +// test.kt:15 compute: result:java.lang.String="b":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int, e:java.lang.String="e":java.lang.String +// test.kt:18 compute: result:java.lang.String="b":java.lang.String, a:java.lang.String="a":java.lang.String +// test.kt:19 compute: result:java.lang.String="b":java.lang.String, a:java.lang.String="a":java.lang.String, c:java.lang.String="c":java.lang.String +// test.kt:22 compute: result:java.lang.String="bc":java.lang.String +// test.kt:23 compute: result:java.lang.String="bc":java.lang.String, d:java.lang.String="d":java.lang.String +// test.kt:15 compute: result:java.lang.String="bcd":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int, e:java.lang.String="e":java.lang.String +// test.kt:29 box: +// test.kt:30 box: diff --git a/compiler/testData/debug/localVariables/tryFinally5.kt b/compiler/testData/debug/localVariables/tryFinally5.kt index b30b6bf458f..49659cfc744 100644 --- a/compiler/testData/debug/localVariables/tryFinally5.kt +++ b/compiler/testData/debug/localVariables/tryFinally5.kt @@ -1,3 +1,6 @@ +// JVM backend has the `a` local covering the finally block. It shouldn't. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt inline fun g(block: () -> Unit) { @@ -26,19 +29,15 @@ fun box() { val localX = x } -// JVM backend has the `a` local covering the finally block. It shouldn't. - -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:25 box: -// test.kt:10 compute: -// test.kt:11 compute: -// test.kt:12 compute: a:java.lang.String="a":java.lang.String -// test.kt:4 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int -// test.kt:13 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, $i$a$-g-TestKt$compute$1:int=0:int -// test.kt:14 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, $i$a$-g-TestKt$compute$1:int=0:int, b:java.lang.String="b":java.lang.String -// test.kt:19 compute: -// test.kt:25 box: -// test.kt:26 box: result:java.lang.String="b":java.lang.String -// test.kt:27 box: result:java.lang.String="b":java.lang.String, localX:java.lang.String="OK":java.lang.String +// EXPECTATIONS +// test.kt:28 box: +// test.kt:13 compute: +// test.kt:14 compute: +// test.kt:15 compute: a:java.lang.String="a":java.lang.String +// test.kt:7 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int +// test.kt:16 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, $i$a$-g-TestKt$compute$1:int=0:int +// test.kt:17 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, $i$a$-g-TestKt$compute$1:int=0:int, b:java.lang.String="b":java.lang.String +// test.kt:22 compute: +// test.kt:28 box: +// test.kt:29 box: result:java.lang.String="b":java.lang.String +// test.kt:30 box: result:java.lang.String="b":java.lang.String, localX:java.lang.String="OK":java.lang.String diff --git a/compiler/testData/debug/localVariables/tryFinally6.kt b/compiler/testData/debug/localVariables/tryFinally6.kt index 6af51b6a1c5..377ea8b4230 100644 --- a/compiler/testData/debug/localVariables/tryFinally6.kt +++ b/compiler/testData/debug/localVariables/tryFinally6.kt @@ -1,3 +1,6 @@ +// JVM backend has `a` visible in the `compute` finally block. It shouldn't be. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt inline fun h(block: () -> Unit) { @@ -40,25 +43,22 @@ fun box() { val localX = x } -// JVM backend has `a` visible in the `compute` finally block. It shouldn't be. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:39 box: -// test.kt:24 compute: -// test.kt:25 compute: -// test.kt:26 compute: a:java.lang.String="a":java.lang.String -// test.kt:13 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int -// test.kt:14 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int -// test.kt:15 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String -// test.kt:4 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int -// test.kt:5 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int -// test.kt:6 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int, hLocal$iv$iv:java.lang.String="hLocal":java.lang.String -// test.kt:27 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int, hLocal$iv$iv:java.lang.String="hLocal":java.lang.String, $i$a$-g-TestKt$compute$1:int=0:int -// test.kt:28 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int, hLocal$iv$iv:java.lang.String="hLocal":java.lang.String, $i$a$-g-TestKt$compute$1:int=0:int, b:java.lang.String="b":java.lang.String -// test.kt:8 compute: a:java.lang.String="a":java.lang.String -// test.kt:17 compute: a:java.lang.String="a":java.lang.String -// test.kt:33 compute: -// test.kt:39 box: -// test.kt:40 box: result:java.lang.String="b":java.lang.String -// test.kt:41 box: result:java.lang.String="b":java.lang.String, localX:java.lang.String="OK":java.lang.String +// EXPECTATIONS +// test.kt:42 box: +// test.kt:27 compute: +// test.kt:28 compute: +// test.kt:29 compute: a:java.lang.String="a":java.lang.String +// test.kt:16 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int +// test.kt:17 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int +// test.kt:18 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String +// test.kt:7 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int +// test.kt:8 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int +// test.kt:9 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int, hLocal$iv$iv:java.lang.String="hLocal":java.lang.String +// test.kt:30 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int, hLocal$iv$iv:java.lang.String="hLocal":java.lang.String, $i$a$-g-TestKt$compute$1:int=0:int +// test.kt:31 compute: a:java.lang.String="a":java.lang.String, $i$f$g:int=0:int, gLocal$iv:java.lang.String="gLocal":java.lang.String, $i$f$h:int=0:int, hLocal$iv$iv:java.lang.String="hLocal":java.lang.String, $i$a$-g-TestKt$compute$1:int=0:int, b:java.lang.String="b":java.lang.String +// test.kt:11 compute: a:java.lang.String="a":java.lang.String +// test.kt:20 compute: a:java.lang.String="a":java.lang.String +// test.kt:36 compute: +// test.kt:42 box: +// test.kt:43 box: result:java.lang.String="b":java.lang.String +// test.kt:44 box: result:java.lang.String="b":java.lang.String, localX:java.lang.String="OK":java.lang.String diff --git a/compiler/testData/debug/localVariables/tryFinally7.kt b/compiler/testData/debug/localVariables/tryFinally7.kt index 9d55d7bd2a5..9273862c942 100644 --- a/compiler/testData/debug/localVariables/tryFinally7.kt +++ b/compiler/testData/debug/localVariables/tryFinally7.kt @@ -1,3 +1,6 @@ +// The old backend has `y` and `j` visible on the finally block. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt inline fun f(block: () -> Unit) { @@ -30,22 +33,19 @@ fun box() { val localX = x } -// The old backend has `y` and `j` visible on the finally block. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:29 box: -// test.kt:10 compute: -// test.kt:11 compute: -// test.kt:12 compute: y:int=42:int -// test.kt:13 compute: y:int=42:int, i:int=0:int -// test.kt:15 compute: -// test.kt:16 compute: e:java.lang.Exception=java.lang.RuntimeException -// test.kt:17 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int -// test.kt:18 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int, j:int=0:int -// test.kt:4 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int, j:int=0:int, $i$f$f:int=0:int -// test.kt:19 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int, j:int=0:int, $i$f$f:int=0:int, $i$a$-f-TestKt$compute$1:int=0:int -// test.kt:23 compute: -// test.kt:29 box: -// test.kt:30 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String -// test.kt:31 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String +// EXPECTATIONS +// test.kt:32 box: +// test.kt:13 compute: +// test.kt:14 compute: +// test.kt:15 compute: y:int=42:int +// test.kt:16 compute: y:int=42:int, i:int=0:int +// test.kt:18 compute: +// test.kt:19 compute: e:java.lang.Exception=java.lang.RuntimeException +// test.kt:20 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int +// test.kt:21 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int, j:int=0:int +// test.kt:7 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int, j:int=0:int, $i$f$f:int=0:int +// test.kt:22 compute: e:java.lang.Exception=java.lang.RuntimeException, y:int=32:int, j:int=0:int, $i$f$f:int=0:int, $i$a$-f-TestKt$compute$1:int=0:int +// test.kt:26 compute: +// test.kt:32 box: +// test.kt:33 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String +// test.kt:34 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String diff --git a/compiler/testData/debug/localVariables/tryFinally8.kt b/compiler/testData/debug/localVariables/tryFinally8.kt index a34fc9bb6b2..65f4d34eba7 100644 --- a/compiler/testData/debug/localVariables/tryFinally8.kt +++ b/compiler/testData/debug/localVariables/tryFinally8.kt @@ -1,3 +1,6 @@ +// The old backend has `y` and `i` visible on the finally block. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt inline fun f(block: () -> Unit) { @@ -32,23 +35,20 @@ fun box() { val localX = x } -// The old backend has `y` and `i` visible on the finally block. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:31 box: -// test.kt:17 compute: -// test.kt:18 compute: -// test.kt:19 compute: y:int=42:int -// test.kt:20 compute: y:int=42:int, i:int=0:int -// test.kt:4 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int -// test.kt:5 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int -// test.kt:6 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int -// test.kt:7 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int, j$iv:int=0:int -// test.kt:9 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int -// test.kt:10 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, e$iv:java.lang.Exception=java.lang.RuntimeException -// test.kt:21 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, e$iv:java.lang.Exception=java.lang.RuntimeException, $i$a$-f-TestKt$compute$1:int=0:int -// test.kt:25 compute: -// test.kt:31 box: -// test.kt:32 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String -// test.kt:33 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String +// EXPECTATIONS +// test.kt:34 box: +// test.kt:20 compute: +// test.kt:21 compute: +// test.kt:22 compute: y:int=42:int +// test.kt:23 compute: y:int=42:int, i:int=0:int +// test.kt:7 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int +// test.kt:8 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int +// test.kt:9 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int +// test.kt:10 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, z$iv:int=32:int, j$iv:int=0:int +// test.kt:12 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int +// test.kt:13 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, e$iv:java.lang.Exception=java.lang.RuntimeException +// test.kt:24 compute: y:int=42:int, i:int=0:int, $i$f$f:int=0:int, e$iv:java.lang.Exception=java.lang.RuntimeException, $i$a$-f-TestKt$compute$1:int=0:int +// test.kt:28 compute: +// test.kt:34 box: +// test.kt:35 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String +// test.kt:36 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String diff --git a/compiler/testData/debug/localVariables/tryFinally9.kt b/compiler/testData/debug/localVariables/tryFinally9.kt index af1a8bb1e30..85ad109497e 100644 --- a/compiler/testData/debug/localVariables/tryFinally9.kt +++ b/compiler/testData/debug/localVariables/tryFinally9.kt @@ -1,3 +1,6 @@ +// The local variables in the try and finally blocks are not removed for the finally block with the old backend. +// IGNORE_BACKEND: JVM +// WITH_RUNTIME // FILE: test.kt inline fun f(block: () -> Unit) { @@ -35,26 +38,23 @@ fun box() { val localX = x } -// The local variables in the try and finally blocks are not removed for the finally block with the old backend. -// IGNORE_BACKEND: JVM - -// LOCAL VARIABLES -// test.kt:34 box: -// test.kt:10 compute: -// test.kt:11 compute: -// test.kt:12 compute: -// test.kt:13 compute: y:int=42:int -// test.kt:14 compute: y:int=42:int, i:int=0:int -// test.kt:17 compute: -// test.kt:18 compute: s:java.lang.String="NOPE":java.lang.String -// test.kt:19 compute: s:java.lang.String="NOPE":java.lang.String -// test.kt:4 compute: s:java.lang.String="NOPE":java.lang.String, $i$f$f:int=0:int -// test.kt:20 compute: s:java.lang.String="NOPE":java.lang.String, $i$f$f:int=0:int, $i$a$-f-TestKt$compute$1:int=0:int -// test.kt:24 compute: -// test.kt:25 compute: s2:java.lang.String="NOPE":java.lang.String -// test.kt:26 compute: s2:java.lang.String="NOPE":java.lang.String, j:int=0:int -// test.kt:25 compute: s2:java.lang.String="OK":java.lang.String, j:int=0:int -// test.kt:28 compute: s2:java.lang.String="OK":java.lang.String -// test.kt:34 box: -// test.kt:35 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String -// test.kt:36 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String +// EXPECTATIONS +// test.kt:37 box: +// test.kt:13 compute: +// test.kt:14 compute: +// test.kt:15 compute: +// test.kt:16 compute: y:int=42:int +// test.kt:17 compute: y:int=42:int, i:int=0:int +// test.kt:20 compute: +// test.kt:21 compute: s:java.lang.String="NOPE":java.lang.String +// test.kt:22 compute: s:java.lang.String="NOPE":java.lang.String +// test.kt:7 compute: s:java.lang.String="NOPE":java.lang.String, $i$f$f:int=0:int +// test.kt:23 compute: s:java.lang.String="NOPE":java.lang.String, $i$f$f:int=0:int, $i$a$-f-TestKt$compute$1:int=0:int +// test.kt:27 compute: +// test.kt:28 compute: s2:java.lang.String="NOPE":java.lang.String +// test.kt:29 compute: s2:java.lang.String="NOPE":java.lang.String, j:int=0:int +// test.kt:28 compute: s2:java.lang.String="OK":java.lang.String, j:int=0:int +// test.kt:31 compute: s2:java.lang.String="OK":java.lang.String +// test.kt:37 box: +// test.kt:38 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String +// test.kt:39 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String diff --git a/compiler/testData/debug/localVariables/underscoreNames.kt b/compiler/testData/debug/localVariables/underscoreNames.kt index f106a2bcea3..c37233e9e94 100644 --- a/compiler/testData/debug/localVariables/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/underscoreNames.kt @@ -1,4 +1,5 @@ -//FILE: test.kt + +// FILE: test.kt data class A(val x: Double = 1.0, val y: String = "", val z: Char = '0') @@ -21,22 +22,29 @@ fun box() { "" } } -// IGNORE_BACKEND: JVM_IR -// LOCAL VARIABLES -// test.kt:11 box: -// test.kt:3 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char -// test.kt:11 box: -// test.kt:5 foo: a:A=A, block:kotlin.jvm.functions.Function3=TestKt$box$1 -// test.kt:14 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int -// test.kt:3 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char -// test.kt:14 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char -// test.kt:15 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char -// test.kt:3 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char -// test.kt:15 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char -// test.kt:17 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char -// test.kt:7 getArrayOfA: -// test.kt:17 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char -// test.kt:21 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char -// test.kt:5 foo: a:A=A, block:kotlin.jvm.functions.Function3=TestKt$box$1 -// test.kt:11 box: -// test.kt:23 box: \ No newline at end of file + +// EXPECTATIONS +// test.kt:12 box: +// test.kt:4 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char +// test.kt:12 box: +// test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function3=TestKt$box$1 + +// EXPECTATIONS JVM_IR +// test.kt:13 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int +// test.kt:15 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char +// EXPECTATIONS JVM +// test.kt:15 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int + +// EXPECTATIONS +// test.kt:4 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char +// test.kt:15 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char +// test.kt:16 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char +// test.kt:4 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char +// test.kt:16 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char +// test.kt:18 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char +// test.kt:8 getArrayOfA: +// test.kt:18 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char +// test.kt:22 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char +// test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function3=TestKt$box$1 +// test.kt:12 box: +// test.kt:24 box: diff --git a/compiler/testData/debug/stepping/IfTrueThenFalse.kt b/compiler/testData/debug/stepping/IfTrueThenFalse.kt index 61e9b7aa8df..53a01e5c1bc 100644 --- a/compiler/testData/debug/stepping/IfTrueThenFalse.kt +++ b/compiler/testData/debug/stepping/IfTrueThenFalse.kt @@ -8,7 +8,7 @@ fun box() { false } -// LINENUMBERS +// EXPECTATIONS // test.kt:5 box // test.kt:2 cond // test.kt:5 box diff --git a/compiler/testData/debug/stepping/anonymousFunction.kt b/compiler/testData/debug/stepping/anonymousFunction.kt index e60811a00ad..5ae9f3da427 100644 --- a/compiler/testData/debug/stepping/anonymousFunction.kt +++ b/compiler/testData/debug/stepping/anonymousFunction.kt @@ -8,10 +8,10 @@ fun box() { } } -// LINENUMBERS +// EXPECTATIONS // test.kt:6 box // test.kt:3 eval // test.kt:7 invoke // test.kt:3 eval // test.kt:6 box -// test.kt:9 box \ No newline at end of file +// test.kt:9 box diff --git a/compiler/testData/debug/stepping/anonymousFunctionDirect.kt b/compiler/testData/debug/stepping/anonymousFunctionDirect.kt index 7bf460b8864..8c1a5651cd0 100644 --- a/compiler/testData/debug/stepping/anonymousFunctionDirect.kt +++ b/compiler/testData/debug/stepping/anonymousFunctionDirect.kt @@ -6,12 +6,12 @@ fun box() { }() } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 invoke -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:5 box$lambda-0 -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:7 box diff --git a/compiler/testData/debug/stepping/assertion.kt b/compiler/testData/debug/stepping/assertion.kt index 2c064d0398f..9fbca68455c 100644 --- a/compiler/testData/debug/stepping/assertion.kt +++ b/compiler/testData/debug/stepping/assertion.kt @@ -29,7 +29,7 @@ fun box(): String { return "OK" } -// LINENUMBERS +// EXPECTATIONS // test.kt:24 box // test.kt:15 box // test.kt:16 box diff --git a/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt b/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt index 2d303d6c79b..f76f6a26e32 100644 --- a/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt +++ b/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt @@ -19,7 +19,7 @@ fun box() { foo() } -// LINENUMBERS +// EXPECTATIONS // test.kt:19 box // test.kt:11 foo // test.kt:12 foo diff --git a/compiler/testData/debug/stepping/callWithCallInArguments.kt b/compiler/testData/debug/stepping/callWithCallInArguments.kt index 54892c5d3f8..6c7f3b5875a 100644 --- a/compiler/testData/debug/stepping/callWithCallInArguments.kt +++ b/compiler/testData/debug/stepping/callWithCallInArguments.kt @@ -13,7 +13,7 @@ fun box() { ) } -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:3 // test.kt:8 box diff --git a/compiler/testData/debug/stepping/callWithReceiver.kt b/compiler/testData/debug/stepping/callWithReceiver.kt index 841c18607fb..aaed4f84f63 100644 --- a/compiler/testData/debug/stepping/callWithReceiver.kt +++ b/compiler/testData/debug/stepping/callWithReceiver.kt @@ -14,7 +14,7 @@ fun box() { .bar() } -// LINENUMBERS +// EXPECTATIONS // test.kt:9 box // test.kt:3 // test.kt:9 box diff --git a/compiler/testData/debug/stepping/callableReference.kt b/compiler/testData/debug/stepping/callableReference.kt index 0952688d6c6..51041275ebb 100644 --- a/compiler/testData/debug/stepping/callableReference.kt +++ b/compiler/testData/debug/stepping/callableReference.kt @@ -10,7 +10,7 @@ fun f(block: () -> Unit) { block() } -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:4 box // test.kt:10 f diff --git a/compiler/testData/debug/stepping/chainCall.kt b/compiler/testData/debug/stepping/chainCall.kt index 9f2b79bfe61..c5ce3601413 100644 --- a/compiler/testData/debug/stepping/chainCall.kt +++ b/compiler/testData/debug/stepping/chainCall.kt @@ -14,7 +14,7 @@ fun box() { .bar() } -// LINENUMBERS +// EXPECTATIONS // test.kt:9 box // test.kt:3 // test.kt:9 box diff --git a/compiler/testData/debug/stepping/class.kt b/compiler/testData/debug/stepping/class.kt index 3caa69394e0..0ab89169e54 100644 --- a/compiler/testData/debug/stepping/class.kt +++ b/compiler/testData/debug/stepping/class.kt @@ -18,13 +18,13 @@ fun box() { // three to be hit both on entry to the constructor and on exit after storing the // value of prop. -// LINENUMBERS +// EXPECTATIONS // test.kt:12 box // test.kt:3 // test.kt:4 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:3 -// LINENUMBERS +// EXPECTATIONS // test.kt:12 box // test.kt:13 box // test.kt:4 getProp diff --git a/compiler/testData/debug/stepping/classObject.kt b/compiler/testData/debug/stepping/classObject.kt index fd0cdcbc740..349a2cc8794 100644 --- a/compiler/testData/debug/stepping/classObject.kt +++ b/compiler/testData/debug/stepping/classObject.kt @@ -16,7 +16,7 @@ fun box() { A.foo() } -// LINENUMBERS +// EXPECTATIONS // test.kt:14 box // test.kt:5 // test.kt:6 diff --git a/compiler/testData/debug/stepping/compileTimeConstant.kt b/compiler/testData/debug/stepping/compileTimeConstant.kt index 3476c972c1c..bea6e8e0820 100644 --- a/compiler/testData/debug/stepping/compileTimeConstant.kt +++ b/compiler/testData/debug/stepping/compileTimeConstant.kt @@ -5,7 +5,7 @@ fun box() { 42 } -// LINENUMBERS +// EXPECTATIONS // test.kt:5 box // test.kt:4 box // test.kt:6 box diff --git a/compiler/testData/debug/stepping/conjunction.kt b/compiler/testData/debug/stepping/conjunction.kt index 29b4ff4fc4b..81e821fe330 100644 --- a/compiler/testData/debug/stepping/conjunction.kt +++ b/compiler/testData/debug/stepping/conjunction.kt @@ -18,7 +18,7 @@ fun getC() = false fun getD() = true -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:13 getA // test.kt:3 box diff --git a/compiler/testData/debug/stepping/constantConditions.kt b/compiler/testData/debug/stepping/constantConditions.kt index 9c54cf805ed..1b489eb50c7 100644 --- a/compiler/testData/debug/stepping/constantConditions.kt +++ b/compiler/testData/debug/stepping/constantConditions.kt @@ -14,11 +14,11 @@ fun test(): Long { return 1 } -// LINENUMBERS +// EXPECTATIONS // test.kt:5 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:9 test -// LINENUMBERS +// EXPECTATIONS // test.kt:10 test // test.kt:11 test // test.kt:5 box diff --git a/compiler/testData/debug/stepping/constructorCall.kt b/compiler/testData/debug/stepping/constructorCall.kt index 70249a32a2a..62272cc86aa 100644 --- a/compiler/testData/debug/stepping/constructorCall.kt +++ b/compiler/testData/debug/stepping/constructorCall.kt @@ -13,7 +13,7 @@ fun box() { 4) } -// LINENUMBERS +// EXPECTATIONS // test.kt:6 box // test.kt:3 // test.kt:6 box diff --git a/compiler/testData/debug/stepping/constructors.kt b/compiler/testData/debug/stepping/constructors.kt index 0cd55be3e75..9d4a1ae36d8 100644 --- a/compiler/testData/debug/stepping/constructors.kt +++ b/compiler/testData/debug/stepping/constructors.kt @@ -84,7 +84,7 @@ class O(i: T) { // are there in the class file fro JVM, but there is no guarantee that there is an instruction to // step on and sometimes there is no step on the end brace. -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:19 // test.kt:4 box @@ -98,78 +98,78 @@ class O(i: T) { // test.kt:25 // test.kt:7 box // test.kt:8 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:28 -// LINENUMBERS +// EXPECTATIONS // test.kt:29 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:30 -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:9 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:33 -// LINENUMBERS +// EXPECTATIONS // test.kt:34 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:35 -// LINENUMBERS +// EXPECTATIONS // test.kt:9 box // test.kt:10 box // test.kt:37 // test.kt:38 // test.kt:39 // test.kt:40 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:37 -// LINENUMBERS +// EXPECTATIONS // test.kt:10 box // test.kt:11 box // test.kt:42 // test.kt:43 // test.kt:44 // test.kt:45 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:42 -// LINENUMBERS +// EXPECTATIONS // test.kt:11 box // test.kt:12 box -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:49 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:48 -// LINENUMBERS +// EXPECTATIONS // test.kt:52 // test.kt:53 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:54 -// LINENUMBERS +// EXPECTATIONS // test.kt:49 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:50 -// LINENUMBERS +// EXPECTATIONS // test.kt:12 box // test.kt:13 box // test.kt:57 // test.kt:61 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:62 -// LINENUMBERS +// EXPECTATIONS // test.kt:58 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:59 -// LINENUMBERS +// EXPECTATIONS // test.kt:13 box // test.kt:14 box // test.kt:65 // test.kt:69 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:70 -// LINENUMBERS +// EXPECTATIONS // test.kt:66 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:67 -// LINENUMBERS +// EXPECTATIONS // test.kt:14 box // test.kt:15 box // test.kt:72 @@ -177,10 +177,10 @@ class O(i: T) { // test.kt:16 box // test.kt:73 // test.kt:72 -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:73 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:74 -// LINENUMBERS +// EXPECTATIONS // test.kt:16 box // test.kt:17 box \ No newline at end of file diff --git a/compiler/testData/debug/stepping/dataClass.kt b/compiler/testData/debug/stepping/dataClass.kt index 60274f6cd05..fb0f0517300 100644 --- a/compiler/testData/debug/stepping/dataClass.kt +++ b/compiler/testData/debug/stepping/dataClass.kt @@ -24,7 +24,7 @@ fun box() { e.copy() } -// LINENUMBERS +// EXPECTATIONS // test.kt:13 box // test.kt:3 // test.kt:13 box diff --git a/compiler/testData/debug/stepping/defaultParameter.kt b/compiler/testData/debug/stepping/defaultParameter.kt index 4192e259992..b40551cc59e 100644 --- a/compiler/testData/debug/stepping/defaultParameter.kt +++ b/compiler/testData/debug/stepping/defaultParameter.kt @@ -12,7 +12,7 @@ fun box() { } // FORCE_STEP_INTO -// LINENUMBERS +// EXPECTATIONS // test.kt:11 box // test.kt:3 // test.kt:11 box diff --git a/compiler/testData/debug/stepping/enum.kt b/compiler/testData/debug/stepping/enum.kt index 574713ebb37..27be3cab8b3 100644 --- a/compiler/testData/debug/stepping/enum.kt +++ b/compiler/testData/debug/stepping/enum.kt @@ -34,20 +34,20 @@ fun box() { // for the evaluation of the arguments constructor and for the constructor call, // but not for the allocation of the object. -// LINENUMBERS +// EXPECTATIONS // test.kt:22 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 // test.kt:5 -// LINENUMBERS +// EXPECTATIONS // test.kt:7 foo // test.kt:9 foo // test.kt:22 box // test.kt:23 box // test.kt:15 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:16 -// LINENUMBERS +// EXPECTATIONS // test.kt:17 // test.kt:16 // test.kt:24 box \ No newline at end of file diff --git a/compiler/testData/debug/stepping/for.kt b/compiler/testData/debug/stepping/for.kt index 85c8bd57913..33f7bfc5439 100644 --- a/compiler/testData/debug/stepping/for.kt +++ b/compiler/testData/debug/stepping/for.kt @@ -7,7 +7,7 @@ fun box() { inline fun foo(n: Int) {} -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:4 box // test.kt:8 box diff --git a/compiler/testData/debug/stepping/functionCallWithDefault.kt b/compiler/testData/debug/stepping/functionCallWithDefault.kt index d1abd01b4ac..42e38cec6e4 100644 --- a/compiler/testData/debug/stepping/functionCallWithDefault.kt +++ b/compiler/testData/debug/stepping/functionCallWithDefault.kt @@ -12,7 +12,7 @@ inline fun bar(i: Int = 1) { } // FORCE_STEP_INTO -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:8 foo$default (synthetic) // test.kt:9 foo diff --git a/compiler/testData/debug/stepping/functionCallWithInlinedLambdaParam.kt b/compiler/testData/debug/stepping/functionCallWithInlinedLambdaParam.kt index 44f76347ab6..2fed22e5380 100644 --- a/compiler/testData/debug/stepping/functionCallWithInlinedLambdaParam.kt +++ b/compiler/testData/debug/stepping/functionCallWithInlinedLambdaParam.kt @@ -15,7 +15,7 @@ inline fun foo(f: () -> Unit) { f() } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:14 box // test.kt:15 box diff --git a/compiler/testData/debug/stepping/functionCallWithLambdaParam.kt b/compiler/testData/debug/stepping/functionCallWithLambdaParam.kt index 214866d377d..2f10a235143 100644 --- a/compiler/testData/debug/stepping/functionCallWithLambdaParam.kt +++ b/compiler/testData/debug/stepping/functionCallWithLambdaParam.kt @@ -14,7 +14,7 @@ fun foo(f: () -> Unit) { f() } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:14 foo // test.kt:5 invoke diff --git a/compiler/testData/debug/stepping/functionInAnotherFile.kt b/compiler/testData/debug/stepping/functionInAnotherFile.kt index c85c3b40be3..f47d43fc2fc 100644 --- a/compiler/testData/debug/stepping/functionInAnotherFile.kt +++ b/compiler/testData/debug/stepping/functionInAnotherFile.kt @@ -7,7 +7,7 @@ fun foo(x: Int): Int { return bar(x) // 7 } -//FILE: test.kt +// FILE: test.kt import foo fun box() { foo(-3) //4 @@ -20,16 +20,16 @@ fun bar(x: Int) = foo(x) } -// LINENUMBERS -// test.kt:4 box +// EXPECTATIONS +// test.kt:13 box // foo.kt:4 foo // foo.kt:7 foo -// test.kt:8 bar -// test.kt:9 bar +// test.kt:17 bar +// test.kt:18 bar // foo.kt:4 foo // foo.kt:5 foo -// test.kt:9 bar -// test.kt:12 bar +// test.kt:18 bar +// test.kt:21 bar // foo.kt:7 foo -// test.kt:4 box -// test.kt:5 box +// test.kt:13 box +// test.kt:14 box diff --git a/compiler/testData/debug/stepping/if.kt b/compiler/testData/debug/stepping/if.kt index 83744e563cb..5673b067ead 100644 --- a/compiler/testData/debug/stepping/if.kt +++ b/compiler/testData/debug/stepping/if.kt @@ -13,7 +13,7 @@ inline fun getB(): Int { return 1 } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:13 box // test.kt:5 box diff --git a/compiler/testData/debug/stepping/if2.kt b/compiler/testData/debug/stepping/if2.kt index 32e04b9b6e2..47d785f5fa8 100644 --- a/compiler/testData/debug/stepping/if2.kt +++ b/compiler/testData/debug/stepping/if2.kt @@ -21,7 +21,7 @@ fun box() { foo(0) } -// LINENUMBERS +// EXPECTATIONS // test.kt:20 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/ifThen.kt b/compiler/testData/debug/stepping/ifThen.kt index d83c79db969..7afa88d1d55 100644 --- a/compiler/testData/debug/stepping/ifThen.kt +++ b/compiler/testData/debug/stepping/ifThen.kt @@ -14,7 +14,7 @@ fun box() { foo() } -// LINENUMBERS +// EXPECTATIONS // test.kt:12 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/ifThenElse.kt b/compiler/testData/debug/stepping/ifThenElse.kt index b9e1670cef3..368a2e786f1 100644 --- a/compiler/testData/debug/stepping/ifThenElse.kt +++ b/compiler/testData/debug/stepping/ifThenElse.kt @@ -22,7 +22,7 @@ fun box() { foo() } -// LINENUMBERS +// EXPECTATIONS // test.kt:20 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/ifThenElseFalse.kt b/compiler/testData/debug/stepping/ifThenElseFalse.kt index 75496469039..e2248be8935 100644 --- a/compiler/testData/debug/stepping/ifThenElseFalse.kt +++ b/compiler/testData/debug/stepping/ifThenElseFalse.kt @@ -17,7 +17,7 @@ fun box() { foo() } -// LINENUMBERS +// EXPECTATIONS // test.kt:15 box // test.kt:8 foo // test.kt:5 cond diff --git a/compiler/testData/debug/stepping/ifWithInlineInCondition.kt b/compiler/testData/debug/stepping/ifWithInlineInCondition.kt index ecdf3f67817..f4b57d10d86 100644 --- a/compiler/testData/debug/stepping/ifWithInlineInCondition.kt +++ b/compiler/testData/debug/stepping/ifWithInlineInCondition.kt @@ -29,7 +29,7 @@ inline fun Boolean.rid(): Boolean = this fun nop() {} -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:24 box // test.kt:3 box diff --git a/compiler/testData/debug/stepping/iincStepping.kt b/compiler/testData/debug/stepping/iincStepping.kt index 87d7fb21a58..8a94c806ae3 100644 --- a/compiler/testData/debug/stepping/iincStepping.kt +++ b/compiler/testData/debug/stepping/iincStepping.kt @@ -1,4 +1,5 @@ -//FILE: test.kt +// IGNORE_BACKEND: JVM +// FILE: test.kt fun box() { var i = 0 ++i @@ -16,7 +17,6 @@ fun box() { 1 } -// IGNORE_BACKEND: JVM // The current backend has strange stepping behavior for assignments. // It generates the line number for the assignment first, and then // the evaluation of the right hand side with line numbers. @@ -26,22 +26,22 @@ fun box() { // the line number for the actual assignment makes more sense as // that is the actual evaluation order. -// LINENUMBERS -// test.kt:3 box +// EXPECTATIONS // test.kt:4 box // test.kt:5 box // test.kt:6 box // test.kt:7 box -// test.kt:6 box // test.kt:8 box +// test.kt:7 box // test.kt:9 box // test.kt:10 box -// test.kt:9 box // test.kt:11 box -// test.kt:13 box +// test.kt:10 box // test.kt:12 box -// test.kt:15 box +// test.kt:14 box +// test.kt:13 box +// test.kt:16 box +// test.kt:17 box // test.kt:16 box // test.kt:15 box -// test.kt:14 box -// test.kt:17 box +// test.kt:18 box diff --git a/compiler/testData/debug/stepping/inTheEndOfLambdaArgumentOfInlineCall.kt b/compiler/testData/debug/stepping/inTheEndOfLambdaArgumentOfInlineCall.kt index 16644d61c18..c5be5712414 100644 --- a/compiler/testData/debug/stepping/inTheEndOfLambdaArgumentOfInlineCall.kt +++ b/compiler/testData/debug/stepping/inTheEndOfLambdaArgumentOfInlineCall.kt @@ -18,7 +18,7 @@ inline fun baz() { fun nop() {} -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:11 box // test.kt:19 nop diff --git a/compiler/testData/debug/stepping/initBlocks.kt b/compiler/testData/debug/stepping/initBlocks.kt index 673a77a9390..62e580be229 100644 --- a/compiler/testData/debug/stepping/initBlocks.kt +++ b/compiler/testData/debug/stepping/initBlocks.kt @@ -54,7 +54,7 @@ fun box() { // JVM_IR has an extra step back to the line of the class // declaration for the return in the constructor. -// LINENUMBERS +// EXPECTATIONS // test.kt:48 box // test.kt:3 // test.kt:6 @@ -62,9 +62,9 @@ fun box() { // test.kt:45 x // test.kt:7 // test.kt:8 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:3 -// LINENUMBERS +// EXPECTATIONS // test.kt:48 box // test.kt:49 box // test.kt:11 @@ -74,9 +74,9 @@ fun box() { // test.kt:16 // test.kt:17 // test.kt:18 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:11 -// LINENUMBERS +// EXPECTATIONS // test.kt:49 box // test.kt:50 box // test.kt:21 @@ -89,9 +89,9 @@ fun box() { // test.kt:28 // test.kt:29 // test.kt:30 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:21 -// LINENUMBERS +// EXPECTATIONS // test.kt:50 box // test.kt:51 box // test.kt:33 @@ -101,8 +101,8 @@ fun box() { // test.kt:39 // test.kt:40 // test.kt:42 -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:33 -// LINENUMBERS +// EXPECTATIONS // test.kt:51 box // test.kt:52 box diff --git a/compiler/testData/debug/stepping/initBlocksCompanion.kt b/compiler/testData/debug/stepping/initBlocksCompanion.kt index bf54939f407..3e0928194c5 100644 --- a/compiler/testData/debug/stepping/initBlocksCompanion.kt +++ b/compiler/testData/debug/stepping/initBlocksCompanion.kt @@ -30,7 +30,7 @@ fun box() { A.s } -// LINENUMBERS +// EXPECTATIONS // test.kt:29 box // test.kt:7 // test.kt:8 diff --git a/compiler/testData/debug/stepping/inlineCallableReference.kt b/compiler/testData/debug/stepping/inlineCallableReference.kt index 3d6309074e0..6d3d8bec734 100644 --- a/compiler/testData/debug/stepping/inlineCallableReference.kt +++ b/compiler/testData/debug/stepping/inlineCallableReference.kt @@ -15,7 +15,7 @@ inline fun f(block: () -> Unit) { block() } -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:4 box // test.kt:15 box diff --git a/compiler/testData/debug/stepping/inlineNamedCallableReference.kt b/compiler/testData/debug/stepping/inlineNamedCallableReference.kt index 85a4f35acb8..3eed8a1a043 100644 --- a/compiler/testData/debug/stepping/inlineNamedCallableReference.kt +++ b/compiler/testData/debug/stepping/inlineNamedCallableReference.kt @@ -10,7 +10,7 @@ inline fun f(block: () -> Unit) { fun g() {} -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:4 box // test.kt:8 box diff --git a/compiler/testData/debug/stepping/inlineSimpleCall.kt b/compiler/testData/debug/stepping/inlineSimpleCall.kt index 473042dde86..695b2c12624 100644 --- a/compiler/testData/debug/stepping/inlineSimpleCall.kt +++ b/compiler/testData/debug/stepping/inlineSimpleCall.kt @@ -22,7 +22,7 @@ fun box() { } } -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:4 box // test.kt:9 box diff --git a/compiler/testData/debug/stepping/kt42208.kt b/compiler/testData/debug/stepping/kt42208.kt index c24d7d0a840..12735bd4948 100644 --- a/compiler/testData/debug/stepping/kt42208.kt +++ b/compiler/testData/debug/stepping/kt42208.kt @@ -7,13 +7,13 @@ fun box() { // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa inline fun foo() = { } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box -// test1.kt:3 box -// test1.kt:4 box -// LINENUMBERS JVM_IR +// test1.kt:8 box +// test1.kt:9 box +// EXPECTATIONS JVM_IR // test.kt:4 box -// test1.kt:4 invoke +// test1.kt:9 invoke // test.kt:4 box -// LINENUMBERS -// test.kt:5 box \ No newline at end of file +// EXPECTATIONS +// test.kt:5 box diff --git a/compiler/testData/debug/stepping/kt42208b.kt b/compiler/testData/debug/stepping/kt42208b.kt index bfa70bc836c..9a872890279 100644 --- a/compiler/testData/debug/stepping/kt42208b.kt +++ b/compiler/testData/debug/stepping/kt42208b.kt @@ -8,18 +8,18 @@ fun box() { // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa inline fun foo() = { } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box -// test1.kt:3 box -// test1.kt:4 box -// LINENUMBERS JVM_IR +// test1.kt:9 box +// test1.kt:10 box +// EXPECTATIONS JVM_IR // test.kt:4 box // test.kt:5 box -// test1.kt:4 invoke +// test1.kt:10 invoke // test.kt:5 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:6 box -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:4 box // test.kt:5 box -// test.kt:6 box \ No newline at end of file +// test.kt:6 box diff --git a/compiler/testData/debug/stepping/kt42208c.kt b/compiler/testData/debug/stepping/kt42208c.kt index 6f1a140734f..95536abecd6 100644 --- a/compiler/testData/debug/stepping/kt42208c.kt +++ b/compiler/testData/debug/stepping/kt42208c.kt @@ -13,26 +13,26 @@ inline fun foo() = { fun baz(v:(() -> Unit)) { v() } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box -// test1.kt:3 box -// test1.kt:4 box +// test1.kt:10 box +// test1.kt:11 box // test.kt:4 box -// test3.kt:3 baz -// LINENUMBERS JVM_IR -// test1.kt:4 invoke -// test3.kt:3 baz -// LINENUMBERS -// test3.kt:4 baz +// test3.kt:14 baz +// EXPECTATIONS JVM_IR +// test1.kt:11 invoke +// test3.kt:14 baz +// EXPECTATIONS +// test3.kt:15 baz // test.kt:5 box -// test1.kt:3 box -// test1.kt:4 box +// test1.kt:10 box +// test1.kt:11 box // test.kt:5 box // test.kt:6 box -// LINENUMBERS JVM_IR -// test3.kt:3 baz -// test1.kt:4 invoke -// LINENUMBERS -// test3.kt:3 baz -// test3.kt:4 baz -// test.kt:7 box \ No newline at end of file +// EXPECTATIONS JVM_IR +// test3.kt:14 baz +// test1.kt:11 invoke +// EXPECTATIONS +// test3.kt:14 baz +// test3.kt:15 baz +// test.kt:7 box diff --git a/compiler/testData/debug/stepping/lambdaStepInline.kt b/compiler/testData/debug/stepping/lambdaStepInline.kt index eedc140473e..eaa72c1058e 100644 --- a/compiler/testData/debug/stepping/lambdaStepInline.kt +++ b/compiler/testData/debug/stepping/lambdaStepInline.kt @@ -13,7 +13,7 @@ fun box(): String { return "OK" } -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:4 box // test.kt:8 box diff --git a/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt b/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt index 46589cb105a..adfe6fad1c8 100644 --- a/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt +++ b/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt @@ -17,7 +17,7 @@ fun box(): String { return "OK" } -// LINENUMBERS +// EXPECTATIONS // test.kt:15 box // test.kt:3 box // test.kt:4 box diff --git a/compiler/testData/debug/stepping/lineNumberAfterInline.kt b/compiler/testData/debug/stepping/lineNumberAfterInline.kt index a7785b7fdc6..e2a546623f7 100644 --- a/compiler/testData/debug/stepping/lineNumberAfterInline.kt +++ b/compiler/testData/debug/stepping/lineNumberAfterInline.kt @@ -23,7 +23,7 @@ fun box() { test2() } -// LINENUMBERS +// EXPECTATIONS // test.kt:22 box // test.kt:12 test1 // test.kt:8 test1 diff --git a/compiler/testData/debug/stepping/linenumberForOneParametersArgumentCall.kt b/compiler/testData/debug/stepping/linenumberForOneParametersArgumentCall.kt index 836e85d41d6..efedb3bb168 100644 --- a/compiler/testData/debug/stepping/linenumberForOneParametersArgumentCall.kt +++ b/compiler/testData/debug/stepping/linenumberForOneParametersArgumentCall.kt @@ -11,7 +11,7 @@ inline fun lookAtMe(f: (String) -> Unit) { f(a) } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:10 box // test.kt:11 box diff --git a/compiler/testData/debug/stepping/localFunction.kt b/compiler/testData/debug/stepping/localFunction.kt index be1f782dbc4..69c17b35a51 100644 --- a/compiler/testData/debug/stepping/localFunction.kt +++ b/compiler/testData/debug/stepping/localFunction.kt @@ -10,19 +10,19 @@ fun box() { "OK" } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 box -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:9 box -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:6 invoke // test.kt:7 invoke -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:6 box$bar // test.kt:7 box$bar -// LINENUMBERS +// EXPECTATIONS // test.kt:10 box // test.kt:11 box diff --git a/compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt b/compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt index 3d06594087a..7be976c26ad 100644 --- a/compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt +++ b/compiler/testData/debug/stepping/localFunctionWIthOnelineExpressionBody.kt @@ -8,18 +8,18 @@ fun box() { "OK" } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 box -// LINENUMBERS +// EXPECTATIONS // test.kt:6 box // test.kt:7 box -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 invoke -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:5 box$bar -// LINENUMBERS +// EXPECTATIONS // test.kt:7 box // test.kt:8 box // test.kt:9 box \ No newline at end of file diff --git a/compiler/testData/debug/stepping/multilineExpression.kt b/compiler/testData/debug/stepping/multilineExpression.kt index 704ee35d132..bd28d738478 100644 --- a/compiler/testData/debug/stepping/multilineExpression.kt +++ b/compiler/testData/debug/stepping/multilineExpression.kt @@ -11,12 +11,12 @@ fun test(a: Boolean, b: Boolean, c: Boolean): Boolean { && c } -// LINENUMBERS +// EXPECTATIONS // test.kt:5 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:9 test // test.kt:10 test -// LINENUMBERS +// EXPECTATIONS // test.kt:11 test // test.kt:9 test // test.kt:5 box diff --git a/compiler/testData/debug/stepping/multilineFunctionCall.kt b/compiler/testData/debug/stepping/multilineFunctionCall.kt index aa24edaeacb..119974ffc0f 100644 --- a/compiler/testData/debug/stepping/multilineFunctionCall.kt +++ b/compiler/testData/debug/stepping/multilineFunctionCall.kt @@ -9,7 +9,7 @@ fun box() { fun foo(i: Int) { } -// LINENUMBERS +// EXPECTATIONS // test.kt:5 box // test.kt:4 box // test.kt:10 foo diff --git a/compiler/testData/debug/stepping/multilineInfixCall.kt b/compiler/testData/debug/stepping/multilineInfixCall.kt index 5082e6cc538..e0c731e1bf9 100644 --- a/compiler/testData/debug/stepping/multilineInfixCall.kt +++ b/compiler/testData/debug/stepping/multilineInfixCall.kt @@ -8,7 +8,7 @@ fun box() { infix fun Int.foo(i: Int) { } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:5 box // test.kt:4 box diff --git a/compiler/testData/debug/stepping/namedCallableReference.kt b/compiler/testData/debug/stepping/namedCallableReference.kt index 3cd07a829c0..7662ec0cbbe 100644 --- a/compiler/testData/debug/stepping/namedCallableReference.kt +++ b/compiler/testData/debug/stepping/namedCallableReference.kt @@ -16,13 +16,13 @@ fun g() {} // for the invoke method bridged to. Therefore, the entry line number for invoke only shows // up for JVM_IR. -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:4 box // test.kt:8 f -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 invoke -// LINENUMBERS +// EXPECTATIONS // test.kt:11 g // test.kt:4 invoke // test.kt:8 f diff --git a/compiler/testData/debug/stepping/nestedInline.kt b/compiler/testData/debug/stepping/nestedInline.kt index 1fdcd891ec8..88054d01572 100644 --- a/compiler/testData/debug/stepping/nestedInline.kt +++ b/compiler/testData/debug/stepping/nestedInline.kt @@ -41,23 +41,23 @@ inline fun html(init: () -> Unit) { return init(init) } -// LINENUMBERS +// EXPECTATIONS // test.kt:19 box // test.kt:7 box // test.kt:9 box -// 1.kt:18 box -// 1.kt:6 box +// 1.kt:41 box +// 1.kt:29 box // test.kt:10 box -// 1.kt:14 box -// 1.kt:10 box -// 1.kt:11 box +// 1.kt:37 box +// 1.kt:33 box +// 1.kt:34 box // test.kt:11 box // test.kt:12 box -// 1.kt:12 box -// 1.kt:14 box +// 1.kt:35 box +// 1.kt:37 box // test.kt:13 box -// 1.kt:7 box -// 1.kt:18 box +// 1.kt:30 box +// 1.kt:41 box // test.kt:15 box // test.kt:19 box // test.kt:21 box diff --git a/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt b/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt index eae20a8bb9f..b76c5b7ba06 100644 --- a/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt +++ b/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt @@ -11,7 +11,7 @@ inline fun lookAtMe(f: () -> Int) { a + f() } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:10 box // test.kt:11 box diff --git a/compiler/testData/debug/stepping/primitiveNullChecks.kt b/compiler/testData/debug/stepping/primitiveNullChecks.kt index e7f7c8ab4e7..f8852d1b18f 100644 --- a/compiler/testData/debug/stepping/primitiveNullChecks.kt +++ b/compiler/testData/debug/stepping/primitiveNullChecks.kt @@ -6,7 +6,7 @@ fun box(): String { return "OK"!! } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:5 box // test.kt:6 box \ No newline at end of file diff --git a/compiler/testData/debug/stepping/propertyAccessor.kt b/compiler/testData/debug/stepping/propertyAccessor.kt index 6914076d35a..8b286241dde 100644 --- a/compiler/testData/debug/stepping/propertyAccessor.kt +++ b/compiler/testData/debug/stepping/propertyAccessor.kt @@ -11,7 +11,7 @@ fun box() { A().prop } -// LINENUMBERS +// EXPECTATIONS // test.kt:11 box // test.kt:3 // test.kt:11 box diff --git a/compiler/testData/debug/stepping/psvm.kt b/compiler/testData/debug/stepping/psvm.kt index 81488a57fab..0a6101f264e 100644 --- a/compiler/testData/debug/stepping/psvm.kt +++ b/compiler/testData/debug/stepping/psvm.kt @@ -8,7 +8,7 @@ fun box() { main(arrayOf("OK")) } -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:4 main // test.kt:5 main diff --git a/compiler/testData/debug/stepping/recursion.kt b/compiler/testData/debug/stepping/recursion.kt index 4508458f335..8a5ad7a9842 100644 --- a/compiler/testData/debug/stepping/recursion.kt +++ b/compiler/testData/debug/stepping/recursion.kt @@ -11,7 +11,7 @@ fun foo(n :Int ) : Int { return foo(n-1) * n } -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:4 box // test.kt:8 foo diff --git a/compiler/testData/debug/stepping/simpleDefaultArg.kt b/compiler/testData/debug/stepping/simpleDefaultArg.kt index fa966e8f1c7..712b80f2811 100644 --- a/compiler/testData/debug/stepping/simpleDefaultArg.kt +++ b/compiler/testData/debug/stepping/simpleDefaultArg.kt @@ -9,7 +9,7 @@ fun box(): String { } // FORCE_STEP_INTO -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:3 ifoo$default (synthetic) // test.kt:4 ifoo diff --git a/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt b/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt index 6dde09d857e..a599b04f45b 100644 --- a/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt +++ b/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt @@ -14,7 +14,7 @@ fun box(): String { } // FORCE_STEP_INTO -// LINENUMBERS +// EXPECTATIONS // test.kt:12 box // test.kt:3 box // test.kt:4 box diff --git a/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt b/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt index e9910dae5f1..e2205e314b3 100644 --- a/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt +++ b/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt @@ -27,12 +27,12 @@ fun box(): String { // for the inline function are only used for instructions covered by // the `$i$f$alsoInline` variable life time. -// LINENUMBERS +// EXPECTATIONS // test.kt:10 box // test.kt:5 box // test.kt:3 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:5 box -// LINENUMBERS +// EXPECTATIONS // test.kt:6 box // test.kt:10 box \ No newline at end of file diff --git a/compiler/testData/debug/stepping/simpleSmap.kt b/compiler/testData/debug/stepping/simpleSmap.kt index d97fd77823d..ff9ba8e39f6 100644 --- a/compiler/testData/debug/stepping/simpleSmap.kt +++ b/compiler/testData/debug/stepping/simpleSmap.kt @@ -10,7 +10,7 @@ fun box() { } } -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:4 box // test.kt:9 box diff --git a/compiler/testData/debug/stepping/smapInlineAsArgument.kt b/compiler/testData/debug/stepping/smapInlineAsArgument.kt index 7be09f2b2ce..fe27def88be 100644 --- a/compiler/testData/debug/stepping/smapInlineAsArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineAsArgument.kt @@ -20,7 +20,7 @@ fun fail() : String { return "fail" } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:16 box // test.kt:5 box diff --git a/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt b/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt index 14df7384dc0..d4deb7efeba 100644 --- a/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt @@ -18,7 +18,7 @@ fun fail() : String { return "fail" } -// LINENUMBERS +// EXPECTATIONS // test.kt:6 box // test.kt:14 box // test.kt:7 box diff --git a/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt b/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt index 07da14e9b4b..3eb13c7841a 100644 --- a/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt @@ -20,7 +20,7 @@ fun fail() : String { return "fail" } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:16 box // test.kt:5 box diff --git a/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt b/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt index 71e4fd7e33c..b0ee8b5f18f 100644 --- a/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt @@ -1,5 +1,5 @@ +// IGNORE_BACKEND: JVM // FILE: test.kt - fun box(){ test() + fail() @@ -16,14 +16,12 @@ fun fail() : String { return "fail" } -// IGNORE_BACKEND: JVM - // The JVM backend does not go back to line 4 and 7 for the // addition. Instead it treats the addition of the evaluated // arguments as being on line 5 and 8. That seems incorrect // and the JVM_IR stepping is more correct. -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:12 box // test.kt:4 box @@ -36,4 +34,4 @@ fun fail() : String { // test.kt:8 box // test.kt:12 box // test.kt:7 box -// test.kt:9 box \ No newline at end of file +// test.kt:9 box diff --git a/compiler/testData/debug/stepping/stringSwitches.kt b/compiler/testData/debug/stepping/stringSwitches.kt index edbb32e6c0f..4a0d35760a3 100644 --- a/compiler/testData/debug/stepping/stringSwitches.kt +++ b/compiler/testData/debug/stepping/stringSwitches.kt @@ -41,7 +41,7 @@ fun box() { // does not. So on JVM there are steps on each condition evaluation for // the first `when`. -// LINENUMBERS +// EXPECTATIONS // test.kt:29 box // test.kt:4 stringSwitch // test.kt:5 stringSwitch @@ -50,63 +50,63 @@ fun box() { // test.kt:12 stringSwitch // test.kt:11 stringSwitch // test.kt:19 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:18 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:21 stringSwitch // test.kt:18 stringSwitch // test.kt:26 stringSwitch // test.kt:30 box // test.kt:4 stringSwitch -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:6 stringSwitch // test.kt:4 stringSwitch // test.kt:11 stringSwitch // test.kt:13 stringSwitch // test.kt:11 stringSwitch // test.kt:19 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:18 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:22 stringSwitch // test.kt:18 stringSwitch // test.kt:26 stringSwitch // test.kt:31 box // test.kt:4 stringSwitch -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 stringSwitch // test.kt:6 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:7 stringSwitch // test.kt:4 stringSwitch // test.kt:11 stringSwitch // test.kt:14 stringSwitch // test.kt:11 stringSwitch // test.kt:19 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:18 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:23 stringSwitch // test.kt:18 stringSwitch // test.kt:26 stringSwitch // test.kt:32 box // test.kt:4 stringSwitch -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 stringSwitch // test.kt:6 stringSwitch // test.kt:7 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:8 stringSwitch // test.kt:4 stringSwitch // test.kt:11 stringSwitch // test.kt:15 stringSwitch // test.kt:11 stringSwitch // test.kt:19 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:18 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:24 stringSwitch // test.kt:18 stringSwitch // test.kt:26 stringSwitch diff --git a/compiler/testData/debug/stepping/stringSwitchesSmall.kt b/compiler/testData/debug/stepping/stringSwitchesSmall.kt index 9ce227760d4..826a2427591 100644 --- a/compiler/testData/debug/stepping/stringSwitchesSmall.kt +++ b/compiler/testData/debug/stepping/stringSwitchesSmall.kt @@ -37,7 +37,7 @@ fun box() { // does not. So on JVM there are direct jumps to the right branch for the // last two whens. -// LINENUMBERS +// EXPECTATIONS // test.kt:26 box // test.kt:4 stringSwitch // test.kt:5 stringSwitch @@ -46,9 +46,9 @@ fun box() { // test.kt:11 stringSwitch // test.kt:10 stringSwitch // test.kt:17 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:16 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:19 stringSwitch // test.kt:16 stringSwitch // test.kt:23 stringSwitch @@ -58,16 +58,16 @@ fun box() { // test.kt:6 stringSwitch // test.kt:4 stringSwitch // test.kt:10 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:11 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:12 stringSwitch // test.kt:10 stringSwitch // test.kt:17 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:16 stringSwitch // test.kt:19 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:20 stringSwitch // test.kt:16 stringSwitch // test.kt:23 stringSwitch @@ -78,18 +78,18 @@ fun box() { // test.kt:7 stringSwitch // test.kt:4 stringSwitch // test.kt:10 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:11 stringSwitch // test.kt:12 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:13 stringSwitch // test.kt:10 stringSwitch // test.kt:17 stringSwitch -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:16 stringSwitch // test.kt:19 stringSwitch // test.kt:20 stringSwitch -// LINENUMBERS +// EXPECTATIONS // test.kt:21 stringSwitch // test.kt:16 stringSwitch // test.kt:23 stringSwitch diff --git a/compiler/testData/debug/stepping/suspendFunWithLambdaParameter.kt b/compiler/testData/debug/stepping/suspendFunWithLambdaParameter.kt index 2bad5f79a4c..92575048698 100644 --- a/compiler/testData/debug/stepping/suspendFunWithLambdaParameter.kt +++ b/compiler/testData/debug/stepping/suspendFunWithLambdaParameter.kt @@ -1,4 +1,4 @@ -// WITH_COROUTINES +// WITH_RUNTIME // FILE: test.kt suspend fun foo(block: Long.() -> String): String { return 1L.block() @@ -10,7 +10,7 @@ suspend fun box() { } } -// LINENUMBERS +// EXPECTATIONS // test.kt:8 box // test.kt:4 foo // test.kt:9 invoke diff --git a/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt b/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt index b6f346e9256..87fc93b1407 100644 --- a/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt +++ b/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt @@ -1,4 +1,4 @@ -// WITH_COROUTINES +// WITH_RUNTIME // FILE: test.kt suspend fun foo(block: suspend Long.() -> String): String { return 1L.block() @@ -10,15 +10,13 @@ suspend fun box() { } } -// LINENUMBERS +// This is the actual unfortunate stepping behavior in intellij. +// There is a class exclusion filter for anything in the kotlin package. +// That means that we never step into the lambda as that is only +// called via code in the kotlin package. + +// EXPECTATIONS // test.kt:8 box // test.kt:4 foo -// test.kt:-1 -// test.kt:-1 create -// test.kt:-1 invoke -// test.kt:8 invokeSuspend -// test.kt:9 invokeSuspend -// test.kt:-1 invoke -// test.kt:4 foo // test.kt:8 box -// test.kt:11 box \ No newline at end of file +// test.kt:11 box diff --git a/compiler/testData/debug/stepping/throwException.kt b/compiler/testData/debug/stepping/throwException.kt index cbae08767b2..674488201d5 100644 --- a/compiler/testData/debug/stepping/throwException.kt +++ b/compiler/testData/debug/stepping/throwException.kt @@ -14,7 +14,7 @@ fun throwIfLess(a: Int, b: Int) { if (a // test.kt:14 box diff --git a/compiler/testData/debug/stepping/tryCatch.kt b/compiler/testData/debug/stepping/tryCatch.kt index 2d2e6ee7c36..95eef1ffe50 100644 --- a/compiler/testData/debug/stepping/tryCatch.kt +++ b/compiler/testData/debug/stepping/tryCatch.kt @@ -14,7 +14,7 @@ fun box() { foo(true) } -// LINENUMBERS +// EXPECTATIONS // test.kt:13 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/tryCatchExpression.kt b/compiler/testData/debug/stepping/tryCatchExpression.kt index ef39533b0f2..36cc43f76dc 100644 --- a/compiler/testData/debug/stepping/tryCatchExpression.kt +++ b/compiler/testData/debug/stepping/tryCatchExpression.kt @@ -47,7 +47,7 @@ fun box() { foo() } -// LINENUMBERS +// EXPECTATIONS // test.kt:41 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/tryCatchFinally.kt b/compiler/testData/debug/stepping/tryCatchFinally.kt index f71591017df..6d481693b35 100644 --- a/compiler/testData/debug/stepping/tryCatchFinally.kt +++ b/compiler/testData/debug/stepping/tryCatchFinally.kt @@ -37,7 +37,7 @@ fun box() { foo() } -// LINENUMBERS +// EXPECTATIONS // test.kt:33 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/tryFinally.kt b/compiler/testData/debug/stepping/tryFinally.kt index 97a036d60f0..0a5b5a00e56 100644 --- a/compiler/testData/debug/stepping/tryFinally.kt +++ b/compiler/testData/debug/stepping/tryFinally.kt @@ -39,7 +39,7 @@ fun box() { // JVM_IR behavior is consistent with what happens for the // try-finally where the value is discarded which seems good. -// LINENUMBERS +// EXPECTATIONS // test.kt:29 box // test.kt:4 foo // test.kt:5 foo @@ -51,9 +51,9 @@ fun box() { // test.kt:11 foo // test.kt:25 mightThrow2 // test.kt:26 mightThrow2 -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:11 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:13 foo // test.kt:14 foo // test.kt:10 foo @@ -69,9 +69,9 @@ fun box() { // test.kt:10 foo // test.kt:11 foo // test.kt:25 mightThrow2 -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:14 foo // test.kt:10 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo // test.kt:13 foo diff --git a/compiler/testData/debug/stepping/variablesWithoutInitializer.kt b/compiler/testData/debug/stepping/variablesWithoutInitializer.kt index 407a6ef17d4..ee9c636ff79 100644 --- a/compiler/testData/debug/stepping/variablesWithoutInitializer.kt +++ b/compiler/testData/debug/stepping/variablesWithoutInitializer.kt @@ -16,12 +16,12 @@ fun box() { // those does not seem useful. This is consistent with javac behavior // as well. The JVM backend does generate these line numbers. -// LINENUMBERS -// LINENUMBERS JVM +// EXPECTATIONS +// EXPECTATIONS JVM // test.kt:4 box // test.kt:5 box // test.kt:6 box -// LINENUMBERS +// EXPECTATIONS // test.kt:7 box // test.kt:8 box // test.kt:9 box diff --git a/compiler/testData/debug/stepping/voidLambdaStepInline.kt b/compiler/testData/debug/stepping/voidLambdaStepInline.kt index f6486a44256..7fb8b487415 100644 --- a/compiler/testData/debug/stepping/voidLambdaStepInline.kt +++ b/compiler/testData/debug/stepping/voidLambdaStepInline.kt @@ -8,7 +8,7 @@ fun box(): String { return "OK" } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // fake.kt:1 box // test.kt:4 box diff --git a/compiler/testData/debug/stepping/when.kt b/compiler/testData/debug/stepping/when.kt index 1c2c94557ed..2ebec71b595 100644 --- a/compiler/testData/debug/stepping/when.kt +++ b/compiler/testData/debug/stepping/when.kt @@ -23,46 +23,46 @@ fun box() { // of each of the conditions, but goes directly to the right body. The // JVM_IR stepping behavior here is the same as for `whenSubject.kt`. -// LINENUMBERS +// EXPECTATIONS // test.kt:18 box // test.kt:4 foo // test.kt:5 foo // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:6 foo // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo // test.kt:6 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:7 foo // test.kt:10 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:11 foo // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:13 foo // test.kt:10 foo // test.kt:15 foo // test.kt:6 foo // test.kt:10 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:11 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:12 foo // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo // test.kt:6 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:7 foo // test.kt:10 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:11 foo // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:13 foo // test.kt:10 foo // test.kt:15 foo @@ -73,41 +73,41 @@ fun box() { // test.kt:10 foo // test.kt:11 foo // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:6 foo // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo // test.kt:6 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:7 foo // test.kt:10 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:11 foo // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:13 foo // test.kt:10 foo // test.kt:15 foo // test.kt:6 foo // test.kt:10 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:11 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:12 foo // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo // test.kt:6 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:7 foo // test.kt:10 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:11 foo // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:13 foo // test.kt:10 foo // test.kt:15 foo diff --git a/compiler/testData/debug/stepping/whenComplicatedSubject.kt b/compiler/testData/debug/stepping/whenComplicatedSubject.kt index 912b177be15..4944aafae95 100644 --- a/compiler/testData/debug/stepping/whenComplicatedSubject.kt +++ b/compiler/testData/debug/stepping/whenComplicatedSubject.kt @@ -21,7 +21,7 @@ fun box() { // The JVM_IR backend optimizes the inner when to a switch and therefore goes directly to the // right case without stepping through evaluation of each condition. -// LINENUMBERS +// EXPECTATIONS // test.kt:16 box // test.kt:5 foo // test.kt:6 foo @@ -30,18 +30,18 @@ fun box() { // test.kt:13 foo // test.kt:17 box // test.kt:5 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:6 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:7 foo // test.kt:4 foo // test.kt:13 foo // test.kt:18 box // test.kt:5 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:6 foo // test.kt:7 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:8 foo // test.kt:4 foo // test.kt:10 foo diff --git a/compiler/testData/debug/stepping/whenConstant.kt b/compiler/testData/debug/stepping/whenConstant.kt index f508da70f08..36f0d05d8a7 100644 --- a/compiler/testData/debug/stepping/whenConstant.kt +++ b/compiler/testData/debug/stepping/whenConstant.kt @@ -13,11 +13,11 @@ fun box() { // JVM_IR and JVM backends have different heuristics for when to use a switch. -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:5 box // test.kt:7 box -// LINENUMBERS +// EXPECTATIONS // test.kt:10 box // test.kt:12 box \ No newline at end of file diff --git a/compiler/testData/debug/stepping/whenIsChecks.kt b/compiler/testData/debug/stepping/whenIsChecks.kt index 180f8ea75c0..ade04c1122c 100644 --- a/compiler/testData/debug/stepping/whenIsChecks.kt +++ b/compiler/testData/debug/stepping/whenIsChecks.kt @@ -17,7 +17,7 @@ fun box() { foo(1) } -// LINENUMBERS +// EXPECTATIONS // test.kt:15 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/whenMultiLine.kt b/compiler/testData/debug/stepping/whenMultiLine.kt index bd792eb5b41..8bb0fccb64e 100644 --- a/compiler/testData/debug/stepping/whenMultiLine.kt +++ b/compiler/testData/debug/stepping/whenMultiLine.kt @@ -33,49 +33,49 @@ fun box() { // of each of the conditions, but goes directly to the right body. // JVM_IR stepping behavior here is the same as for `whenMultiLineSubject.kt`. -// LINENUMBERS +// EXPECTATIONS // test.kt:26 box // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:6 foo // test.kt:13 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:14 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:15 foo // test.kt:13 foo // test.kt:22 foo // test.kt:26 box // test.kt:27 box // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo // test.kt:7 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:8 foo // test.kt:13 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:14 foo // test.kt:16 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:17 foo // test.kt:13 foo // test.kt:22 foo // test.kt:27 box // test.kt:28 box // test.kt:4 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:5 foo // test.kt:7 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:10 foo // test.kt:13 foo -// LINENUMBERS JVM +// EXPECTATIONS JVM // test.kt:14 foo // test.kt:16 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:19 foo // test.kt:13 foo // test.kt:22 foo diff --git a/compiler/testData/debug/stepping/whenMultiLineSubject.kt b/compiler/testData/debug/stepping/whenMultiLineSubject.kt index d672f8a1b3f..81a9dd65491 100644 --- a/compiler/testData/debug/stepping/whenMultiLineSubject.kt +++ b/compiler/testData/debug/stepping/whenMultiLineSubject.kt @@ -28,7 +28,7 @@ fun box() { foo(63) } -// LINENUMBERS +// EXPECTATIONS // test.kt:26 box // test.kt:4 foo // test.kt:6 foo diff --git a/compiler/testData/debug/stepping/whenNullalbeSubject.kt b/compiler/testData/debug/stepping/whenNullalbeSubject.kt index d19cca0afa9..2d8813ed8f6 100644 --- a/compiler/testData/debug/stepping/whenNullalbeSubject.kt +++ b/compiler/testData/debug/stepping/whenNullalbeSubject.kt @@ -15,7 +15,7 @@ fun box() { } } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:5 box // test.kt:6 box diff --git a/compiler/testData/debug/stepping/whenSubject.kt b/compiler/testData/debug/stepping/whenSubject.kt index 972dfebee6e..2eb73e34025 100644 --- a/compiler/testData/debug/stepping/whenSubject.kt +++ b/compiler/testData/debug/stepping/whenSubject.kt @@ -18,7 +18,7 @@ fun box() { foo(21) } -// LINENUMBERS +// EXPECTATIONS // test.kt:18 box // test.kt:4 foo // test.kt:5 foo diff --git a/compiler/testData/debug/stepping/whenSubject2.kt b/compiler/testData/debug/stepping/whenSubject2.kt index d164d802564..c9bb8d1dfc8 100644 --- a/compiler/testData/debug/stepping/whenSubject2.kt +++ b/compiler/testData/debug/stepping/whenSubject2.kt @@ -26,45 +26,45 @@ fun box() { // it stops on the subject line first, then on the when line (line 4 and 12), and // then goes to the right branch. -// LINENUMBERS +// EXPECTATIONS // test.kt:22 box // test.kt:5 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:7 foo // test.kt:5 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:8 foo // test.kt:5 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:9 foo // test.kt:13 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:17 foo // test.kt:12 foo // test.kt:19 foo // test.kt:8 foo // test.kt:13 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:16 foo // test.kt:5 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:9 foo // test.kt:13 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:17 foo // test.kt:12 foo // test.kt:19 foo @@ -73,42 +73,42 @@ fun box() { // test.kt:19 foo // test.kt:7 foo // test.kt:13 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:15 foo // test.kt:5 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:8 foo // test.kt:5 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:9 foo // test.kt:13 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:17 foo // test.kt:12 foo // test.kt:19 foo // test.kt:8 foo // test.kt:13 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:16 foo // test.kt:5 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:4 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:9 foo // test.kt:13 foo -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:12 foo -// LINENUMBERS +// EXPECTATIONS // test.kt:17 foo // test.kt:12 foo // test.kt:19 foo diff --git a/compiler/testData/debug/stepping/whenWithInlineInCondition.kt b/compiler/testData/debug/stepping/whenWithInlineInCondition.kt index e57e77c07d9..aa3c32a0eb2 100644 --- a/compiler/testData/debug/stepping/whenWithInlineInCondition.kt +++ b/compiler/testData/debug/stepping/whenWithInlineInCondition.kt @@ -29,21 +29,21 @@ fun nop() {} // JVM_IR generates an additional line number for the end of the condition, which is necessary for the correct "step over" behavior. -// LINENUMBERS +// EXPECTATIONS // test.kt:3 box // test.kt:19 value // test.kt:3 box // test.kt:4 box // test.kt:5 box // test.kt:20 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:5 box -// LINENUMBERS +// EXPECTATIONS // test.kt:6 box // test.kt:21 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:6 box -// LINENUMBERS +// EXPECTATIONS // test.kt:7 box // test.kt:22 box // test.kt:7 box @@ -58,9 +58,9 @@ fun nop() {} // test.kt:20 box // test.kt:13 box // test.kt:26 box -// LINENUMBERS JVM_IR +// EXPECTATIONS JVM_IR // test.kt:13 box -// LINENUMBERS +// EXPECTATIONS // test.kt:14 box // test.kt:21 box // test.kt:14 box diff --git a/compiler/testData/debug/stepping/while.kt b/compiler/testData/debug/stepping/while.kt index bbf910d2705..4171f95e731 100644 --- a/compiler/testData/debug/stepping/while.kt +++ b/compiler/testData/debug/stepping/while.kt @@ -12,7 +12,7 @@ fun box() { } while (--x > 0) } -// LINENUMBERS +// EXPECTATIONS // test.kt:4 box // test.kt:5 box // test.kt:6 box diff --git a/compiler/tests-common-new/build.gradle.kts b/compiler/tests-common-new/build.gradle.kts index 15f19930cce..c40b6740f32 100644 --- a/compiler/tests-common-new/build.gradle.kts +++ b/compiler/tests-common-new/build.gradle.kts @@ -41,7 +41,8 @@ dependencies { rootProject = rootProject ) } - testRuntimeOnly(toolsJar()) + + testApi(toolsJar()) } val generationRoot = projectDir.resolve("tests-gen") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrLocalVariableTestGenerated.java similarity index 89% rename from compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java rename to compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrLocalVariableTestGenerated.java index 0122e8f0178..ed2f43c53bf 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrLocalVariableTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrLocalVariableTestGenerated.java @@ -3,30 +3,23 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.codegen.debugInformation; +package org.jetbrains.kotlin.test.runners.codegen; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.Test; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/debug/localVariables") @TestDataPath("$PROJECT_ROOT") -@RunWith(BlockJUnit4ClassRunner.class) public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - @Test public void testAllFilesPresentInLocalVariables() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); @@ -194,14 +187,10 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest { runTest("compiler/testData/debug/localVariables/underscoreNames.kt"); } + @Nested @TestMetadata("compiler/testData/debug/localVariables/receiverMangling") @TestDataPath("$PROJECT_ROOT") - @RunWith(BlockJUnit4ClassRunner.class) - public static class ReceiverMangling extends AbstractIrLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class ReceiverMangling { @Test public void testAllFilesPresentInReceiverMangling() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/receiverMangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); @@ -256,14 +245,10 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest { } } + @Nested @TestMetadata("compiler/testData/debug/localVariables/suspend") @TestDataPath("$PROJECT_ROOT") - @RunWith(BlockJUnit4ClassRunner.class) - public static class Suspend extends AbstractIrLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class Suspend { @Test public void testAllFilesPresentInSuspend() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); @@ -299,14 +284,10 @@ public class IrLocalVariableTestGenerated extends AbstractIrLocalVariableTest { runTest("compiler/testData/debug/localVariables/suspend/underscoreNames.kt"); } + @Nested @TestMetadata("compiler/testData/debug/localVariables/suspend/completion") @TestDataPath("$PROJECT_ROOT") - @RunWith(BlockJUnit4ClassRunner.class) - public static class Completion extends AbstractIrLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class Completion { @Test public void testAllFilesPresentInCompletion() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend/completion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSteppingTestGenerated.java similarity index 97% rename from compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java rename to compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSteppingTestGenerated.java index 1c15d6bcb3f..2bbb3aea0dd 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSteppingTestGenerated.java @@ -3,30 +3,23 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.codegen.debugInformation; +package org.jetbrains.kotlin.test.runners.codegen; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.Test; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/debug/stepping") @TestDataPath("$PROJECT_ROOT") -@RunWith(BlockJUnit4ClassRunner.class) public class IrSteppingTestGenerated extends AbstractIrSteppingTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - @Test public void testAllFilesPresentInStepping() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/stepping"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/LocalVariableTestGenerated.java similarity index 89% rename from compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java rename to compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/LocalVariableTestGenerated.java index 370ed0a21fb..b20d439a615 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/LocalVariableTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/LocalVariableTestGenerated.java @@ -3,30 +3,23 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.codegen.debugInformation; +package org.jetbrains.kotlin.test.runners.codegen; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.Test; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/debug/localVariables") @TestDataPath("$PROJECT_ROOT") -@RunWith(BlockJUnit4ClassRunner.class) public class LocalVariableTestGenerated extends AbstractLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); - } - @Test public void testAllFilesPresentInLocalVariables() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); @@ -194,14 +187,10 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest { runTest("compiler/testData/debug/localVariables/underscoreNames.kt"); } + @Nested @TestMetadata("compiler/testData/debug/localVariables/receiverMangling") @TestDataPath("$PROJECT_ROOT") - @RunWith(BlockJUnit4ClassRunner.class) - public static class ReceiverMangling extends AbstractLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); - } - + public class ReceiverMangling { @Test public void testAllFilesPresentInReceiverMangling() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/receiverMangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); @@ -256,14 +245,10 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest { } } + @Nested @TestMetadata("compiler/testData/debug/localVariables/suspend") @TestDataPath("$PROJECT_ROOT") - @RunWith(BlockJUnit4ClassRunner.class) - public static class Suspend extends AbstractLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); - } - + public class Suspend { @Test public void testAllFilesPresentInSuspend() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); @@ -299,14 +284,10 @@ public class LocalVariableTestGenerated extends AbstractLocalVariableTest { runTest("compiler/testData/debug/localVariables/suspend/underscoreNames.kt"); } + @Nested @TestMetadata("compiler/testData/debug/localVariables/suspend/completion") @TestDataPath("$PROJECT_ROOT") - @RunWith(BlockJUnit4ClassRunner.class) - public static class Completion extends AbstractLocalVariableTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); - } - + public class Completion { @Test public void testAllFilesPresentInCompletion() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend/completion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/SteppingTestGenerated.java similarity index 97% rename from compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java rename to compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/SteppingTestGenerated.java index d37cbfdcc80..adb08ec8d15 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/SteppingTestGenerated.java @@ -3,30 +3,23 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.codegen.debugInformation; +package org.jetbrains.kotlin.test.runners.codegen; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.Test; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/debug/stepping") @TestDataPath("$PROJECT_ROOT") -@RunWith(BlockJUnit4ClassRunner.class) public class SteppingTestGenerated extends AbstractSteppingTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); - } - @Test public void testAllFilesPresentInStepping() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/stepping"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/DebugRunner.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/DebugRunner.kt new file mode 100644 index 00000000000..6d7fcf661a9 --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/DebugRunner.kt @@ -0,0 +1,349 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.backend.handlers + +import com.sun.jdi.* +import com.sun.jdi.event.* +import com.sun.jdi.request.EventRequest.SUSPEND_ALL +import com.sun.jdi.request.StepRequest +import com.sun.tools.jdi.SocketAttachingConnector +import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.model.TestModule +import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEqualsToFile +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.sourceProviders.MainFunctionForBlackBoxTestsSourceProvider.Companion.BOX_MAIN_FILE_NAME +import java.io.File +import java.net.URL + +open class LoggedData(val line: Int, val isSynthetic: Boolean, val expectation: String) + +abstract class DebugRunner(testServices: TestServices) : JvmBoxRunner(testServices) { + + companion object { + const val EXPECTATIONS_MARKER = "// EXPECTATIONS" + const val FORCE_STEP_INTO_MARKER = "// FORCE_STEP_INTO" + const val JVM_EXPECTATIONS_MARKER = "$EXPECTATIONS_MARKER JVM" + const val JVM_IR_EXPECTATIONS_MARKER = "$EXPECTATIONS_MARKER JVM_IR" + + val BOX_MAIN_FILE_CLASS_NAME = BOX_MAIN_FILE_NAME.replace(".kt", "Kt") + } + + private var wholeFile = File("") + private var backend = TargetBackend.JVM + + abstract fun storeStep(loggedItems: ArrayList, event: Event) + + override fun launchSeparateJvmProcess( + javaExe: File, + module: TestModule, + classPath: List, + mainClassAndArguments: List + ): Process { + // Extract target backend and the full test file used to extract test expectations. + backend = module.targetBackend ?: backend + wholeFile = module.files.single { it.name == "test.kt" }.originalFile + + // Setup the java process to suspend waiting for debugging connection on a free port. + val command = listOfNotNull( + javaExe.absolutePath, + "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:0", + "-ea", + "-classpath", + classPath.joinToString(File.pathSeparator, transform = { File(it.toURI()).absolutePath }), + ) + mainClassAndArguments + + val process = ProcessBuilder(command).start() + + // Extract the chosen port from the output of the newly started java process. + // The java process prints a line with the format: + // + // Listening for transport dt_socket at address: + val port = process.inputStream.bufferedReader().readLine().split("address:").last().trim().toInt() + + // Attach debugger to the separate java process, setup initial event requests, + // and run the debugger loop to step through the program. + val virtualMachine = attachDebugger(port) + setupMethodEntryAndExitRequests(virtualMachine) + runDebugEventLoop(virtualMachine) + + return process + } + + // Debug event loop to step through a test program. + private fun runDebugEventLoop(virtualMachine: VirtualMachine) { + val manager = virtualMachine.eventRequestManager() + val loggedItems = ArrayList() + var inBoxMethod = false + vmLoop@ + while (true) { + val eventSet = virtualMachine.eventQueue().remove(1000) ?: continue + for (event in eventSet) { + when (event) { + is VMDeathEvent, is VMDisconnectEvent -> { + break@vmLoop + } + // We start VM with option 'suspend=n', in case VMStartEvent is still received, discard. + is VMStartEvent -> { + + } + is MethodEntryEvent -> { + if (!inBoxMethod && event.location().method().name() == "box") { + if (manager.stepRequests().isEmpty()) { + // Create line stepping request to get all normal line steps starting now. + val stepReq = manager.createStepRequest(event.thread(), StepRequest.STEP_LINE, StepRequest.STEP_INTO) + stepReq.setSuspendPolicy(SUSPEND_ALL) + stepReq.addClassExclusionFilter("java.*") + stepReq.addClassExclusionFilter("sun.*") + stepReq.addClassExclusionFilter("kotlin.*") + // Create class prepare request to be able to set breakpoints on class initializer lines. + // There are no line stepping events for class initializers, so we depend on breakpoints. + val prepareReq = manager.createClassPrepareRequest() + prepareReq.setSuspendPolicy(SUSPEND_ALL) + prepareReq.addClassExclusionFilter("java.*") + prepareReq.addClassExclusionFilter("sun.*") + prepareReq.addClassExclusionFilter("kotlin.*") + } + manager.stepRequests().map { it.enable() } + manager.classPrepareRequests().map { it.enable() } + inBoxMethod = true + storeStep(loggedItems, event) + } + } + is StepEvent -> { + if (inBoxMethod) { + // Handle the case where an Exception causing program to exit without MethodExitEvent. + if (event.location().method().name() == "main" && + event.location().declaringType().name().contains(BOX_MAIN_FILE_CLASS_NAME) + ) { + manager.stepRequests().map { it.disable() } + manager.classPrepareRequests().map { it.disable() } + manager.breakpointRequests().map { it.disable() } + break@vmLoop + } + storeStep(loggedItems, event) + } + } + is MethodExitEvent -> { + if (event.location().method().name() == "box") { + manager.stepRequests().map { it.disable() } + manager.classPrepareRequests().map { it.disable() } + manager.breakpointRequests().map { it.disable() } + break@vmLoop + } + } + is ClassPrepareEvent -> { + if (inBoxMethod) { + val initializer = event.referenceType().methods().find { it.isStaticInitializer } + try { + initializer?.allLineLocations()?.forEach { + manager.createBreakpointRequest(it).enable() + } + } catch (e: AbsentInformationException) { + // If there is no line information, do not set breakpoints. + } + } + } + is BreakpointEvent -> { + if (inBoxMethod) { + storeStep(loggedItems, event) + } + } + else -> { + throw IllegalStateException("event not handled: $event") + } + } + } + eventSet.resume() + } + checkResult(wholeFile, loggedItems) + virtualMachine.resume() + } + + fun Location.formatAsExpectation(): String { + val synthetic = if (method().isSynthetic) " (synthetic)" else "" + return "${sourceName()}:${lineNumber()} ${method().name()}$synthetic" + } + + fun checkResult(wholeFile: File, loggedItems: List) { + val actual = mutableListOf() + val lines = wholeFile.readLines() + val forceStepInto = lines.any { it.startsWith(FORCE_STEP_INTO_MARKER) } + + val actualLineNumbers = compressSequencesWithoutLinenumber(loggedItems) + .filter { + // Ignore synthetic code with no line number information unless force step into behavior is requested. + forceStepInto || !it.isSynthetic + } + .map { "// ${it.expectation}" } + val actualLineNumbersIterator = actualLineNumbers.iterator() + + val lineIterator = lines.iterator() + for (line in lineIterator) { + actual.add(line) + if (line.startsWith(EXPECTATIONS_MARKER) || line.startsWith(FORCE_STEP_INTO_MARKER)) break + } + + var currentBackend = TargetBackend.ANY + for (line in lineIterator) { + if (line.isEmpty()) { + actual.add(line) + continue + } + if (line.startsWith(EXPECTATIONS_MARKER)) { + actual.add(line) + currentBackend = when (line) { + EXPECTATIONS_MARKER -> TargetBackend.ANY + JVM_EXPECTATIONS_MARKER -> TargetBackend.JVM + JVM_IR_EXPECTATIONS_MARKER -> TargetBackend.JVM_IR + else -> error("Expected JVM backend: $line") + } + continue + } + if (currentBackend == TargetBackend.ANY || currentBackend == backend) { + if (actualLineNumbersIterator.hasNext()) { + actual.add(actualLineNumbersIterator.next()) + } + } else { + actual.add(line) + } + } + + actualLineNumbersIterator.forEach { actual.add(it) } + + assertEqualsToFile(wholeFile, actual.joinToString("\n")) + } + + // Compresses sequences of the same location without line number in the log: + // specifically removes locations without linenumber, that would otherwise + // print as byte offsets. This avoids overspecifying code generation + // strategy in debug tests. + fun compressSequencesWithoutLinenumber(loggedItems: List): List { + if (loggedItems.isEmpty()) return listOf() + + val logIterator = loggedItems.iterator() + var currentItem = logIterator.next() + val result = mutableListOf(currentItem) + + for (logItem in logIterator) { + if (currentItem.line != -1 || currentItem.expectation != logItem.expectation) { + result.add(logItem) + currentItem = logItem + } + } + + return result + } + + fun setupMethodEntryAndExitRequests(virtualMachine: VirtualMachine) { + val manager = virtualMachine.eventRequestManager() + + val methodEntryReq = manager.createMethodEntryRequest() + methodEntryReq.addClassFilter("TestKt") + methodEntryReq.setSuspendPolicy(SUSPEND_ALL) + methodEntryReq.enable() + + val methodExitReq = manager.createMethodExitRequest() + methodExitReq.addClassFilter("TestKt") + methodExitReq.setSuspendPolicy(SUSPEND_ALL) + methodExitReq.enable() + } + + private fun attachDebugger(port: Int): VirtualMachine { + val connector = SocketAttachingConnector() + val virtualMachine = connector.attach(connector.defaultArguments().toMutableMap().apply { + getValue("port").setValue("$port") + getValue("hostname").setValue("127.0.0.1") + }) + return virtualMachine + } + +} + +class SteppingDebugRunner(testServices: TestServices) : DebugRunner(testServices) { + override fun storeStep(loggedItems: ArrayList, event: Event) { + assert(event is LocatableEvent) + val location = (event as LocatableEvent).location() + loggedItems.add( + LoggedData( + location.lineNumber(), + location.method().isSynthetic, + location.formatAsExpectation() + ) + ) + } +} + +class LocalVariableDebugRunner(testServices: TestServices) : DebugRunner(testServices) { + interface LocalValue + + class LocalPrimitive(val value: String, val valueType: String) : LocalValue { + override fun toString(): String { + return "$value:$valueType" + } + } + + class LocalReference(val id: String, val referenceType: String) : LocalValue { + override fun toString(): String { + return referenceType + } + } + + class LocalNullValue : LocalValue { + override fun toString(): String { + return "null" + } + } + + class LocalVariableRecord( + val variable: String, + val variableType: String, + val value: LocalValue + ) { + override fun toString(): String { + return "$variable:$variableType=$value" + } + } + + private fun toRecord(frame: StackFrame, variable: LocalVariable): LocalVariableRecord { + val value = frame.getValue(variable) + val valueRecord = if (value == null) { + LocalNullValue() + } else if (value is ObjectReference && value.referenceType().name() != "java.lang.String") { + LocalReference(value.uniqueID().toString(), value.referenceType().name()) + } else { + LocalPrimitive(value.toString(), value.type().name()) + } + return LocalVariableRecord(variable.name(), variable.typeName(), valueRecord) + } + + private fun waitUntil(condition: () -> Boolean) { + while (!condition()) { + Thread.sleep(10) + } + } + + override fun storeStep(loggedItems: ArrayList, event: Event) { + val locatableEvent = event as LocatableEvent + waitUntil { locatableEvent.thread().isSuspended } + val location = locatableEvent.location() + if (location.method().isSynthetic) return + + val frame = locatableEvent.thread().frame(0) + val visibleVars = try { + frame.visibleVariables().map { variable -> toRecord(frame, variable) } + } catch (e: AbsentInformationException) { + // Local variable table completely absent - not distinguished from an empty table. + listOf() + } + loggedItems.add( + LoggedData( + location.lineNumber(), + false, + "${location.formatAsExpectation()}: ${visibleVars.joinToString(", ")}".trim() + ) + ) + } +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt index ca7918b726f..221adc96180 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt @@ -41,7 +41,7 @@ import java.net.URL import java.net.URLClassLoader import java.util.concurrent.TimeUnit -class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) { +open class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) { companion object { private val BOX_IN_SEPARATE_PROCESS_PORT = System.getProperty("kotlin.test.box.in.separate.process.port") } @@ -208,16 +208,7 @@ class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testSe listOf(mainFqName) } - val command = listOfNotNull( - javaExe.absolutePath, - runIf(ATTACH_DEBUGGER in module.directives) { "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" }, - "-ea", - runIf(ENABLE_JVM_PREVIEW in module.directives) { "--enable-preview" }, - "-classpath", - classPath.joinToString(File.pathSeparator, transform = { File(it.toURI()).absolutePath }), - ) + mainClassAndArguments - - val process = ProcessBuilder(command).start() + val process = launchSeparateJvmProcess(javaExe, module, classPath, mainClassAndArguments) process.waitFor(1, TimeUnit.MINUTES) return try { when (process.exitValue()) { @@ -237,6 +228,24 @@ class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testSe } } + protected open fun launchSeparateJvmProcess( + javaExe: File, + module: TestModule, + classPath: List, + mainClassAndArguments: List + ): Process { + val command = listOfNotNull( + javaExe.absolutePath, + runIf(ATTACH_DEBUGGER in module.directives) { "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" }, + "-ea", + runIf(ENABLE_JVM_PREVIEW in module.directives) { "--enable-preview" }, + "-classpath", + classPath.joinToString(File.pathSeparator, transform = { File(it.toURI()).absolutePath }), + ) + mainClassAndArguments + + return ProcessBuilder(command).start() + } + private fun invokeBoxInSeparateProcess( module: TestModule, classFileFactory: ClassFileFactory, diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTest.kt new file mode 100644 index 00000000000..8162835f3ca --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTest.kt @@ -0,0 +1,58 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.runners.codegen + +import org.jetbrains.kotlin.test.Constructor +import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.backend.classic.ClassicBackendInput +import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade +import org.jetbrains.kotlin.test.backend.ir.IrBackendInput +import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact +import org.jetbrains.kotlin.test.model.* + +open class AbstractIrLocalVariableTest : AbstractLocalVariableTestBase( + FrontendKinds.ClassicFrontend, + TargetBackend.JVM_IR +) { + override val frontendFacade: Constructor> + get() = ::ClassicFrontendFacade + + override val frontendToBackendConverter: Constructor> + get() = ::ClassicFrontend2IrConverter + + override val backendFacade: Constructor> + get() = ::JvmIrBackendFacade + + override fun configure(builder: TestConfigurationBuilder) { + super.configure(builder) + builder.configureDumpHandlersForCodegenTest() + } +} + +open class AbstractLocalVariableTest : AbstractLocalVariableTestBase( + FrontendKinds.ClassicFrontend, + TargetBackend.JVM +) { + + override val frontendFacade: Constructor> + get() = ::ClassicFrontendFacade + + override val frontendToBackendConverter: Constructor> + get() = ::ClassicFrontend2ClassicBackendConverter + + override val backendFacade: Constructor> + get() = ::ClassicJvmBackendFacade + + override fun configure(builder: TestConfigurationBuilder) { + super.configure(builder) + builder.configureDumpHandlersForCodegenTest() + } +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTestBase.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTestBase.kt new file mode 100644 index 00000000000..81a9d6fb6cf --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractLocalVariableTestBase.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.runners.codegen + +import org.jetbrains.kotlin.test.Constructor +import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.REQUIRES_SEPARATE_PROCESS +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO +import org.jetbrains.kotlin.test.model.* +import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest + +abstract class AbstractLocalVariableTestBase, I : ResultingArtifact.BackendInput>( + val targetFrontend: FrontendKind, + targetBackend: TargetBackend +) : AbstractKotlinCompilerWithTargetBackendTest(targetBackend) { + abstract val frontendFacade: Constructor> + abstract val frontendToBackendConverter: Constructor> + abstract val backendFacade: Constructor> + + override fun TestConfigurationBuilder.configuration() { + commonConfigurationForDebugTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade) + + configureCommonHandlersForLocalVariableTest() + + useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor) + + defaultDirectives { + +REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO + +REQUIRES_SEPARATE_PROCESS + } + + enableMetaInfoHandler() + } +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTest.kt new file mode 100644 index 00000000000..6d34e34230e --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTest.kt @@ -0,0 +1,58 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.runners.codegen + +import org.jetbrains.kotlin.test.Constructor +import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.backend.classic.ClassicBackendInput +import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade +import org.jetbrains.kotlin.test.backend.ir.IrBackendInput +import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact +import org.jetbrains.kotlin.test.model.* + +open class AbstractIrSteppingTest : AbstractSteppingTestBase( + FrontendKinds.ClassicFrontend, + TargetBackend.JVM_IR +) { + override val frontendFacade: Constructor> + get() = ::ClassicFrontendFacade + + override val frontendToBackendConverter: Constructor> + get() = ::ClassicFrontend2IrConverter + + override val backendFacade: Constructor> + get() = ::JvmIrBackendFacade + + override fun configure(builder: TestConfigurationBuilder) { + super.configure(builder) + builder.configureDumpHandlersForCodegenTest() + } +} + +open class AbstractSteppingTest : AbstractSteppingTestBase( + FrontendKinds.ClassicFrontend, + TargetBackend.JVM +) { + + override val frontendFacade: Constructor> + get() = ::ClassicFrontendFacade + + override val frontendToBackendConverter: Constructor> + get() = ::ClassicFrontend2ClassicBackendConverter + + override val backendFacade: Constructor> + get() = ::ClassicJvmBackendFacade + + override fun configure(builder: TestConfigurationBuilder) { + super.configure(builder) + builder.configureDumpHandlersForCodegenTest() + } +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTestBase.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTestBase.kt new file mode 100644 index 00000000000..bca2bb421b8 --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractSteppingTestBase.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.runners.codegen + +import org.jetbrains.kotlin.test.Constructor +import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.REQUIRES_SEPARATE_PROCESS +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO +import org.jetbrains.kotlin.test.model.* +import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest + +abstract class AbstractSteppingTestBase, I : ResultingArtifact.BackendInput>( + val targetFrontend: FrontendKind, + targetBackend: TargetBackend +) : AbstractKotlinCompilerWithTargetBackendTest(targetBackend) { + abstract val frontendFacade: Constructor> + abstract val frontendToBackendConverter: Constructor> + abstract val backendFacade: Constructor> + + override fun TestConfigurationBuilder.configuration() { + commonConfigurationForDebugTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade) + + configureCommonHandlersForSteppingTest() + + useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor) + + defaultDirectives { + +REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO + +REQUIRES_SEPARATE_PROCESS + } + + enableMetaInfoHandler() + } +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/BaseCodegenConfiguration.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/BaseCodegenConfiguration.kt index 30cd4d53c86..2d488911f22 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/BaseCodegenConfiguration.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/BaseCodegenConfiguration.kt @@ -19,18 +19,13 @@ import org.jetbrains.kotlin.test.model.* import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator import org.jetbrains.kotlin.test.services.configuration.ScriptingEnvironmentConfigurator -import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider -import org.jetbrains.kotlin.test.services.sourceProviders.CodegenHelpersSourceFilesProvider -import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider -import org.jetbrains.kotlin.test.services.sourceProviders.MainFunctionForBlackBoxTestsSourceProvider +import org.jetbrains.kotlin.test.services.sourceProviders.* -fun , B : ResultingArtifact.BackendInput> TestConfigurationBuilder.commonConfigurationForCodegenTest( - targetFrontend: FrontendKind, +fun , B : ResultingArtifact.BackendInput> TestConfigurationBuilder.commonConfigurationForCodegenAndDebugTest( frontendFacade: Constructor>, frontendToBackendConverter: Constructor>, backendFacade: Constructor>, ) { - commonServicesConfigurationForCodegenTest(targetFrontend) facadeStep(frontendFacade) classicFrontendHandlersStep() firHandlersStep() @@ -42,7 +37,27 @@ fun , B : ResultingArtifact.BackendInput ) } -fun TestConfigurationBuilder.commonServicesConfigurationForCodegenTest(targetFrontend: FrontendKind<*>) { +fun , B : ResultingArtifact.BackendInput> TestConfigurationBuilder.commonConfigurationForCodegenTest( + targetFrontend: FrontendKind, + frontendFacade: Constructor>, + frontendToBackendConverter: Constructor>, + backendFacade: Constructor>, +) { + commonServicesConfigurationForCodegenTest(targetFrontend) + commonConfigurationForCodegenAndDebugTest(frontendFacade, frontendToBackendConverter, backendFacade) +} + +fun , B : ResultingArtifact.BackendInput> TestConfigurationBuilder.commonConfigurationForDebugTest( + targetFrontend: FrontendKind, + frontendFacade: Constructor>, + frontendToBackendConverter: Constructor>, + backendFacade: Constructor>, +) { + commonServicesConfigurationForDebugTest(targetFrontend) + commonConfigurationForCodegenAndDebugTest(frontendFacade, frontendToBackendConverter, backendFacade) +} + +private fun TestConfigurationBuilder.commonServicesConfigurationForCodegenAndDebugTest(targetFrontend: FrontendKind<*>) { globalDefaults { frontend = targetFrontend targetPlatform = JvmPlatforms.defaultJvmPlatform @@ -62,8 +77,22 @@ fun TestConfigurationBuilder.commonServicesConfigurationForCodegenTest(targetFro useAdditionalSourceProviders( ::AdditionalDiagnosticsSourceFilesProvider, ::CoroutineHelpersSourceFilesProvider, - ::CodegenHelpersSourceFilesProvider, - ::MainFunctionForBlackBoxTestsSourceProvider, + ::CodegenHelpersSourceFilesProvider + ) +} + +fun TestConfigurationBuilder.commonServicesConfigurationForCodegenTest(targetFrontend: FrontendKind<*>) { + commonServicesConfigurationForCodegenAndDebugTest(targetFrontend) + useAdditionalSourceProviders( + ::MainFunctionForBlackBoxTestsSourceProvider + ) + +} + +fun TestConfigurationBuilder.commonServicesConfigurationForDebugTest(targetFrontend: FrontendKind<*>) { + commonServicesConfigurationForCodegenAndDebugTest(targetFrontend) + useAdditionalSourceProviders( + ::MainFunctionForDebugTestsSourceProvider ) } @@ -111,6 +140,20 @@ fun TestConfigurationBuilder.configureCommonHandlersForBoxTest() { } } +fun TestConfigurationBuilder.configureCommonHandlersForSteppingTest() { + commonHandlersForCodegenTest() + configureJvmArtifactsHandlersStep { + steppingHandlersForBackendStep() + } +} + +fun TestConfigurationBuilder.configureCommonHandlersForLocalVariableTest() { + commonHandlersForCodegenTest() + configureJvmArtifactsHandlersStep { + localVariableHandlersForBackendStep() + } +} + fun TestConfigurationBuilder.commonHandlersForCodegenTest() { configureClassicFrontendHandlersStep { commonClassicFrontendHandlersForCodegenTest() @@ -136,6 +179,14 @@ fun HandlersStepBuilder.boxHandlersForBackendStep() { useHandlers(::JvmBoxRunner) } +fun HandlersStepBuilder.steppingHandlersForBackendStep() { + useHandlers(::SteppingDebugRunner) +} + +fun HandlersStepBuilder.localVariableHandlersForBackendStep() { + useHandlers(::LocalVariableDebugRunner) +} + fun HandlersStepBuilder.commonClassicFrontendHandlersForCodegenTest() { useHandlers( ::NoCompilationErrorsHandler, diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForBlackBoxTestsSourceProvider.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForBlackBoxTestsSourceProvider.kt index f5ac4fcfd69..caeeba0c374 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForBlackBoxTestsSourceProvider.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForBlackBoxTestsSourceProvider.kt @@ -15,11 +15,13 @@ import org.jetbrains.kotlin.test.services.AdditionalSourceProvider import org.jetbrains.kotlin.test.services.TestServices import org.jetbrains.kotlin.test.services.temporaryDirectoryManager -class MainFunctionForBlackBoxTestsSourceProvider(testServices: TestServices) : AdditionalSourceProvider(testServices) { +open class MainFunctionForBlackBoxTestsSourceProvider(testServices: TestServices) : AdditionalSourceProvider(testServices) { companion object { private val PACKAGE_REGEXP = """package ([\w.]+)""".toRegex() private val START_BOX_METHOD_REGEX = """^fun box\(\)""".toRegex() private val MIDDLE_BOX_METHOD_REGEX = """\nfun box\(\)""".toRegex() + private val START_SUSPEND_BOX_METHOD_REGEX = """^suspend fun box\(\)""".toRegex() + private val MIDDLE_SUSPEND_BOX_METHOD_REGEX = """\nsuspend fun box\(\)""".toRegex() const val BOX_MAIN_FILE_NAME = "Generated_Box_Main.kt" @@ -31,9 +33,27 @@ class MainFunctionForBlackBoxTestsSourceProvider(testServices: TestServices) : A return containsBoxMethod(file.originalContent) } - fun containsBoxMethod(fileContent: String): Boolean { - return START_BOX_METHOD_REGEX.containsMatchIn(fileContent) || MIDDLE_BOX_METHOD_REGEX.containsMatchIn(fileContent) + fun containsSuspendBoxMethod(file: TestFile): Boolean { + return containsBoxMethod(file.originalContent) } + + fun containsBoxMethod(fileContent: String): Boolean { + return START_BOX_METHOD_REGEX.containsMatchIn(fileContent) || + MIDDLE_BOX_METHOD_REGEX.containsMatchIn(fileContent) || + containsSuspendBoxMethod(fileContent) + } + + fun containsSuspendBoxMethod(fileContent: String): Boolean { + return START_SUSPEND_BOX_METHOD_REGEX.containsMatchIn(fileContent) || + MIDDLE_SUSPEND_BOX_METHOD_REGEX.containsMatchIn(fileContent) + } + } + + protected open fun generateMainBody(): String { + return """ + val res = box() + if (res != "OK") throw AssertionError(res) + """.trimIndent() } override fun produceAdditionalFiles(globalDirectives: RegisteredDirectives, module: TestModule): List { @@ -42,6 +62,8 @@ class MainFunctionForBlackBoxTestsSourceProvider(testServices: TestServices) : A } val fileWithBox = module.files.firstOrNull { containsBoxMethod(it) } ?: return emptyList() + val suspendModifier = if (containsSuspendBoxMethod(fileWithBox)) "suspend " else "" + val mainBody = generateMainBody() val code = buildString { detectPackage(fileWithBox)?.let { @@ -49,9 +71,8 @@ class MainFunctionForBlackBoxTestsSourceProvider(testServices: TestServices) : A } appendLine( """ - fun main() { - val res = box() - if (res != "OK") throw AssertionError(res) + ${suspendModifier}fun main() { + $mainBody } """.trimIndent() ) diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForDebugTestsSourceProvider.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForDebugTestsSourceProvider.kt new file mode 100644 index 00000000000..7ee7c8ca5d7 --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/MainFunctionForDebugTestsSourceProvider.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.services.sourceProviders + +import org.jetbrains.kotlin.test.services.TestServices + +class MainFunctionForDebugTestsSourceProvider(testServices: TestServices) : MainFunctionForBlackBoxTestsSourceProvider(testServices) { + + // Debug tests sometimes throw exceptions that are uncaught to check the behavior + // of constructs such as try-finally. Therefore, the runner catches exceptions + // and ignores them. + override fun generateMainBody(): String { + return """ + try { + box() + } catch (t: Throwable) { + // Ignore. + } + """.trimIndent() + } +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt deleted file mode 100644 index 6d596b0dcfe..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractDebugTest.kt +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.codegen.debugInformation - -import com.intellij.openapi.util.SystemInfo -import com.intellij.util.PathUtil -import com.intellij.util.SystemProperties -import com.sun.jdi.AbsentInformationException -import com.sun.jdi.Location -import com.sun.jdi.VirtualMachine -import com.sun.jdi.event.* -import com.sun.jdi.request.EventRequest -import com.sun.jdi.request.EventRequest.SUSPEND_ALL -import com.sun.jdi.request.StepRequest -import com.sun.tools.jdi.SocketAttachingConnector -import org.jetbrains.kotlin.backend.common.output.SimpleOutputFileCollection -import org.jetbrains.kotlin.cli.common.output.writeAllTo -import org.jetbrains.kotlin.codegen.* -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.test.ConfigurationKind -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.clientserver.TestProcessServer -import org.jetbrains.kotlin.test.clientserver.TestProxy -import org.jetbrains.kotlin.test.clientserver.getGeneratedClass -import org.jetbrains.kotlin.test.util.KtTestUtil -import org.junit.After -import org.junit.Before -import java.io.File -import java.net.URLClassLoader -import kotlin.properties.Delegates - -data class ProcessAndPort(val process: Process, val port: Int) - -abstract class AbstractDebugTest : CodegenTestCase() { - - abstract val virtualMachine: VirtualMachine - abstract val proxyPort: Int - - companion object { - const val DEBUG_ADDRESS = "127.0.0.1" - const val MAIN_CLASS = "org.jetbrains.kotlin.test.clientserver.TestProcessServer" - const val TEST_CLASS = "TestKt" - const val BOX_METHOD = "box" - - fun setUpVM(virtualMachine: VirtualMachine) { - val manager = virtualMachine.eventRequestManager() - - val methodEntryReq = manager.createMethodEntryRequest() - methodEntryReq.addClassFilter(TEST_CLASS) - methodEntryReq.setSuspendPolicy(EventRequest.SUSPEND_ALL) - methodEntryReq.enable() - - val methodExitReq = manager.createMethodExitRequest() - methodExitReq.addClassFilter(TEST_CLASS) - methodExitReq.setSuspendPolicy(EventRequest.SUSPEND_ALL) - methodExitReq.enable() - } - - fun getProxyPort(process: Process): Int { - val reader = process.inputStream.bufferedReader() - reader.readLine() - val proxyPort = reader.readLine() - .split("port ") - .last() - .trim() - .toInt() - reader.close() - return proxyPort - } - - fun startDebuggeeProcess(): ProcessAndPort { - val classpath = listOf( - PathUtil.getJarPathForClass(TestProcessServer::class.java), - PathUtil.getJarPathForClass(Delegates::class.java) // Add Kotlin runtime JAR - ) - - val javaExecutablePath = findJavaExecutable().absolutePath - val command = arrayOf( - if (SystemInfo.isWindows) "\"$javaExecutablePath\"" else javaExecutablePath, - "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:0", - "-ea", - "-classpath", classpath.joinToString(File.pathSeparator), - MAIN_CLASS, - TestProcessServer.DEBUG_TEST - ) - - val process = ProcessBuilder(*command).start() - val port = process.inputStream.bufferedReader().readLine() - .split("address:") - .last() - .trim() - .toInt() - return ProcessAndPort(process, port) - } - - fun attachDebugger(port: Int): VirtualMachine { - val connector = SocketAttachingConnector() - return connector.attach(connector.defaultArguments().toMutableMap().apply { - getValue("port").setValue("$port") - getValue("hostname").setValue(DEBUG_ADDRESS) - }) - } - - fun findJavaExecutable(): File { - val javaBin = File(SystemProperties.getJavaHome(), "bin") - return File(javaBin, "java.exe").takeIf { it.exists() } - ?: File(javaBin, "java").also { assert(it.exists()) } - } - - val Location.isInDebugTestInfrastructure: Boolean - get() { - return this.sourcePath().startsWith("helpers" + File.separatorChar) - } - } - - @Before - public override fun setUp() { - super.setUp() - } - - @After - public override fun tearDown() { - super.tearDown() - } - - internal fun invokeBoxInSeparateProcess(classLoader: URLClassLoader, aClass: Class<*>, port: Int): String { - - val classPath = classLoader.extractUrls().toMutableList() - if (classLoader is GeneratedClassLoader) { - val outDir = KotlinTestUtils.tmpDirForTest(this) - val currentOutput = SimpleOutputFileCollection(classLoader.allGeneratedFiles) - currentOutput.writeAllTo(outDir) - classPath.add(0, outDir.toURI().toURL()) - } - - return TestProxy(Integer.valueOf(port), aClass.canonicalName, classPath).runTestNoOutput() - } - - internal fun createGeneratedClassLoader(classesDir: File): URLClassLoader { - return URLClassLoader( - listOf(classesDir.toURI().toURL()).toTypedArray(), - ForTestCompileRuntime.runtimeJarClassLoader() - ) - } - - override fun doMultiFileTest(wholeFile: File, files: List) { - createEnvironmentWithMockJdkAndIdeaAnnotations( - ConfigurationKind.ALL, *listOfNotNull( - writeJavaFiles( - files - ) - ).toTypedArray() - ) - - loadMultiFiles(files) - val classBuilderFactory = - OriginCollectingClassBuilderFactory(ClassBuilderMode.FULL) - val generationState = - GenerationUtils.compileFiles(myFiles.psiFiles, myEnvironment, classBuilderFactory) - classFileFactory = generationState.factory - - val tempDirForTest = KtTestUtil.tmpDir("debuggerTest") - val classesDir = File(tempDirForTest, "classes") - try { - classFileFactory.writeAllTo(classesDir) - doTest(wholeFile, classesDir) - } finally { - tempDirForTest.deleteRecursively() - } - } - - protected open fun doTest(wholeFile: File, classesDir: File) { - - val classLoader = createGeneratedClassLoader(classesDir) - val aClass = getGeneratedClass(classLoader, TEST_CLASS) - assert(aClass.declaredMethods.any { it.name == BOX_METHOD }) { - "Test method $BOX_METHOD not present on test class $TEST_CLASS" - } - if (virtualMachine.allThreads().any { it.isSuspended }) { - virtualMachine.resume() - } - invokeBoxInSeparateProcess(classLoader, aClass, proxyPort) - - val manager = virtualMachine.eventRequestManager() - - val loggedItems = ArrayList() - var inBoxMethod = false - vmLoop@ - while (true) { - val eventSet = virtualMachine.eventQueue().remove(1000) ?: continue - for (event in eventSet) { - when (event) { - is VMDeathEvent, is VMDisconnectEvent -> { - break@vmLoop - } - // We start VM with option 'suspend=n', in case VMStartEvent is still received, discard. - is VMStartEvent -> { - - } - is MethodEntryEvent -> { - if (!inBoxMethod && event.location().method().name() == BOX_METHOD) { - if (manager.stepRequests().isEmpty()) { - // Create line stepping request to get all normal line steps starting now. - val stepReq = manager.createStepRequest(event.thread(), StepRequest.STEP_LINE, StepRequest.STEP_INTO) - stepReq.setSuspendPolicy(SUSPEND_ALL) - stepReq.addClassExclusionFilter("java.*") - stepReq.addClassExclusionFilter("sun.*") - stepReq.addClassExclusionFilter("kotlin.*") - // Create class prepare request to be able to set breakpoints on class initializer lines. - // There are no line stepping events for class initializers, so we depend on breakpoints. - val prepareReq = manager.createClassPrepareRequest() - prepareReq.setSuspendPolicy(SUSPEND_ALL) - prepareReq.addClassExclusionFilter("java.*") - prepareReq.addClassExclusionFilter("sun.*") - prepareReq.addClassExclusionFilter("kotlin.*") - } - manager.stepRequests().map { it.enable() } - manager.classPrepareRequests().map { it.enable() } - inBoxMethod = true - storeStep(loggedItems, event) - } - } - is StepEvent -> { - // Handle the case where an Exception causing program to exit without MethodExitEvent. - if (inBoxMethod && event.location().method().name() == "run") { - manager.stepRequests().map { it.disable() } - manager.classPrepareRequests().map { it.disable() } - manager.breakpointRequests().map { it.disable() } - break@vmLoop - } - if (inBoxMethod) { - storeStep(loggedItems, event) - } - } - is MethodExitEvent -> { - if (event.location().method().name() == BOX_METHOD) { - manager.stepRequests().map { it.disable() } - manager.classPrepareRequests().map { it.disable() } - manager.breakpointRequests().map { it.disable() } - break@vmLoop - } - } - is ClassPrepareEvent -> { - if (inBoxMethod) { - val initializer = event.referenceType().methods().find { it.isStaticInitializer } - try { - initializer?.allLineLocations()?.forEach { - manager.createBreakpointRequest(it).enable() - } - } catch (e: AbsentInformationException) { - // If there is no line information, do not set breakpoints. - } - } - } - is BreakpointEvent -> { - if (inBoxMethod) { - storeStep(loggedItems, event) - } - } - else -> { - throw IllegalStateException("event not handled: $event") - } - } - } - eventSet.resume() - } - virtualMachine.resume() - checkResult(wholeFile, loggedItems) - } - - fun Location.formatAsExpectation(): String { - val synthetic = if (method().isSynthetic) " (synthetic)" else "" - return "${sourceName()}:${lineNumber()} ${method().name()}$synthetic" - } - - /* - Compresses runs of the same, linenumber-less location in the log: - specifically removes locations without linenumber, that would otherwise - print as byte offsets. This avoids overspecifying code generation - strategy in debug tests. - */ - fun compressRunsWithoutLinenumber(loggedItems: List, getLocation: (T) -> Location): List { - if (loggedItems.isEmpty()) return listOf() - - val logIterator = loggedItems.iterator() - var currentItem = logIterator.next() - val result = mutableListOf(currentItem) - - for (logItem in logIterator) { - if (getLocation(currentItem).lineNumber() != -1 || getLocation(currentItem).formatAsExpectation() != getLocation(logItem).formatAsExpectation()) { - result.add(logItem) - currentItem = logItem - } - } - - return result - } - - abstract fun storeStep(loggedItems: ArrayList, event: Event) - - abstract fun checkResult(wholeFile: File, loggedItems: List) -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrLocalVariableTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrLocalVariableTest.kt deleted file mode 100644 index f6a8ac33141..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrLocalVariableTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.codegen.debugInformation - -import org.jetbrains.kotlin.test.TargetBackend - -abstract class AbstractIrLocalVariableTest : AbstractLocalVariableTest() { - override val backend: TargetBackend - get() = TargetBackend.JVM_IR -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrSteppingTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrSteppingTest.kt deleted file mode 100644 index e7866403cc6..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractIrSteppingTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.codegen.debugInformation - -import org.jetbrains.kotlin.test.TargetBackend - -abstract class AbstractIrSteppingTest : AbstractSteppingTest() { - override val backend: TargetBackend - get() = TargetBackend.JVM_IR -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractLocalVariableTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractLocalVariableTest.kt deleted file mode 100644 index f94d6a4087f..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractLocalVariableTest.kt +++ /dev/null @@ -1,150 +0,0 @@ -package org.jetbrains.kotlin.codegen.debugInformation - -import com.sun.jdi.* -import com.sun.jdi.event.Event -import com.sun.jdi.event.LocatableEvent -import junit.framework.TestCase -import org.jetbrains.kotlin.test.TargetBackend -import org.junit.AfterClass -import org.junit.BeforeClass -import java.io.File - -abstract class AbstractLocalVariableTest : AbstractDebugTest() { - - override val virtualMachine: VirtualMachine = Companion.virtualMachine - override val proxyPort: Int = Companion.proxyPort - - interface LocalValue - - class LocalPrimitive(val value: String, val valueType: String) : LocalValue { - override fun toString(): String { - return "$value:$valueType" - } - } - - class LocalReference(val id: String, val referenceType: String) : LocalValue { - override fun toString(): String { - return "$referenceType" - } - } - - class LocalNullValue : LocalValue { - override fun toString(): String { - return "null" - } - } - - class LocalVariableRecord( - val variable: String, - val variableType: String, - val value: LocalValue - ) { - override fun toString(): String { - return "$variable:$variableType=$value" - } - } - - companion object { - const val LOCAL_VARIABLES_MARKER = "// LOCAL VARIABLES" - const val JVM_LOCAL_VARIABLES_MARKER = "$LOCAL_VARIABLES_MARKER JVM" - const val JVM_IR_LOCAL_VARIABLES_MARKER = "$LOCAL_VARIABLES_MARKER JVM_IR" - - const val LOCAL_VARIABLES = "// LOCAL VARIABLES" - var proxyPort = 0 - lateinit var process: Process - lateinit var virtualMachine: VirtualMachine - - @BeforeClass - @JvmStatic - fun setUpTest() { - val (process, port) = startDebuggeeProcess() - this.process = process - virtualMachine = attachDebugger(port) - setUpVM(virtualMachine) - - proxyPort = getProxyPort(process) - } - - @AfterClass - @JvmStatic - fun tearDownTest() { - process.destroy() - } - } - - data class LVTStep( - val location : Location, - val visibleVars: Collection - ) - - override fun storeStep(loggedItems: ArrayList, event: Event) { - val locatableEvent = event as LocatableEvent - waitUntil { locatableEvent.thread().isSuspended } - val location = locatableEvent.location() - if (location.isInDebugTestInfrastructure) return - if (location.method().isSynthetic) return - - val frame = locatableEvent.thread().frame(0) - val visibleVars = try { - frame.visibleVariables().map { variable -> toRecord(frame, variable) } - } catch (e: AbsentInformationException) { - // LVT Completely absent - not distinguished from an empty table - listOf() - } - loggedItems.add(LVTStep(location, visibleVars)) - } - - override fun checkResult(wholeFile: File, loggedItems: List) { - val lines = wholeFile.readLines() - - val expectedLocalVariables = mutableListOf() - val lineIterator = lines.iterator() - for (line in lineIterator) { - if (line.startsWith(LOCAL_VARIABLES_MARKER)) break - } - - var currentBackend = TargetBackend.ANY - for (line in lineIterator) { - if (line.trim() == "") continue - if (line.startsWith(LOCAL_VARIABLES_MARKER)) { - currentBackend = when (line) { - LOCAL_VARIABLES_MARKER -> TargetBackend.ANY - JVM_LOCAL_VARIABLES_MARKER -> TargetBackend.JVM - JVM_IR_LOCAL_VARIABLES_MARKER -> TargetBackend.JVM_IR - else -> error("Expected JVM backend: $line") - } - continue - } - if (currentBackend == TargetBackend.ANY || currentBackend == backend) { - expectedLocalVariables.add(line) - } - } - - @Suppress("UNCHECKED_CAST") - val compressedLog = compressRunsWithoutLinenumber(loggedItems as List, LVTStep::location) - - val actualLocalVariables = compressedLog.joinToString("\n") { - "// ${it.location.formatAsExpectation()}: ${it.visibleVars.joinToString(", ")}".trim() - } - - TestCase.assertEquals(expectedLocalVariables.joinToString("\n"), actualLocalVariables) - } - - private fun toRecord(frame: StackFrame, variable: LocalVariable): LocalVariableRecord { - val value = frame.getValue(variable) - val valueRecord = if (value == null) { - LocalNullValue() - } else if (value is ObjectReference && value.referenceType().name() != "java.lang.String") { - LocalReference(value.uniqueID().toString(), value.referenceType().name()) - } else { - LocalPrimitive(value.toString(), value.type().name()) - } - return LocalVariableRecord(variable.name(), variable.typeName(), valueRecord) - } - - private fun waitUntil(condition: () -> Boolean) { - while (!condition()) { - Thread.sleep(10) - } - } -} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractSteppingTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractSteppingTest.kt deleted file mode 100644 index de73810938a..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/debugInformation/AbstractSteppingTest.kt +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.codegen.debugInformation - -import com.sun.jdi.VirtualMachine -import com.sun.jdi.event.Event -import com.sun.jdi.event.LocatableEvent -import org.jetbrains.kotlin.test.KotlinTestUtils.assertEqualsToFile -import org.jetbrains.kotlin.test.TargetBackend -import org.junit.AfterClass -import org.junit.BeforeClass -import java.io.File - -abstract class AbstractSteppingTest : AbstractDebugTest() { - - override val virtualMachine: VirtualMachine = Companion.virtualMachine - override val proxyPort: Int = Companion.proxyPort - - companion object { - const val LINENUMBERS_MARKER = "// LINENUMBERS" - const val FORCE_STEP_INTO_MARKER = "// FORCE_STEP_INTO" - const val JVM_LINENUMBER_MARKER = "$LINENUMBERS_MARKER JVM" - const val JVM_IR_LINENUMBER_MARKER = "$LINENUMBERS_MARKER JVM_IR" - var proxyPort = 0 - lateinit var process: Process - lateinit var virtualMachine: VirtualMachine - - @BeforeClass - @JvmStatic - fun setUpTest() { - val (process, port) = startDebuggeeProcess() - this.process = process - virtualMachine = attachDebugger(port) - setUpVM(virtualMachine) - - proxyPort = getProxyPort(process) - } - - @AfterClass - @JvmStatic - fun tearDownTest() { - process.destroy() - } - } - - override fun storeStep(loggedItems: ArrayList, event: Event) { - assert(event is LocatableEvent) - loggedItems.add(event) - } - - override fun checkResult(wholeFile: File, loggedItems: List) { - val actual = mutableListOf() - val lines = wholeFile.readLines() - val forceStepInto = lines.any { it.startsWith(FORCE_STEP_INTO_MARKER) } - - @Suppress("UNCHECKED_CAST") - val actualLineNumbers = compressRunsWithoutLinenumber(loggedItems as List, LocatableEvent::location) - .filter { - val location = it.location() - // Ignore: - // - synthetic code with no line number information - // unless force step into behavior is requested. - // - helper code from the test infrastructure - (forceStepInto || !location.method().isSynthetic) && !location.isInDebugTestInfrastructure - } - .map { "// ${it.location().formatAsExpectation()}" } - val actualLineNumbersIterator = actualLineNumbers.iterator() - - val lineIterator = lines.iterator() - for (line in lineIterator) { - actual.add(line) - if (line.startsWith(LINENUMBERS_MARKER) || line.startsWith(FORCE_STEP_INTO_MARKER)) break - } - - var currentBackend = TargetBackend.ANY - for (line in lineIterator) { - if (line.startsWith(LINENUMBERS_MARKER)) { - actual.add(line) - currentBackend = when (line) { - LINENUMBERS_MARKER -> TargetBackend.ANY - JVM_LINENUMBER_MARKER -> TargetBackend.JVM - JVM_IR_LINENUMBER_MARKER -> TargetBackend.JVM_IR - else -> error("Expected JVM backend: $line") - } - continue - } - if (currentBackend == TargetBackend.ANY || currentBackend == backend) { - if (actualLineNumbersIterator.hasNext()) { - actual.add(actualLineNumbersIterator.next()) - } - } else { - actual.add(line) - } - } - - actualLineNumbersIterator.forEach { actual.add(it) } - - assertEqualsToFile(wholeFile, actual.joinToString("\n")) - } -} diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt index f84a43f0368..5bc52aafed6 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt @@ -12,10 +12,6 @@ import org.jetbrains.kotlin.cfg.AbstractPseudoValueTest import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTestWithJsStdLibAndBackendCompilation import org.jetbrains.kotlin.cli.AbstractCliTest import org.jetbrains.kotlin.codegen.* -import org.jetbrains.kotlin.codegen.debugInformation.AbstractIrLocalVariableTest -import org.jetbrains.kotlin.codegen.debugInformation.AbstractIrSteppingTest -import org.jetbrains.kotlin.codegen.debugInformation.AbstractLocalVariableTest -import org.jetbrains.kotlin.codegen.debugInformation.AbstractSteppingTest import org.jetbrains.kotlin.codegen.defaultConstructor.AbstractDefaultArgumentsReflectionTest import org.jetbrains.kotlin.codegen.flags.AbstractWriteFlagsTest import org.jetbrains.kotlin.codegen.ir.* @@ -289,14 +285,6 @@ fun generateJUnit3CompilerTests(args: Array) { model("type/binding") } - testClass(useJunit4 = true) { - model("debug/stepping", targetBackend = TargetBackend.JVM) - } - - testClass(useJunit4 = true) { - model("debug/localVariables", targetBackend = TargetBackend.JVM) - } - testClass { model("serialization/local") } @@ -395,14 +383,6 @@ fun generateJUnit3CompilerTests(args: Array) { model("loadJava/sourceJava", extension = "java", testMethod = "doTestSourceJava", targetBackend = TargetBackend.JVM_IR) } - testClass(useJunit4 = true) { - model("debug/stepping", targetBackend = TargetBackend.JVM_IR) - } - - testClass(useJunit4 = true) { - model("debug/localVariables", targetBackend = TargetBackend.JVM_IR) - } - testClass { model("codegen/script", extension = "kts", targetBackend = TargetBackend.JVM_IR) } diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt index 82d70b911fb..ce7122e1884 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt @@ -73,6 +73,22 @@ fun generateJUnit5CompilerTests(args: Array) { model("codegen/box") } + testClass { + model("debug/stepping") + } + + testClass { + model("debug/stepping") + } + + testClass { + model("debug/localVariables") + } + + testClass { + model("debug/localVariables") + } + testClass("BlackBoxModernJdkCodegenTestGenerated") { model("codegen/boxModernJdk") }