Debugger: use partialBodyResolve. Don't compete variables defined after context element
This commit is contained in:
@@ -238,7 +238,7 @@ public abstract class ElementResolver {
|
||||
if (!(contextElement instanceof JetExpression)) return;
|
||||
|
||||
JetExpression contextExpression = (JetExpression) contextElement;
|
||||
BindingContext contextForElement = resolveToElement((JetElement) contextElement);
|
||||
BindingContext contextForElement = resolveToElement((JetElement) contextElement, true);
|
||||
|
||||
scopeForContextElement = contextForElement.get(BindingContext.RESOLUTION_SCOPE, contextExpression);
|
||||
dataFlowInfoForContextElement = getDataFlowInfo(contextForElement, contextExpression);
|
||||
|
||||
+1
-1
@@ -292,7 +292,7 @@ private object KotlinResolveDataProvider {
|
||||
else {
|
||||
if (contextElement !is JetExpression) return BindingContext.EMPTY
|
||||
|
||||
val contextForElement = contextElement.analyzeFully()
|
||||
val contextForElement = contextElement.getResolutionFacade().analyzeWithPartialBodyResolve(contextElement)
|
||||
|
||||
scopeForContextElement = contextForElement[BindingContext.RESOLUTION_SCOPE, contextElement]
|
||||
dataFlowInfo = contextForElement.getDataFlowInfo(contextElement)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {
|
||||
val aaa1 = 1
|
||||
val t<caret> = 2
|
||||
val aaa3 = 2
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
aaa1 + <error>aaa3</error>
|
||||
@@ -0,0 +1,9 @@
|
||||
fun foo() {
|
||||
val aaa1 = 1
|
||||
<caret>val t = 2
|
||||
val aaa3 = 2
|
||||
}
|
||||
|
||||
// INVOCATION_COUNT: 1
|
||||
// EXIST: aaa1
|
||||
// ABSENT: aaa3
|
||||
@@ -0,0 +1 @@
|
||||
aaa<caret>
|
||||
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at localVariables.kt:6
|
||||
!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! localVariables.LocalVariablesPackage
|
||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
localVariables.kt:6
|
||||
Compile bytecode for aaa1
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
@@ -0,0 +1,14 @@
|
||||
package localVariables
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val aaa1 = 1
|
||||
//Breakpoint!
|
||||
val t = 2
|
||||
val aaa3 = 2
|
||||
}
|
||||
|
||||
// EXPRESSION: aaa1
|
||||
// RESULT: 1: I
|
||||
|
||||
// EXPRESSION: aaa3 + aaa1
|
||||
// RESULT: Unresolved reference: aaa3
|
||||
+6
@@ -55,6 +55,12 @@ public class CodeFragmentCompletionTestGenerated extends AbstractCodeFragmentCom
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localVariables.kt")
|
||||
public void testLocalVariables() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/codeFragments/localVariables.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/codeFragments/topLevel.kt");
|
||||
|
||||
+6
@@ -75,6 +75,12 @@ public class CodeFragmentHighlightingTestGenerated extends AbstractCodeFragmentH
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localVariables.kt")
|
||||
public void testLocalVariables() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/codeFragments/localVariables.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateFunArgumentsResolve.kt")
|
||||
public void testPrivateFunArgumentsResolve() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/codeFragments/privateFunArgumentsResolve.kt");
|
||||
|
||||
+6
@@ -148,6 +148,12 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
|
||||
doSingleBreakpointTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localVariables.kt")
|
||||
public void testLocalVariables() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/localVariables.kt");
|
||||
doSingleBreakpointTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("methodWithBreakpoint.kt")
|
||||
public void testMethodWithBreakpoint() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/methodWithBreakpoint.kt");
|
||||
|
||||
Reference in New Issue
Block a user