diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 3ef33855c63..fc5dabad893 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -855,7 +855,6 @@ class ExpressionCodegen( IrTypeOperator.INSTANCEOF -> { expression.argument.accept(this, data).materializeAt(context.irBuiltIns.anyNType) val type = typeMapper.boxType(typeOperand) - if (typeOperand.isReifiedTypeParameter) { putReifiedOperationMarkerIfTypeIsReifiedParameter(typeOperand, ReifiedTypeInliner.OperationKind.IS) v.instanceOf(type) diff --git a/compiler/testData/debug/stepping/constructors.kt b/compiler/testData/debug/stepping/constructors.kt new file mode 100644 index 00000000000..0cd55be3e75 --- /dev/null +++ b/compiler/testData/debug/stepping/constructors.kt @@ -0,0 +1,186 @@ +// FILE: test.kt + +fun box() { + B() + C(1) + D() + E(1) + F() + G(1) + J() + K(1) + L() + M() + N(1) + O(1) + O(1, "1") +} + +class B() +class C(val a: Int) +class D { + constructor() +} +class E { + constructor(i: Int) +} +class F { + constructor() { + val a = 1 + } +} +class G { + constructor(i: Int) { + val a = 1 + } +} +class J { + init { + val a = 1 + } +} +class K(val i: Int) { + init { + val a = 1 + } +} +class L { + constructor() { + val a = 1 + } + + init { + val a = 1 + } +} +class M { + constructor(): this(1) { + val a = 1 + } + + constructor(i: Int) { + } +} +class N { + constructor(i: Int): this() { + val a = 1 + } + + constructor() { + } +} +class O(i: T) { + constructor(i: Int, j: T): this(j) { + } +} + +// JVM_IR consistently steps through constructor start line, constructor body constructor end line. +// JVM does not. The JVM behavior is unfortunate for instance for the L class above. Stepping through +// construction on the JVM will give the sequence 49, 52, 53, 49 which makes it unclear if the assignment +// on line 49 was carried out before or after the assignment in the init block. The JVM_IR sequence is +// 48, 52, 53, 54, 49, 50 which makes the sequence clear. + +// In addition JVM_IR consistently steps on the init line and on the init end brace. The line numbers +// 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 +// test.kt:4 box +// test.kt:19 +// test.kt:4 box +// test.kt:5 box +// test.kt:20 +// test.kt:5 box +// test.kt:6 box +// test.kt:22 +// test.kt:6 box +// test.kt:7 box +// test.kt:25 +// test.kt:7 box +// test.kt:8 box +// LINENUMBERS JVM_IR +// test.kt:28 +// LINENUMBERS +// test.kt:29 +// LINENUMBERS JVM_IR +// test.kt:30 +// LINENUMBERS +// test.kt:8 box +// test.kt:9 box +// LINENUMBERS JVM_IR +// test.kt:33 +// LINENUMBERS +// test.kt:34 +// LINENUMBERS JVM_IR +// test.kt:35 +// LINENUMBERS +// test.kt:9 box +// test.kt:10 box +// test.kt:37 +// test.kt:38 +// test.kt:39 +// test.kt:40 +// LINENUMBERS JVM_IR +// test.kt:37 +// LINENUMBERS +// test.kt:10 box +// test.kt:11 box +// test.kt:42 +// test.kt:43 +// test.kt:44 +// test.kt:45 +// LINENUMBERS JVM_IR +// test.kt:42 +// LINENUMBERS +// test.kt:11 box +// test.kt:12 box +// LINENUMBERS JVM +// test.kt:49 +// LINENUMBERS JVM_IR +// test.kt:48 +// LINENUMBERS +// test.kt:52 +// test.kt:53 +// LINENUMBERS JVM_IR +// test.kt:54 +// LINENUMBERS +// test.kt:49 +// LINENUMBERS JVM_IR +// test.kt:50 +// LINENUMBERS +// test.kt:12 box +// test.kt:13 box +// test.kt:57 +// test.kt:61 +// LINENUMBERS JVM_IR +// test.kt:62 +// LINENUMBERS +// test.kt:58 +// LINENUMBERS JVM_IR +// test.kt:59 +// LINENUMBERS +// test.kt:13 box +// test.kt:14 box +// test.kt:65 +// test.kt:69 +// LINENUMBERS JVM_IR +// test.kt:70 +// LINENUMBERS +// test.kt:66 +// LINENUMBERS JVM_IR +// test.kt:67 +// LINENUMBERS +// test.kt:14 box +// test.kt:15 box +// test.kt:72 +// test.kt:15 box +// test.kt:16 box +// test.kt:73 +// test.kt:72 +// LINENUMBERS JVM +// test.kt:73 +// LINENUMBERS JVM_IR +// test.kt:74 +// LINENUMBERS +// test.kt:16 box +// test.kt:17 box \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java index 05c28f3de6c..1726ac8df2d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/IrSteppingTestGenerated.java @@ -103,6 +103,12 @@ public class IrSteppingTestGenerated extends AbstractIrSteppingTest { runTest("compiler/testData/debug/stepping/constructorCall.kt"); } + @Test + @TestMetadata("constructors.kt") + public void testConstructors() throws Exception { + runTest("compiler/testData/debug/stepping/constructors.kt"); + } + @Test @TestMetadata("defaultParameter.kt") public void testDefaultParameter() throws Exception { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java index ff9307c8026..1b625ae3d1c 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/debugInformation/SteppingTestGenerated.java @@ -103,6 +103,12 @@ public class SteppingTestGenerated extends AbstractSteppingTest { runTest("compiler/testData/debug/stepping/constructorCall.kt"); } + @Test + @TestMetadata("constructors.kt") + public void testConstructors() throws Exception { + runTest("compiler/testData/debug/stepping/constructors.kt"); + } + @Test @TestMetadata("defaultParameter.kt") public void testDefaultParameter() throws Exception { diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/KotlinOutputChecker.kt b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/KotlinOutputChecker.kt index a5da73e470f..9388c7f8ed8 100644 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/KotlinOutputChecker.kt +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/KotlinOutputChecker.kt @@ -59,6 +59,14 @@ internal class KotlinOutputChecker( val outDir = File(testDir) var outFile = File(outDir, "$myTestName.out") + + if (useIrBackend) { + val irBackendOutFile = File(outDir, "$myTestName.ir.out") + if (irBackendOutFile.exists()) { + outFile = irBackendOutFile + } + } + if (!outFile.exists()) { if (SystemInfo.isWindows) { val winOut = File(outDir, "$myTestName.win.out") diff --git a/idea/jvm-debugger/jvm-debugger-test/testData/stepping/custom/smartStepIntoConstructor.ir.out b/idea/jvm-debugger/jvm-debugger-test/testData/stepping/custom/smartStepIntoConstructor.ir.out new file mode 100644 index 00000000000..0629e33d02d --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-test/testData/stepping/custom/smartStepIntoConstructor.ir.out @@ -0,0 +1,44 @@ +LineBreakpoint created at smartStepIntoConstructor.kt:7 +LineBreakpoint created at smartStepIntoConstructor.kt:11 +LineBreakpoint created at smartStepIntoConstructor.kt:15 +LineBreakpoint created at smartStepIntoConstructor.kt:19 +LineBreakpoint created at smartStepIntoConstructor.kt:23 +LineBreakpoint created at smartStepIntoConstructor.kt:27 +LineBreakpoint created at smartStepIntoConstructor.kt:31 +LineBreakpoint created at smartStepIntoConstructor.kt:35 +LineBreakpoint created at smartStepIntoConstructor.kt:39 +LineBreakpoint created at smartStepIntoConstructor.kt:43 +LineBreakpoint created at smartStepIntoConstructor.kt:47 +LineBreakpoint created at smartStepIntoConstructor.kt:51 +LineBreakpoint created at smartStepIntoConstructor.kt:55 +Run Java +Connected to the target VM +smartStepIntoConstructor.kt:7 +smartStepIntoConstructor.kt:59 +smartStepIntoConstructor.kt:11 +smartStepIntoConstructor.kt:60 +smartStepIntoConstructor.kt:15 +smartStepIntoConstructor.kt:62 +smartStepIntoConstructor.kt:19 +smartStepIntoConstructor.kt:65 +smartStepIntoConstructor.kt:23 +smartStepIntoConstructor.kt:68 +smartStepIntoConstructor.kt:27 +smartStepIntoConstructor.kt:73 +smartStepIntoConstructor.kt:31 +smartStepIntoConstructor.kt:77 +smartStepIntoConstructor.kt:35 +smartStepIntoConstructor.kt:82 +smartStepIntoConstructor.kt:39 +smartStepIntoConstructor.kt:88 +smartStepIntoConstructor.kt:43 +smartStepIntoConstructor.kt:97 +smartStepIntoConstructor.kt:47 +smartStepIntoConstructor.kt:105 +smartStepIntoConstructor.kt:51 +smartStepIntoConstructor.kt:112 +smartStepIntoConstructor.kt:55 +smartStepIntoConstructor.kt:113 +Disconnected from the target VM + +Process finished with exit code 0 diff --git a/idea/jvm-debugger/jvm-debugger-test/testData/stepping/custom/smartStepIntoConstructor.out b/idea/jvm-debugger/jvm-debugger-test/testData/stepping/custom/smartStepIntoConstructor.out index 28df8f8c888..bcdac9ae9c1 100644 --- a/idea/jvm-debugger/jvm-debugger-test/testData/stepping/custom/smartStepIntoConstructor.out +++ b/idea/jvm-debugger/jvm-debugger-test/testData/stepping/custom/smartStepIntoConstructor.out @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR LineBreakpoint created at smartStepIntoConstructor.kt:7 LineBreakpoint created at smartStepIntoConstructor.kt:11 LineBreakpoint created at smartStepIntoConstructor.kt:15