diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index 4b287ac09da..ca4c873080f 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -3714,6 +3714,7 @@ The "returned" value of try expression with no finally is either the last expres private StackValue generateExpressionMatch(StackValue expressionToMatch, JetExpression patternExpression) { if (expressionToMatch != null) { Type subjectType = expressionToMatch.type; + markStartLineNumber(patternExpression); expressionToMatch.put(subjectType, v); JetType condJetType = bindingContext.get(EXPRESSION_TYPE, patternExpression); Type condType; @@ -3738,6 +3739,7 @@ The "returned" value of try expression with no finally is either the last expres private StackValue generateIsCheck(StackValue expressionToMatch, JetTypeReference typeReference, boolean negated) { JetType jetType = bindingContext.get(TYPE, typeReference); + markStartLineNumber(typeReference); generateInstanceOf(expressionToMatch, jetType, false); StackValue value = StackValue.onStack(Type.BOOLEAN_TYPE); return negated ? StackValue.not(value) : value; diff --git a/idea/testData/debugger/tinyApp/outs/whenExpr.out b/idea/testData/debugger/tinyApp/outs/whenExpr.out new file mode 100644 index 00000000000..81134f02c41 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/whenExpr.out @@ -0,0 +1,29 @@ +LineBreakpoint created at whenExpr.kt:5 +!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! whenExpr.WhenExprPackage +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +whenExpr.kt:5 +whenExpr.kt:6 +whenExpr.kt:7 +whenExpr.kt:10 +whenExpr.kt:14 +whenExpr.kt:17 +whenExpr.kt:19 +whenExpr.kt:20 +whenExpr.kt:21 +whenExpr.kt:24 +whenExpr.kt:28 +whenExpr.kt:31 +whenExpr.kt:33 +whenExpr.kt:34 +whenExpr.kt:35 +whenExpr.kt:38 +whenExpr.kt:39 +whenExpr.kt:45 +whenExpr.kt:47 +whenExpr.kt:48 +whenExpr.kt:49 +whenExpr.kt:50 +whenExpr.kt:59 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/stepInto/stepInto/whenExpr.kt b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/whenExpr.kt new file mode 100644 index 00000000000..7682e022656 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/whenExpr.kt @@ -0,0 +1,62 @@ +package whenExpr + +fun main(args: Array) { + //Breakpoint! + val a: Int? = 0 // 5 + when (a) { // 6 + 1 -> { // 7 + 1 + 1 + } + 2 -> { // 10 + 2 + 1 + } + else -> { + 0 + 0 // 14 + } + } + val b = 1 // 17 + + val a1: Number? = 0 // 19 + when (a1) { // 20 + is Float -> { // 21 + 1 + 1 + } + is Double -> { // 24 + 2 + 1 + } + else -> { + 0 + 0 // 28 + } + } + val b1 = 1 // 31 + + val a2: Int? = 2 // 33 + when (a2) { // 34 + 1 -> { // 35 + 1 + 1 + } + 2 -> { // 38 + 2 + 1 // 39 + } + else -> { + 0 + 0 + } + } + val b2 = 1 // 45 + + val a3: Number? = 0f // 47 + when (a3) { // 48 + is Float -> { // 49 + 1 + 1 // 50 + } + is Double -> { + 2 + 1 + } + else -> { + 0 + 0 + } + } + val b3 = 1 // 59 +} + +// STEP_INTO: 22 \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java index 810878d2d78..c5243c95c54 100644 --- a/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/debugger/KotlinSteppingTestGenerated.java @@ -224,6 +224,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/forLoop.kt"); doStepIntoTest(fileName); } + + @TestMetadata("whenExpr.kt") + public void testWhenExpr() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/whenExpr.kt"); + doStepIntoTest(fileName); + } } @TestMetadata("idea/testData/debugger/tinyApp/src/filters")