AA standalone: more tests about resolving properties in nested class/object from binary
This commit is contained in:
+18
@@ -70,6 +70,12 @@ public class FirStandaloneNormalAnalysisLibraryBinaryModulePsiDeclarationProvide
|
|||||||
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInCompanionObject_JvmStatic.kt");
|
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInCompanionObject_JvmStatic.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("propertiesInInnerClass.kt")
|
||||||
|
public void testPropertiesInInnerClass() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInInnerClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("propertiesInNamedCompanionObject.kt")
|
@TestMetadata("propertiesInNamedCompanionObject.kt")
|
||||||
public void testPropertiesInNamedCompanionObject() throws Exception {
|
public void testPropertiesInNamedCompanionObject() throws Exception {
|
||||||
@@ -88,9 +94,21 @@ public class FirStandaloneNormalAnalysisLibraryBinaryModulePsiDeclarationProvide
|
|||||||
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInNamedCompanionObject_JvmStatic.kt");
|
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInNamedCompanionObject_JvmStatic.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("propertiesInNestedObject.kt")
|
||||||
|
public void testPropertiesInNestedObject() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInNestedObject.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("propertiesInObject.kt")
|
@TestMetadata("propertiesInObject.kt")
|
||||||
public void testPropertiesInObject() throws Exception {
|
public void testPropertiesInObject() throws Exception {
|
||||||
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInObject.kt");
|
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInObject.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("propertiesInOuterClass.kt")
|
||||||
|
public void testPropertiesInOuterClass() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInOuterClass.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.analysis.api.standalone.fir.test.cases.components.psiDeclarationProvider
|
package org.jetbrains.kotlin.analysis.api.standalone.fir.test.cases.components.psiDeclarationProvider
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
import com.intellij.psi.PsiField
|
||||||
import com.intellij.psi.PsiMethod
|
import com.intellij.psi.PsiMethod
|
||||||
import com.intellij.psi.PsiParameter
|
import com.intellij.psi.PsiParameter
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
@@ -28,6 +29,14 @@ public object TestPsiElementRenderer {
|
|||||||
append(psiElement.name)
|
append(psiElement.name)
|
||||||
}
|
}
|
||||||
is KtElement -> psiElement.text
|
is KtElement -> psiElement.text
|
||||||
|
is PsiField -> buildString {
|
||||||
|
append("PsiField:")
|
||||||
|
append(psiElement.containingClass?.name)
|
||||||
|
append(".")
|
||||||
|
append(psiElement.name)
|
||||||
|
append(": ")
|
||||||
|
append(psiElement.type)
|
||||||
|
}
|
||||||
is PsiMethod -> buildString {
|
is PsiMethod -> buildString {
|
||||||
append("PsiMethod:")
|
append("PsiMethod:")
|
||||||
append(psiElement.name)
|
append(psiElement.name)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
PsiField:VAL_FLAG
|
PsiField:Dependency.VAL_FLAG: PsiType:Flag<?>
|
||||||
analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInCompanionObject_JvmField.txt
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
PsiField:JVM_FIELD_FLAG
|
PsiField:Dependency.JVM_FIELD_FLAG: PsiType:Flag<?>
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
PsiField:JVM_STATIC_FLAG
|
PsiField:Dependency.JVM_STATIC_FLAG: PsiType:Flag<?>
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
|
||||||
|
// FILE: some/Outer.kt
|
||||||
|
package some
|
||||||
|
|
||||||
|
interface Flag<T>
|
||||||
|
|
||||||
|
class Outer {
|
||||||
|
val VAL_FLAG: Flag<*> = TODO()
|
||||||
|
var varFlag: Flag<*> = TODO()
|
||||||
|
|
||||||
|
inner class Inner {
|
||||||
|
val VAL_FLAG: Flag<*> = TODO()
|
||||||
|
var varFlag: Flag<*> = TODO()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: app(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
package some
|
||||||
|
|
||||||
|
private fun consumeFlag(p: Flag<*>) {
|
||||||
|
println(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val o = Outer()
|
||||||
|
consumeFlag(o.VAL_FLAG)
|
||||||
|
consumeFlag(o.varFlag)
|
||||||
|
val i = o.Inner()
|
||||||
|
consumeFlag(i.VAL_FLAG)
|
||||||
|
consumeFlag(i.var<caret>Flag)
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
Resolved to:
|
||||||
|
PsiField:Inner.varFlag: PsiType:Flag<?>
|
||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
PsiField:VAL_FLAG
|
PsiField:Dependency.VAL_FLAG: PsiType:Flag<?>
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
PsiField:JVM_FIELD_FLAG
|
PsiField:Dependency.JVM_FIELD_FLAG: PsiType:Flag<?>
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
PsiField:JVM_STATIC_FLAG
|
PsiField:Dependency.JVM_STATIC_FLAG: PsiType:Flag<?>
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
|
||||||
|
// FILE: some/Outer.kt
|
||||||
|
package some
|
||||||
|
|
||||||
|
interface Flag<T>
|
||||||
|
|
||||||
|
class Outer {
|
||||||
|
val VAL_FLAG: Flag<*> = TODO()
|
||||||
|
var varFlag: Flag<*> = TODO()
|
||||||
|
|
||||||
|
object O {
|
||||||
|
val VAL_FLAG: Flag<*> = TODO()
|
||||||
|
var varFlag: Flag<*> = TODO()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: app(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
package some
|
||||||
|
|
||||||
|
private fun consumeFlag(p: Flag<*>) {
|
||||||
|
println(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val o = Outer()
|
||||||
|
consumeFlag(o.VAL_FLAG)
|
||||||
|
consumeFlag(o.varFlag)
|
||||||
|
consumeFlag(Outer.O.VAL_FLAG)
|
||||||
|
consumeFlag(Outer.O.var<caret>Flag)
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
Resolved to:
|
||||||
|
PsiField:O.varFlag: PsiType:Flag<?>
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
PsiField:varFlag
|
PsiField:DependencyObject.varFlag: PsiType:Flag<?>
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
|
||||||
|
// FILE: some/Outer.kt
|
||||||
|
package some
|
||||||
|
|
||||||
|
interface Flag<T>
|
||||||
|
|
||||||
|
class Outer {
|
||||||
|
val VAL_FLAG: Flag<*> = TODO()
|
||||||
|
var varFlag: Flag<*> = TODO()
|
||||||
|
|
||||||
|
inner class Inner {
|
||||||
|
val VAL_FLAG: Flag<*> = TODO()
|
||||||
|
var varFlag: Flag<*> = TODO()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: app(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
package some
|
||||||
|
|
||||||
|
private fun consumeFlag(p: Flag<*>) {
|
||||||
|
println(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val o = Outer()
|
||||||
|
consumeFlag(o.VAL_<caret>FLAG)
|
||||||
|
consumeFlag(o.varFlag)
|
||||||
|
val i = o.Inner()
|
||||||
|
consumeFlag(i.VAL_FLAG)
|
||||||
|
consumeFlag(i.varFlag)
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
Resolved to:
|
||||||
|
PsiField:Outer.VAL_FLAG: PsiType:Flag<?>
|
||||||
Reference in New Issue
Block a user