[VISUALIZER] Forbid to walk inside type reference children in psi
This commit is contained in:
committed by
TeamCityServer
parent
cc7d82ab7b
commit
951d607445
+22
-19
@@ -107,26 +107,29 @@ class PsiVisualizer(private val file: KtFile, analysisResult: AnalysisResult) :
|
||||
}
|
||||
|
||||
override fun visitTypeReference(typeReference: KtTypeReference) {
|
||||
if (typeReference.text.isNotEmpty()) {
|
||||
val hasResolvedCall = with(object : KtVisitorVoid() {
|
||||
var hasCall: Boolean = false
|
||||
override fun visitKtElement(element: KtElement) {
|
||||
if (!hasCall) {
|
||||
hasCall = element.getResolvedCall(bindingContext) != null
|
||||
element.acceptChildren(this)
|
||||
}
|
||||
}
|
||||
}) {
|
||||
typeReference.accept(this)
|
||||
this.hasCall
|
||||
}
|
||||
|
||||
if (!hasResolvedCall) {
|
||||
val type = typeReference.getAbbreviatedTypeOrType(bindingContext)
|
||||
addAnnotation(renderType(type), typeReference)
|
||||
}
|
||||
if (typeReference.text.isEmpty()) {
|
||||
return super.visitTypeReference(typeReference)
|
||||
}
|
||||
|
||||
val hasResolvedCall = with(object : KtVisitorVoid() {
|
||||
var hasCall: Boolean = false
|
||||
override fun visitKtElement(element: KtElement) {
|
||||
if (!hasCall) {
|
||||
element.getResolvedCall(bindingContext)?.let {
|
||||
hasCall = true
|
||||
element.accept(this@Renderer)
|
||||
} ?: element.acceptChildren(this)
|
||||
}
|
||||
}
|
||||
}) {
|
||||
typeReference.accept(this)
|
||||
this.hasCall
|
||||
}
|
||||
|
||||
if (!hasResolvedCall) {
|
||||
val type = typeReference.getAbbreviatedTypeOrType(bindingContext)
|
||||
addAnnotation(renderType(type), typeReference)
|
||||
}
|
||||
super.visitTypeReference(typeReference)
|
||||
}
|
||||
|
||||
override fun visitConstantExpression(expression: KtConstantExpression) {
|
||||
|
||||
@@ -9,7 +9,7 @@ class C<T, out S> {
|
||||
|
||||
interface Test {
|
||||
// C<out CharSequence, *>.D<in collections/List<*>, *>
|
||||
// │ class C<T, S> collections/List<*>
|
||||
// │ │ │
|
||||
// │ C<out CharSequence, *>.D<in collections/List<*>, *>
|
||||
// │ │
|
||||
val x: a.b.C<out CharSequence, *>.D<in List<*>, *>
|
||||
}
|
||||
|
||||
+2
-4
@@ -7,12 +7,10 @@ private fun resolveAccessorCall(
|
||||
// │
|
||||
context: TranslationContext
|
||||
// [ERROR : ResolvedCall<PropertyDescriptor>]<[ERROR : PropertyDescriptor]>
|
||||
// │ [ERROR : PropertyDescriptor]
|
||||
// │ │
|
||||
// │
|
||||
): ResolvedCall<PropertyDescriptor> {
|
||||
// [ERROR : ResolvedCall<PropertyDescriptor>]<[ERROR : PropertyDescriptor]>
|
||||
// │ [ERROR : PropertyDescriptor]
|
||||
// │ │
|
||||
// │
|
||||
return object : ResolvedCall<PropertyDescriptor> {
|
||||
// [ERROR : <ERROR PROPERTY TYPE>]
|
||||
// │ [ERROR: not resolved]
|
||||
|
||||
+3
-3
@@ -13,13 +13,13 @@ abstract class My<T : Some> {
|
||||
abstract fun foo(arg: T)
|
||||
|
||||
// [ERROR : T]
|
||||
// │ class My<T : Some>
|
||||
// │ [ERROR : T]
|
||||
// │ │
|
||||
abstract val y: My.T
|
||||
|
||||
// [ERROR : T]
|
||||
// │ class My<T : Some>
|
||||
// │ │
|
||||
// │ [ERROR : T]
|
||||
// │ │
|
||||
abstract val z: test.My.T
|
||||
|
||||
// [ERROR : T]
|
||||
|
||||
@@ -13,6 +13,8 @@ val listOfInt = listOf(1, 2, 3)
|
||||
// │ │
|
||||
val javaList = java.util.ArrayList<Int>()
|
||||
|
||||
// java/util/ArrayList<Int>
|
||||
// │
|
||||
fun move(): java.util.ArrayList<Int> {
|
||||
// Int val listOfInt: collections/List<Int>
|
||||
// │ │
|
||||
|
||||
Reference in New Issue
Block a user