Debugger: fix stepping in when
This commit is contained in:
@@ -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) {
|
private StackValue generateExpressionMatch(StackValue expressionToMatch, JetExpression patternExpression) {
|
||||||
if (expressionToMatch != null) {
|
if (expressionToMatch != null) {
|
||||||
Type subjectType = expressionToMatch.type;
|
Type subjectType = expressionToMatch.type;
|
||||||
|
markStartLineNumber(patternExpression);
|
||||||
expressionToMatch.put(subjectType, v);
|
expressionToMatch.put(subjectType, v);
|
||||||
JetType condJetType = bindingContext.get(EXPRESSION_TYPE, patternExpression);
|
JetType condJetType = bindingContext.get(EXPRESSION_TYPE, patternExpression);
|
||||||
Type condType;
|
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) {
|
private StackValue generateIsCheck(StackValue expressionToMatch, JetTypeReference typeReference, boolean negated) {
|
||||||
JetType jetType = bindingContext.get(TYPE, typeReference);
|
JetType jetType = bindingContext.get(TYPE, typeReference);
|
||||||
|
markStartLineNumber(typeReference);
|
||||||
generateInstanceOf(expressionToMatch, jetType, false);
|
generateInstanceOf(expressionToMatch, jetType, false);
|
||||||
StackValue value = StackValue.onStack(Type.BOOLEAN_TYPE);
|
StackValue value = StackValue.onStack(Type.BOOLEAN_TYPE);
|
||||||
return negated ? StackValue.not(value) : value;
|
return negated ? StackValue.not(value) : value;
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package whenExpr
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
//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
|
||||||
@@ -224,6 +224,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
|||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/forLoop.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/forLoop.kt");
|
||||||
doStepIntoTest(fileName);
|
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")
|
@TestMetadata("idea/testData/debugger/tinyApp/src/filters")
|
||||||
|
|||||||
Reference in New Issue
Block a user