[debugger] IDEA-335294 Do not step into simple properties

GitOrigin-RevId: 4b400b0db8d7b523277c02102e6ded8f259355ad
This commit is contained in:
Maksim Zuev
2024-07-11 17:33:51 +02:00
committed by intellij-monorepo-bot
parent d43ecf6516
commit d32f883e2e
9 changed files with 76 additions and 1 deletions

View File

@@ -7,11 +7,12 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.kotlin.idea.base.psi.singleExpressionBody
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
class KotlinSimpleGetterProvider : SimplePropertyGetterProvider {
override fun isInsideSimpleGetter(element: PsiElement): Boolean {
// class A(val a: Int)
if (element is KtParameter) {
if (element.getParentOfType<KtParameter>(false) != null) {
return true
}

View File

@@ -1658,6 +1658,11 @@ public abstract class K2IdeK1CodeKotlinSteppingTestGenerated extends AbstractK2I
runTest("../testData/stepping/custom/simpleConditionalBreakpoint.kt");
}
@TestMetadata("skipSimpleGetters.kt")
public void testSkipSimpleGetters() throws Exception {
runTest("../testData/stepping/custom/skipSimpleGetters.kt");
}
@TestMetadata("smartStepIntoAsyncLambda.kt")
public void testSmartStepIntoAsyncLambda() throws Exception {
runTest("../testData/stepping/custom/smartStepIntoAsyncLambda.kt");

View File

@@ -1658,6 +1658,11 @@ public abstract class K2IdeK2CodeKotlinSteppingTestGenerated extends AbstractK2I
runTest("../testData/stepping/custom/simpleConditionalBreakpoint.kt");
}
@TestMetadata("skipSimpleGetters.kt")
public void testSkipSimpleGetters() throws Exception {
runTest("../testData/stepping/custom/skipSimpleGetters.kt");
}
@TestMetadata("smartStepIntoAsyncLambda.kt")
public void testSmartStepIntoAsyncLambda() throws Exception {
runTest("../testData/stepping/custom/smartStepIntoAsyncLambda.kt");

View File

@@ -1658,6 +1658,11 @@ public abstract class K2IndyLambdaKotlinSteppingTestGenerated extends AbstractK2
runTest("../testData/stepping/custom/simpleConditionalBreakpoint.kt");
}
@TestMetadata("skipSimpleGetters.kt")
public void testSkipSimpleGetters() throws Exception {
runTest("../testData/stepping/custom/skipSimpleGetters.kt");
}
@TestMetadata("smartStepIntoAsyncLambda.kt")
public void testSmartStepIntoAsyncLambda() throws Exception {
runTest("../testData/stepping/custom/smartStepIntoAsyncLambda.kt");

View File

@@ -1658,6 +1658,11 @@ public abstract class IndyLambdaIrKotlinSteppingTestGenerated extends AbstractIn
runTest("testData/stepping/custom/simpleConditionalBreakpoint.kt");
}
@TestMetadata("skipSimpleGetters.kt")
public void testSkipSimpleGetters() throws Exception {
runTest("testData/stepping/custom/skipSimpleGetters.kt");
}
@TestMetadata("smartStepIntoAsyncLambda.kt")
public void testSmartStepIntoAsyncLambda() throws Exception {
runTest("testData/stepping/custom/smartStepIntoAsyncLambda.kt");

View File

@@ -1658,6 +1658,11 @@ public abstract class IrKotlinSteppingTestGenerated extends AbstractIrKotlinStep
runTest("testData/stepping/custom/simpleConditionalBreakpoint.kt");
}
@TestMetadata("skipSimpleGetters.kt")
public void testSkipSimpleGetters() throws Exception {
runTest("testData/stepping/custom/skipSimpleGetters.kt");
}
@TestMetadata("smartStepIntoAsyncLambda.kt")
public void testSmartStepIntoAsyncLambda() throws Exception {
runTest("testData/stepping/custom/smartStepIntoAsyncLambda.kt");

View File

@@ -1658,6 +1658,11 @@ public abstract class K1IdeK2CodeKotlinSteppingTestGenerated extends AbstractK1I
runTest("testData/stepping/custom/simpleConditionalBreakpoint.kt");
}
@TestMetadata("skipSimpleGetters.kt")
public void testSkipSimpleGetters() throws Exception {
runTest("testData/stepping/custom/skipSimpleGetters.kt");
}
@TestMetadata("smartStepIntoAsyncLambda.kt")
public void testSmartStepIntoAsyncLambda() throws Exception {
runTest("testData/stepping/custom/smartStepIntoAsyncLambda.kt");

View File

@@ -0,0 +1,33 @@
fun foo(name: String, age: Int): Any {
return name
}
class User1(
val name: String,
val age: Int
)
private fun test1() {
val user = User1("", 0)
// STEP_INTO: 1
// RESUME: 1
//Breakpoint!
foo(user.name, user.age)
}
class User2(val name: String, val age: Int)
private fun test2() {
val user = User2("", 0)
// STEP_INTO: 1
// RESUME: 1
//Breakpoint!
foo(user.name, user.age)
}
fun main() {
test1()
test2()
}
// SKIP_GETTERS: true

View File

@@ -0,0 +1,11 @@
LineBreakpoint created at skipSimpleGetters.kt:15
LineBreakpoint created at skipSimpleGetters.kt:25
Run Java
Connected to the target VM
skipSimpleGetters.kt:15
skipSimpleGetters.kt:2
skipSimpleGetters.kt:25
skipSimpleGetters.kt:2
Disconnected from the target VM
Process finished with exit code 0