Avoid loading psi for compiled kotlin file if it's possible to get declaration by name from stubs

This commit is contained in:
Nikolay Krasko
2016-12-02 15:58:08 +03:00
parent 299f477a1b
commit 726471d98e
16 changed files with 166 additions and 2 deletions
@@ -0,0 +1,11 @@
package test;
import org.jetbrains.annotations.NotNull;
import test.kotlin.A.B.C.C;
public class FunctionInNestedClassInDataFlowInspection {
void other(@NotNull Object some) {
Object foo = new C().foo(some);
}
}
@@ -0,0 +1,11 @@
package test.kotlin
class A {
class B {
class C {
class C {
fun foo(a: Any): Any = a
}
}
}
}
@@ -0,0 +1 @@
// TOOL: DataFlowInspection
@@ -0,0 +1,10 @@
package test;
import org.jetbrains.annotations.NotNull;
import test.kotlin.*;
public class TopLevelFunctionWithNameSimilarToClassInDataFlowInspection {
void other(@NotNull Object some) {
Object foo = TopLevelFunctionWithNameSimilarToClassInDataFlowInspectionKt.foo(some);
}
}
@@ -0,0 +1,4 @@
package test.kotlin
class foo
fun foo(a: Any): Any = a
@@ -0,0 +1 @@
// TOOL: DataFlowInspection
@@ -0,0 +1,10 @@
package test;
import org.jetbrains.annotations.NotNull;
import test.kotlin.*;
public class TopLevelFunctionWithNameSimilarToPropertyInDataFlowInspection {
void other(@NotNull Object some) {
Object foo = (new Test()).foo(some);
}
}
@@ -0,0 +1,8 @@
package test.kotlin
class Test {
val foo: Int = 12
fun foo(a: Any): Any = a
}
// ALLOW_AST_ACCESS
@@ -0,0 +1,10 @@
package test;
import org.jetbrains.annotations.NotNull;
import test.kotlin.*;
public class TopLevelOverloadedFunctionInDataFlowInspection {
void other(@NotNull Object some) {
Object foo = TopLevelOverloadedFunctionInDataFlowInspectionKt.foo(some);
}
}
@@ -0,0 +1,7 @@
package test.kotlin
fun foo(a: Any?, b: Any): Any? = a
fun foo(a: Any): Any = a
// ALLOW_AST_ACCESS
@@ -0,0 +1 @@
// TOOL: DataFlowInspection