Partial body resolve: more efficient for-loop handling
This commit is contained in:
@@ -162,6 +162,11 @@ class PartialBodyResolveFilter(elementToResolve: JetElement, private val body: J
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun visitForExpression(expression: JetForExpression) {
|
||||||
|
// analyze only the loop-range expression, do not enter the loop body
|
||||||
|
expression.getLoopRange()?.accept(this)
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: when
|
//TODO: when
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.String
|
||||||
|
Skipped statements:
|
||||||
|
print(p1!!)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fun x(s: String): Collection<String>{}
|
||||||
|
|
||||||
|
fun foo(p: Any?, p1: Any?) {
|
||||||
|
for (e in x(p as String)) {
|
||||||
|
print(p1!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
<caret>p.size
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.resolve;
|
|||||||
import com.intellij.testFramework.TestDataPath;
|
import com.intellij.testFramework.TestDataPath;
|
||||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||||
import org.jetbrains.jet.JetTestUtils;
|
import org.jetbrains.jet.JetTestUtils;
|
||||||
|
import org.jetbrains.jet.test.InnerTestClasses;
|
||||||
import org.jetbrains.jet.test.TestMetadata;
|
import org.jetbrains.jet.test.TestMetadata;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@@ -53,6 +54,12 @@ public class PartialBodyResolveTestGenerated extends AbstractPartialBodyResolveT
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("For.kt")
|
||||||
|
public void testFor() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/partialBodyResolve/For.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("IfBranchesAutoCasts.kt")
|
@TestMetadata("IfBranchesAutoCasts.kt")
|
||||||
public void testIfBranchesAutoCasts() throws Exception {
|
public void testIfBranchesAutoCasts() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/partialBodyResolve/IfBranchesAutoCasts.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/partialBodyResolve/IfBranchesAutoCasts.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user