diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt index 572bf363c08..973580ce043 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt @@ -30,9 +30,11 @@ import org.jetbrains.kotlin.psi.psiUtil.getAssignmentByLHS import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForSelectorOrThis import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall +import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor import org.jetbrains.kotlin.utils.addToStdlib.constant import org.jetbrains.uast.* +import org.jetbrains.uast.internal.log import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier import org.jetbrains.uast.kotlin.internal.DelegatedMultiResolve import org.jetbrains.uast.visitor.UastVisitor @@ -202,17 +204,23 @@ class KotlinClassViaConstructorUSimpleReferenceExpression( givenParent: UElement? ) : KotlinAbstractUExpression(givenParent), USimpleNameReferenceExpression, KotlinUElementWithType { override val resolvedName: String? - get() = (psi.getResolvedCall(psi.analyze())?.resultingDescriptor as? ConstructorDescriptor) - ?.containingDeclaration?.name?.asString() + get() = (resolved as? PsiNamedElement)?.name - override fun resolve(): PsiElement? = + private val resolved by lazy { when (val resultingDescriptor = psi.getResolvedCall(psi.analyze())?.resultingDescriptor) { - is ConstructorDescriptor -> - resultingDescriptor.containingDeclaration.toSource()?.getMaybeLightElement(this) + is ConstructorDescriptor -> { + resultingDescriptor.constructedClass.toSource()?.getMaybeLightElement(this) + ?: (resultingDescriptor as? DeserializedCallableMemberDescriptor)?.let { resolveContainingDeserializedClass(psi, it) } + } is SamConstructorDescriptor -> (resultingDescriptor.returnType?.getFunctionalInterfaceType(this, psi) as? PsiClassType)?.resolve() else -> null } + } + + override fun resolve(): PsiElement? = resolved + + override fun asLogString(): String = log("identifier = $identifier, resolvesTo = $resolvedName") } class KotlinStringUSimpleReferenceExpression( diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.191 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.191 index 4b060121449..9c20366d663 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.191 +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.191 @@ -205,17 +205,21 @@ class KotlinClassViaConstructorUSimpleReferenceExpression( givenParent: UElement? ) : KotlinAbstractUExpression(givenParent), USimpleNameReferenceExpression, KotlinUElementWithType { override val resolvedName: String? - get() = (psi.getResolvedCall(psi.analyze())?.resultingDescriptor as? ConstructorDescriptor) - ?.containingDeclaration?.name?.asString() + get() = (resolved as? PsiNamedElement)?.name - override fun resolve(): PsiElement? = + private val resolved by lazy { when (val resultingDescriptor = psi.getResolvedCall(psi.analyze())?.resultingDescriptor) { - is ConstructorDescriptor -> - resultingDescriptor.containingDeclaration.toSource()?.getMaybeLightElement(this) + is ConstructorDescriptor -> { + resultingDescriptor.constructedClass.toSource()?.getMaybeLightElement(this) + ?: (resultingDescriptor as? DeserializedCallableMemberDescriptor)?.let { resolveContainingDeserializedClass(psi, it) } + } is SamConstructorDescriptor -> (resultingDescriptor.returnType?.getFunctionalInterfaceType(this, psi) as? PsiClassType)?.resolve() else -> null } + } + + override fun resolve(): PsiElement? = resolved } class KotlinStringUSimpleReferenceExpression( diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt index 41b7e4616cd..3c04fa70027 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/kotlinInternalUastUtils.kt @@ -98,14 +98,12 @@ internal fun resolveSource(context: KtElement, descriptor: DeclarationDescriptor } } -private fun resolveDeserialized(context: KtElement, descriptor: DeclarationDescriptor): PsiMethod? { - if (descriptor !is DeserializedCallableMemberDescriptor) return null - - val containingDeclaration = descriptor.containingDeclaration - val psiClass = when (containingDeclaration) { +internal fun resolveContainingDeserializedClass(context: KtElement, memberDescriptor: DeserializedCallableMemberDescriptor): PsiClass? { + val containingDeclaration = memberDescriptor.containingDeclaration + return when (containingDeclaration) { is LazyJavaPackageFragment -> { val binaryPackageSourceElement = containingDeclaration.source as? KotlinJvmBinaryPackageSourceElement ?: return null - val containingBinaryClass = binaryPackageSourceElement.getContainingBinaryClass(descriptor) ?: return null + val containingBinaryClass = binaryPackageSourceElement.getContainingBinaryClass(memberDescriptor) ?: return null val containingClassQualifiedName = containingBinaryClass.classId.asSingleFqName().asString() JavaPsiFacade.getInstance(context.project).findClass(containingClassQualifiedName, context.resolveScope) ?: return null } @@ -115,7 +113,12 @@ private fun resolveDeserialized(context: KtElement, descriptor: DeclarationDescr } else -> return null } +} +private fun resolveDeserialized(context: KtElement, descriptor: DeclarationDescriptor): PsiMethod? { + if (descriptor !is DeserializedCallableMemberDescriptor) return null + + val psiClass = resolveContainingDeserializedClass(context, descriptor) ?: return null val proto = descriptor.proto val nameResolver = descriptor.nameResolver diff --git a/plugins/uast-kotlin/testData/AnnotationComplex.log.txt b/plugins/uast-kotlin/testData/AnnotationComplex.log.txt index 44e589e9f6f..8fa610961fb 100644 --- a/plugins/uast-kotlin/testData/AnnotationComplex.log.txt +++ b/plugins/uast-kotlin/testData/AnnotationComplex.log.txt @@ -11,14 +11,14 @@ UFile (package = ) UNamedExpression (name = value) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier (Annotation)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Annotation) UAnnotationMethod (name = B1) UClass (name = B2) UAnnotation (fqName = AnnotationArray) UNamedExpression (name = value) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 2)) UIdentifier (Identifier (Annotation)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Annotation) ULiteralExpression (value = "sv1") ULiteralExpression (value = "sv2") UAnnotationMethod (name = B2) @@ -29,10 +29,10 @@ UFile (package = ) UNamedExpression (name = value) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (Annotation)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Annotation) UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 2)) UIdentifier (Identifier (arrayOf)) - USimpleNameReferenceExpression (identifier = arrayOf) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) ULiteralExpression (value = "sar1") ULiteralExpression (value = "sar2") UAnnotationMethod (name = C) @@ -41,7 +41,7 @@ UFile (package = ) UNamedExpression (name = value) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (Annotation)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Annotation) UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 2)) UIdentifier (Identifier ([)) ULiteralExpression (value = "[sar]1") diff --git a/plugins/uast-kotlin/testData/AnnotationParameters.log.txt b/plugins/uast-kotlin/testData/AnnotationParameters.log.txt index 5ee25dcdef3..f4598cf0c49 100644 --- a/plugins/uast-kotlin/testData/AnnotationParameters.log.txt +++ b/plugins/uast-kotlin/testData/AnnotationParameters.log.txt @@ -5,7 +5,7 @@ UFile (package = ) UNamedExpression (name = anyOf) UCallExpression (kind = UastCallKind(name='array_initializer'), argCount = 3)) UIdentifier (Identifier (intArrayOf)) - USimpleNameReferenceExpression (identifier = intArrayOf) + USimpleNameReferenceExpression (identifier = intArrayOf, resolvesTo = null) ULiteralExpression (value = 1) ULiteralExpression (value = 2) ULiteralExpression (value = 3) diff --git a/plugins/uast-kotlin/testData/Anonymous.log.txt b/plugins/uast-kotlin/testData/Anonymous.log.txt index 6cdd3d80d57..b20d0a5fe3a 100644 --- a/plugins/uast-kotlin/testData/Anonymous.log.txt +++ b/plugins/uast-kotlin/testData/Anonymous.log.txt @@ -15,22 +15,22 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = runnable) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (run)) - USimpleNameReferenceExpression (identifier = run) + USimpleNameReferenceExpression (identifier = run, resolvesTo = null) UDeclarationsExpression ULocalVariable (name = runnable2) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (Runnable)) - USimpleNameReferenceExpression (identifier = Runnable) + USimpleNameReferenceExpression (identifier = Runnable, resolvesTo = Runnable) ULambdaExpression UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = runnable2) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (run)) - USimpleNameReferenceExpression (identifier = run) + USimpleNameReferenceExpression (identifier = run, resolvesTo = null) UDeclarationsExpression ULocalVariable (name = closeableRunnable) UObjectLiteralExpression diff --git a/plugins/uast-kotlin/testData/Constructors.log.txt b/plugins/uast-kotlin/testData/Constructors.log.txt index 2b238a4f29d..ccb3ba97420 100644 --- a/plugins/uast-kotlin/testData/Constructors.log.txt +++ b/plugins/uast-kotlin/testData/Constructors.log.txt @@ -12,12 +12,12 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (this)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = i) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) UClass (name = AWithInit) UField (name = str) UAnnotation (fqName = org.jetbrains.annotations.NotNull) @@ -29,19 +29,19 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) UAnnotationMethod (name = AWithInit) UParameter (name = i) UAnnotation (fqName = org.jetbrains.annotations.NotNull) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (this)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = AWithInit) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = i) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) UClass (name = AWith2Init) UField (name = str) UAnnotation (fqName = org.jetbrains.annotations.NotNull) @@ -53,12 +53,12 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) ULiteralExpression (value = 1) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) ULiteralExpression (value = 2) UAnnotationMethod (name = AWith2Init) UParameter (name = i) @@ -66,24 +66,24 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (this)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = AWith2Init) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = i) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) UClass (name = AOnlyInit) UAnnotationMethod (name = AOnlyInit) UBlockExpression UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) ULiteralExpression (value = 1) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) ULiteralExpression (value = 2) UClass (name = AWithSecondary) UField (name = a) @@ -98,21 +98,21 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier ()) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Object) UBinaryExpression (operator = =) USimpleNameReferenceExpression (identifier = a) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = i) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) UAnnotationMethod (name = AWithSecondary) UParameter (name = s) UAnnotation (fqName = org.jetbrains.annotations.NotNull) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier ()) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Object) UBinaryExpression (operator = =) USimpleNameReferenceExpression (identifier = a) USimpleNameReferenceExpression (identifier = s) @@ -129,25 +129,25 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier ()) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Object) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) UBinaryExpression (operator = =) USimpleNameReferenceExpression (identifier = a) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = i) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) UAnnotationMethod (name = AWithSecondaryInit) UParameter (name = s) UAnnotation (fqName = org.jetbrains.annotations.NotNull) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier ()) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Object) UBinaryExpression (operator = =) USimpleNameReferenceExpression (identifier = a) USimpleNameReferenceExpression (identifier = s) @@ -158,4 +158,4 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = local) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) diff --git a/plugins/uast-kotlin/testData/Delegate.values.txt b/plugins/uast-kotlin/testData/Delegate.values.txt index 4461cb7388e..6ede03a51d2 100644 --- a/plugins/uast-kotlin/testData/Delegate.values.txt +++ b/plugins/uast-kotlin/testData/Delegate.values.txt @@ -23,14 +23,14 @@ UFile (package = ) [public final class MyColor {...] (18, 2, 3) })(Undetermined) UIdentifier (Identifier (lazy)) [UIdentifier (Identifier (lazy))] - USimpleNameReferenceExpression (identifier = lazy) [lazy] = external lazy({ + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) [lazy] = external lazy({ (18, 2, 3) })(Undetermined) ULambdaExpression [{ ...}] = Undetermined UBlockExpression [{...}] = external (18, 2, 3)(18, 2, 3) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) [(18, 2, 3)] = external (18, 2, 3)(18, 2, 3) UIdentifier (Identifier (MyColor)) [UIdentifier (Identifier (MyColor))] - USimpleNameReferenceExpression (identifier = ) [] = external (18, 2, 3)(18, 2, 3) + USimpleNameReferenceExpression (identifier = , resolvesTo = MyColor) [] = external (18, 2, 3)(18, 2, 3) ULiteralExpression (value = 18) [18] = 18 ULiteralExpression (value = 2) [2] = 2 ULiteralExpression (value = 3) [3] = 3 @@ -40,14 +40,14 @@ UFile (package = ) [public final class MyColor {...] (1, 2, 3) })(Undetermined) UIdentifier (Identifier (lazy)) [UIdentifier (Identifier (lazy))] - USimpleNameReferenceExpression (identifier = lazy) [lazy] = external lazy({ + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) [lazy] = external lazy({ (1, 2, 3) })(Undetermined) ULambdaExpression [{ ...}] = Undetermined UBlockExpression [{...}] = external (1, 2, 3)(1, 2, 3) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) [(1, 2, 3)] = external (1, 2, 3)(1, 2, 3) UIdentifier (Identifier (MyColor)) [UIdentifier (Identifier (MyColor))] - USimpleNameReferenceExpression (identifier = ) [] = external (1, 2, 3)(1, 2, 3) + USimpleNameReferenceExpression (identifier = , resolvesTo = MyColor) [] = external (1, 2, 3)(1, 2, 3) ULiteralExpression (value = 1) [1] = 1 ULiteralExpression (value = 2) [2] = 2 ULiteralExpression (value = 3) [3] = 3 @@ -55,7 +55,7 @@ UFile (package = ) [public final class MyColor {...] UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull] UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) [(1, 2, 3)] = external (1, 2, 3)(1, 2, 3) UIdentifier (Identifier (MyColor)) [UIdentifier (Identifier (MyColor))] - USimpleNameReferenceExpression (identifier = ) [] = external (1, 2, 3)(1, 2, 3) + USimpleNameReferenceExpression (identifier = , resolvesTo = MyColor) [] = external (1, 2, 3)(1, 2, 3) ULiteralExpression (value = 1) [1] = 1 ULiteralExpression (value = 2) [2] = 2 ULiteralExpression (value = 3) [3] = 3 diff --git a/plugins/uast-kotlin/testData/DestructuringDeclaration.log.txt b/plugins/uast-kotlin/testData/DestructuringDeclaration.log.txt index 9cd62857b00..4685daf1ed9 100644 --- a/plugins/uast-kotlin/testData/DestructuringDeclaration.log.txt +++ b/plugins/uast-kotlin/testData/DestructuringDeclaration.log.txt @@ -14,11 +14,11 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = var268d4034) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (component1)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) ULocalVariable (name = b) UAnnotation (fqName = null) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = var268d4034) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (component2)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) diff --git a/plugins/uast-kotlin/testData/Elvis.log.txt b/plugins/uast-kotlin/testData/Elvis.log.txt index b5d049f2ca2..3723f39e132 100644 --- a/plugins/uast-kotlin/testData/Elvis.log.txt +++ b/plugins/uast-kotlin/testData/Elvis.log.txt @@ -23,7 +23,7 @@ UFile (package = ) UAnnotation (fqName = null) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (foo)) - USimpleNameReferenceExpression (identifier = foo) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) ULiteralExpression (value = "Lorem ipsum") UIfExpression UBinaryExpression (operator = !=) @@ -32,7 +32,7 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = varc4aef569) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (foo)) - USimpleNameReferenceExpression (identifier = foo) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) ULiteralExpression (value = "dolor sit amet") UIfExpression UBinaryExpression (operator = !=) @@ -42,7 +42,7 @@ UFile (package = ) UQualifiedReferenceExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (bar)) - USimpleNameReferenceExpression (identifier = bar) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) diff --git a/plugins/uast-kotlin/testData/Lambdas.log.txt b/plugins/uast-kotlin/testData/Lambdas.log.txt index 0c9cf9e905f..eb35b4d0a30 100644 --- a/plugins/uast-kotlin/testData/Lambdas.log.txt +++ b/plugins/uast-kotlin/testData/Lambdas.log.txt @@ -8,31 +8,31 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = Stream) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (empty)) - USimpleNameReferenceExpression (identifier = empty) + USimpleNameReferenceExpression (identifier = empty, resolvesTo = null) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (filter)) - USimpleNameReferenceExpression (identifier = filter) + USimpleNameReferenceExpression (identifier = filter, resolvesTo = null) ULambdaExpression UBlockExpression UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = it) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (isEmpty)) - USimpleNameReferenceExpression (identifier = isEmpty) + USimpleNameReferenceExpression (identifier = isEmpty, resolvesTo = null) UAnnotationMethod (name = doSelectItem) UParameter (name = selectItemFunction) UAnnotation (fqName = org.jetbrains.annotations.NotNull) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (selectItemFunction)) - USimpleNameReferenceExpression (identifier = invoke) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) UDeclarationsExpression ULocalVariable (name = baz) ULambdaExpression UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (Local)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (baz)) - USimpleNameReferenceExpression (identifier = invoke) + USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null) diff --git a/plugins/uast-kotlin/testData/LocalDeclarations.log.txt b/plugins/uast-kotlin/testData/LocalDeclarations.log.txt index bd4c47ba808..1b116f7c895 100644 --- a/plugins/uast-kotlin/testData/LocalDeclarations.log.txt +++ b/plugins/uast-kotlin/testData/LocalDeclarations.log.txt @@ -10,14 +10,14 @@ UFile (package = ) ULambdaExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier (Local)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) UDeclarationsExpression ULocalVariable (name = baz) ULambdaExpression UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier (Local)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) UDeclarationsExpression UVariable (name = someLocalFun) ULambdaExpression @@ -33,7 +33,7 @@ UFile (package = ) UBinaryExpression (operator = ==) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (bar)) - USimpleNameReferenceExpression (identifier = bar) + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier (Local)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) diff --git a/plugins/uast-kotlin/testData/LocalDeclarations.types.txt b/plugins/uast-kotlin/testData/LocalDeclarations.types.txt index 7c1a696b7c6..e067345b74d 100644 --- a/plugins/uast-kotlin/testData/LocalDeclarations.types.txt +++ b/plugins/uast-kotlin/testData/LocalDeclarations.types.txt @@ -10,14 +10,14 @@ UFile (package = ) [public final class LocalDeclarationsKt {...] ULambdaExpression [fun () {...}] UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [()] : PsiType: UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))] - USimpleNameReferenceExpression (identifier = ) [] : PsiType: + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) [] : PsiType: UDeclarationsExpression [var baz: kotlin.jvm.functions.Function0 = fun () {...}] ULocalVariable (name = baz) [var baz: kotlin.jvm.functions.Function0 = fun () {...}] ULambdaExpression [fun () {...}] UBlockExpression [{...}] : PsiType: UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [()] : PsiType: UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))] - USimpleNameReferenceExpression (identifier = ) [] : PsiType: + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) [] : PsiType: UDeclarationsExpression [var someLocalFun: kotlin.jvm.functions.Function2 = fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {...}] UVariable (name = someLocalFun) [var someLocalFun: kotlin.jvm.functions.Function2 = fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {...}] ULambdaExpression [fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {...}] @@ -33,7 +33,7 @@ UFile (package = ) [public final class LocalDeclarationsKt {...] UBinaryExpression (operator = ==) [bar() == ()] : PsiType:boolean UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] : PsiType: UIdentifier (Identifier (bar)) [UIdentifier (Identifier (bar))] - USimpleNameReferenceExpression (identifier = bar) [bar] : PsiType: + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) [bar] : PsiType: UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [()] : PsiType: UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))] - USimpleNameReferenceExpression (identifier = ) [] : PsiType: + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) [] : PsiType: diff --git a/plugins/uast-kotlin/testData/LocalDeclarations.values.txt b/plugins/uast-kotlin/testData/LocalDeclarations.values.txt index abbcb97f975..12391ba6052 100644 --- a/plugins/uast-kotlin/testData/LocalDeclarations.values.txt +++ b/plugins/uast-kotlin/testData/LocalDeclarations.values.txt @@ -10,14 +10,14 @@ UFile (package = ) [public final class LocalDeclarationsKt {...] ULambdaExpression [fun () {...}] = Undetermined UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [()] = external ()() UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))] - USimpleNameReferenceExpression (identifier = ) [] = external ()() + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) [] = external ()() UDeclarationsExpression [var baz: kotlin.jvm.functions.Function0 = fun () {...}] = Undetermined ULocalVariable (name = baz) [var baz: kotlin.jvm.functions.Function0 = fun () {...}] ULambdaExpression [fun () {...}] = Undetermined UBlockExpression [{...}] = external ()() UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [()] = external ()() UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))] - USimpleNameReferenceExpression (identifier = ) [] = external ()() + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) [] = external ()() UDeclarationsExpression [var someLocalFun: kotlin.jvm.functions.Function2 = fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {...}] = Undetermined UVariable (name = someLocalFun) [var someLocalFun: kotlin.jvm.functions.Function2 = fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {...}] ULambdaExpression [fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {...}] = Undetermined @@ -33,7 +33,7 @@ UFile (package = ) [public final class LocalDeclarationsKt {...] UBinaryExpression (operator = ==) [bar() == ()] = Undetermined UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] = external bar()() UIdentifier (Identifier (bar)) [UIdentifier (Identifier (bar))] - USimpleNameReferenceExpression (identifier = bar) [bar] = external bar()() + USimpleNameReferenceExpression (identifier = bar, resolvesTo = null) [bar] = external bar()() UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [()] = external ()() UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))] - USimpleNameReferenceExpression (identifier = ) [] = external ()() + USimpleNameReferenceExpression (identifier = , resolvesTo = Local) [] = external ()() diff --git a/plugins/uast-kotlin/testData/ParametersDisorder.log.txt b/plugins/uast-kotlin/testData/ParametersDisorder.log.txt index a80c89336fa..b6e593547f0 100644 --- a/plugins/uast-kotlin/testData/ParametersDisorder.log.txt +++ b/plugins/uast-kotlin/testData/ParametersDisorder.log.txt @@ -26,30 +26,30 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (global)) - USimpleNameReferenceExpression (identifier = global) + USimpleNameReferenceExpression (identifier = global, resolvesTo = null) ULiteralExpression (value = 2.2) ULiteralExpression (value = 2) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (withDefault)) - USimpleNameReferenceExpression (identifier = withDefault) + USimpleNameReferenceExpression (identifier = withDefault, resolvesTo = null) ULiteralExpression (value = "bbb") UQualifiedReferenceExpression ULiteralExpression (value = "abc") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (withReceiver)) - USimpleNameReferenceExpression (identifier = withReceiver) + USimpleNameReferenceExpression (identifier = withReceiver, resolvesTo = null) ULiteralExpression (value = 1) ULiteralExpression (value = 1.2) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = Math) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (atan2)) - USimpleNameReferenceExpression (identifier = atan2) + USimpleNameReferenceExpression (identifier = atan2, resolvesTo = null) ULiteralExpression (value = 1.3) ULiteralExpression (value = 3.4) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (unresolvedMethod)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) ULiteralExpression (value = "param1") ULiteralExpression (value = "param2") UQualifiedReferenceExpression @@ -60,7 +60,7 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = String) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 4)) UIdentifier (Identifier (format)) - USimpleNameReferenceExpression (identifier = format) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) ULiteralExpression (value = "%i %i %i") ULiteralExpression (value = 1) ULiteralExpression (value = 2) @@ -73,11 +73,11 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = String) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (format)) - USimpleNameReferenceExpression (identifier = format) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) ULiteralExpression (value = "%i %i %i") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) UIdentifier (Identifier (arrayOf)) - USimpleNameReferenceExpression (identifier = arrayOf) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) ULiteralExpression (value = 1) ULiteralExpression (value = 2) ULiteralExpression (value = 3) @@ -89,17 +89,17 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = String) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) UIdentifier (Identifier (format)) - USimpleNameReferenceExpression (identifier = format) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) ULiteralExpression (value = "%i %i %i") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) UIdentifier (Identifier (arrayOf)) - USimpleNameReferenceExpression (identifier = arrayOf) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) ULiteralExpression (value = 1) ULiteralExpression (value = 2) ULiteralExpression (value = 3) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3)) UIdentifier (Identifier (arrayOf)) - USimpleNameReferenceExpression (identifier = arrayOf) + USimpleNameReferenceExpression (identifier = arrayOf, resolvesTo = null) ULiteralExpression (value = 4) ULiteralExpression (value = 5) ULiteralExpression (value = 6) @@ -111,31 +111,31 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = String) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (format)) - USimpleNameReferenceExpression (identifier = format) + USimpleNameReferenceExpression (identifier = format, resolvesTo = null) ULiteralExpression (value = "%i %i %i") UQualifiedReferenceExpression UQualifiedReferenceExpression ULiteralExpression (value = "") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (chunked)) - USimpleNameReferenceExpression (identifier = chunked) + USimpleNameReferenceExpression (identifier = chunked, resolvesTo = null) ULiteralExpression (value = 2) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toTypedArray)) - USimpleNameReferenceExpression (identifier = toTypedArray) + USimpleNameReferenceExpression (identifier = toTypedArray, resolvesTo = null) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (with)) - USimpleNameReferenceExpression (identifier = with) + USimpleNameReferenceExpression (identifier = with, resolvesTo = null) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier (A)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) ULambdaExpression UBlockExpression UQualifiedReferenceExpression ULiteralExpression (value = "def") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (with2Receivers)) - USimpleNameReferenceExpression (identifier = with2Receivers) + USimpleNameReferenceExpression (identifier = with2Receivers, resolvesTo = null) ULiteralExpression (value = 8) ULiteralExpression (value = 7.0) UAnnotationMethod (name = objectLiteral) diff --git a/plugins/uast-kotlin/testData/PropertyAccessors.log.txt b/plugins/uast-kotlin/testData/PropertyAccessors.log.txt index 6772bca2a67..88aefccd3ce 100644 --- a/plugins/uast-kotlin/testData/PropertyAccessors.log.txt +++ b/plugins/uast-kotlin/testData/PropertyAccessors.log.txt @@ -7,14 +7,14 @@ UFile (package = ) UThisExpression (label = null) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) UAnnotationMethod (name = setStringRepresentation) UParameter (name = value) UAnnotation (fqName = org.jetbrains.annotations.NotNull) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (setDataFromString)) - USimpleNameReferenceExpression (identifier = setDataFromString) + USimpleNameReferenceExpression (identifier = setDataFromString, resolvesTo = null) USimpleNameReferenceExpression (identifier = value) UAnnotationMethod (name = setDataFromString) UParameter (name = data) diff --git a/plugins/uast-kotlin/testData/PropertyDelegate.log.txt b/plugins/uast-kotlin/testData/PropertyDelegate.log.txt index 39a57572fe6..70f773d3477 100644 --- a/plugins/uast-kotlin/testData/PropertyDelegate.log.txt +++ b/plugins/uast-kotlin/testData/PropertyDelegate.log.txt @@ -4,7 +4,7 @@ UFile (package = ) UAnnotation (fqName = org.jetbrains.annotations.NotNull) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (lazy)) - USimpleNameReferenceExpression (identifier = lazy) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) ULambdaExpression UBlockExpression ULiteralExpression (value = "/sdcard") @@ -13,7 +13,7 @@ UFile (package = ) UAnnotation (fqName = kotlin.Suppress) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (lazy)) - USimpleNameReferenceExpression (identifier = lazy) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) ULambdaExpression UBlockExpression UBinaryExpression (operator = +) @@ -26,7 +26,7 @@ UFile (package = ) ULocalVariable (name = sdCardPathLocal) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (lazy)) - USimpleNameReferenceExpression (identifier = lazy) + USimpleNameReferenceExpression (identifier = lazy, resolvesTo = null) ULambdaExpression UBlockExpression ULiteralExpression (value = "/sdcard") diff --git a/plugins/uast-kotlin/testData/QualifiedConstructorCall.log.txt b/plugins/uast-kotlin/testData/QualifiedConstructorCall.log.txt index 7fad3df7e0a..39959ecaf4e 100644 --- a/plugins/uast-kotlin/testData/QualifiedConstructorCall.log.txt +++ b/plugins/uast-kotlin/testData/QualifiedConstructorCall.log.txt @@ -13,5 +13,5 @@ UFile (package = A.B.C) USimpleNameReferenceExpression (identifier = C) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier (Foo)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Foo) UAnnotationMethod (name = Bar) diff --git a/plugins/uast-kotlin/testData/Simple.log.txt b/plugins/uast-kotlin/testData/Simple.log.txt index 283fb878d8d..93cb0f0bb05 100644 --- a/plugins/uast-kotlin/testData/Simple.log.txt +++ b/plugins/uast-kotlin/testData/Simple.log.txt @@ -7,7 +7,7 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) ULiteralExpression (value = "Hello, world!") UAnnotationMethod (name = getProperty) UAnnotationMethod (name = Simple) diff --git a/plugins/uast-kotlin/testData/Simple.values.txt b/plugins/uast-kotlin/testData/Simple.values.txt index 33ac2d9ce5e..d44f36b0770 100644 --- a/plugins/uast-kotlin/testData/Simple.values.txt +++ b/plugins/uast-kotlin/testData/Simple.values.txt @@ -7,7 +7,7 @@ UFile (package = ) [public final class Simple {...] UBlockExpression [{...}] = external println("Hello, world!")("Hello, world!") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [println("Hello, world!")] = external println("Hello, world!")("Hello, world!") UIdentifier (Identifier (println)) [UIdentifier (Identifier (println))] - USimpleNameReferenceExpression (identifier = println) [println] = external println("Hello, world!")("Hello, world!") + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) [println] = external println("Hello, world!")("Hello, world!") ULiteralExpression (value = "Hello, world!") ["Hello, world!"] = "Hello, world!" UAnnotationMethod (name = getProperty) [public final fun getProperty() : java.lang.String = UastEmptyExpression] UAnnotationMethod (name = Simple) [public fun Simple() = UastEmptyExpression] diff --git a/plugins/uast-kotlin/testData/SimpleScript.log.txt b/plugins/uast-kotlin/testData/SimpleScript.log.txt index eaf0f4ac188..06fb6f860d3 100644 --- a/plugins/uast-kotlin/testData/SimpleScript.log.txt +++ b/plugins/uast-kotlin/testData/SimpleScript.log.txt @@ -9,7 +9,7 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = flag) UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (Bar)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = Bar) ULiteralExpression (value = 42) ULiteralExpression (value = null) UAnnotationMethod (name = SimpleScript) @@ -18,15 +18,15 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) ULiteralExpression (value = "Hello World!") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (getBarOrNull)) - USimpleNameReferenceExpression (identifier = getBarOrNull) + USimpleNameReferenceExpression (identifier = getBarOrNull, resolvesTo = null) ULiteralExpression (value = true) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) ULiteralExpression (value = "Goodbye World!") UClass (name = Bar) UField (name = b) diff --git a/plugins/uast-kotlin/testData/StringTemplateComplex.log.txt b/plugins/uast-kotlin/testData/StringTemplateComplex.log.txt index 033a7451c39..ff164143be8 100644 --- a/plugins/uast-kotlin/testData/StringTemplateComplex.log.txt +++ b/plugins/uast-kotlin/testData/StringTemplateComplex.log.txt @@ -35,7 +35,7 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = case4) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (repeat)) - USimpleNameReferenceExpression (identifier = repeat) + USimpleNameReferenceExpression (identifier = repeat, resolvesTo = null) ULiteralExpression (value = 4) ULiteralExpression (value = " z") UAnnotationMethod (name = getMuchRecur) @@ -54,17 +54,17 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) USimpleNameReferenceExpression (identifier = baz) UDeclarationsExpression ULocalVariable (name = template1) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (simpleForTemplate)) - USimpleNameReferenceExpression (identifier = simpleForTemplate) + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) UDeclarationsExpression ULocalVariable (name = template2) UPolyadicExpression (operator = +) ULiteralExpression (value = ".") UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (simpleForTemplate)) - USimpleNameReferenceExpression (identifier = simpleForTemplate) + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) diff --git a/plugins/uast-kotlin/testData/StringTemplateComplex.types.txt b/plugins/uast-kotlin/testData/StringTemplateComplex.types.txt index 8fef1e65ec1..9cb8e02e338 100644 --- a/plugins/uast-kotlin/testData/StringTemplateComplex.types.txt +++ b/plugins/uast-kotlin/testData/StringTemplateComplex.types.txt @@ -35,7 +35,7 @@ UFile (package = ) [public final class StringTemplateComplexKt {...] USimpleNameReferenceExpression (identifier = case4) [case4] : PsiType:String UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [repeat(4)] : PsiType:String UIdentifier (Identifier (repeat)) [UIdentifier (Identifier (repeat))] - USimpleNameReferenceExpression (identifier = repeat) [repeat] : PsiType:String + USimpleNameReferenceExpression (identifier = repeat, resolvesTo = null) [repeat] : PsiType:String ULiteralExpression (value = 4) [4] : PsiType:int ULiteralExpression (value = " z") [" z"] : PsiType:String UAnnotationMethod (name = getMuchRecur) [public static final fun getMuchRecur() : java.lang.String = UastEmptyExpression] @@ -54,17 +54,17 @@ UFile (package = ) [public final class StringTemplateComplexKt {...] UBlockExpression [{...}] : PsiType:void UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [println(baz)] : PsiType:void UIdentifier (Identifier (println)) [UIdentifier (Identifier (println))] - USimpleNameReferenceExpression (identifier = println) [println] : PsiType:void + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) [println] : PsiType:void USimpleNameReferenceExpression (identifier = baz) [baz] UDeclarationsExpression [var template1: java.lang.String = simpleForTemplate()] ULocalVariable (name = template1) [var template1: java.lang.String = simpleForTemplate()] UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [simpleForTemplate()] : PsiType:String UIdentifier (Identifier (simpleForTemplate)) [UIdentifier (Identifier (simpleForTemplate))] - USimpleNameReferenceExpression (identifier = simpleForTemplate) [simpleForTemplate] : PsiType:String + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) [simpleForTemplate] : PsiType:String UDeclarationsExpression [var template2: java.lang.String = "." + simpleForTemplate()] ULocalVariable (name = template2) [var template2: java.lang.String = "." + simpleForTemplate()] UPolyadicExpression (operator = +) ["." + simpleForTemplate()] : PsiType:String ULiteralExpression (value = ".") ["."] : PsiType:String UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [simpleForTemplate()] : PsiType:String UIdentifier (Identifier (simpleForTemplate)) [UIdentifier (Identifier (simpleForTemplate))] - USimpleNameReferenceExpression (identifier = simpleForTemplate) [simpleForTemplate] : PsiType:String + USimpleNameReferenceExpression (identifier = simpleForTemplate, resolvesTo = null) [simpleForTemplate] : PsiType:String diff --git a/plugins/uast-kotlin/testData/SuperCalls.log.txt b/plugins/uast-kotlin/testData/SuperCalls.log.txt index 6868c230648..ad7cef2cc9c 100644 --- a/plugins/uast-kotlin/testData/SuperCalls.log.txt +++ b/plugins/uast-kotlin/testData/SuperCalls.log.txt @@ -9,7 +9,7 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (cons)) - USimpleNameReferenceExpression (identifier = cons) + USimpleNameReferenceExpression (identifier = cons, resolvesTo = null) UObjectLiteralExpression ULiteralExpression (value = "inner literal") UClass (name = null) @@ -22,14 +22,14 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (A)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) ULiteralExpression (value = "inner object") UClass (name = InnerClass) UAnnotationMethod (name = InnerClass) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (A)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) ULiteralExpression (value = "inner class") UAnnotationMethod (name = getAnon) UAnnotationMethod (name = cons) @@ -53,12 +53,12 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (this)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = i) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (toString)) - USimpleNameReferenceExpression (identifier = toString) + USimpleNameReferenceExpression (identifier = toString, resolvesTo = null) UClass (name = B) UAnnotationMethod (name = B) UParameter (name = param) @@ -66,7 +66,7 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (A)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) USimpleNameReferenceExpression (identifier = param) UClass (name = C) UAnnotationMethod (name = foo) @@ -77,7 +77,7 @@ UFile (package = ) USuperExpression (label = null) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) UIdentifier (Identifier (foo)) - USimpleNameReferenceExpression (identifier = foo) + USimpleNameReferenceExpression (identifier = foo, resolvesTo = null) USimpleNameReferenceExpression (identifier = a) UAnnotationMethod (name = C) UParameter (name = p) @@ -85,7 +85,7 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (super)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) USimpleNameReferenceExpression (identifier = p) UAnnotationMethod (name = C) UParameter (name = i) @@ -93,11 +93,11 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (super)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) USimpleNameReferenceExpression (identifier = i) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (println)) - USimpleNameReferenceExpression (identifier = println) + USimpleNameReferenceExpression (identifier = println, resolvesTo = null) UClass (name = O) UField (name = INSTANCE) UAnnotation (fqName = null) @@ -105,5 +105,5 @@ UFile (package = ) UBlockExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (A)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = A) ULiteralExpression (value = "text") diff --git a/plugins/uast-kotlin/testData/UnexpectedContainerException.log.txt b/plugins/uast-kotlin/testData/UnexpectedContainerException.log.txt index 52906b55fa1..d86f0885bcf 100644 --- a/plugins/uast-kotlin/testData/UnexpectedContainerException.log.txt +++ b/plugins/uast-kotlin/testData/UnexpectedContainerException.log.txt @@ -13,13 +13,13 @@ UFile (package = ) UThrowExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) UIdentifier (Identifier (UnsupportedOperationException)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = UnsupportedOperationException) UAnnotationMethod (name = Model) UBlockExpression UBlockExpression UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (crashMe)) - USimpleNameReferenceExpression (identifier = crashMe) + USimpleNameReferenceExpression (identifier = crashMe, resolvesTo = null) UQualifiedReferenceExpression UClassLiteralExpression USimpleNameReferenceExpression (identifier = java) @@ -34,6 +34,6 @@ UFile (package = ) UThrowExpression UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) UIdentifier (Identifier (UnsupportedOperationException)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = UnsupportedOperationException) ULiteralExpression (value = "") UAnnotationMethod (name = Model$1$1) diff --git a/plugins/uast-kotlin/testData/UnexpectedContainerException.types.txt b/plugins/uast-kotlin/testData/UnexpectedContainerException.types.txt index b8a3c9701ef..5f1d304391c 100644 --- a/plugins/uast-kotlin/testData/UnexpectedContainerException.types.txt +++ b/plugins/uast-kotlin/testData/UnexpectedContainerException.types.txt @@ -13,13 +13,13 @@ UFile (package = ) [public abstract interface Callback {...] UThrowExpression [throw ()] : PsiType:Void UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [()] : PsiType:UnsupportedOperationException UIdentifier (Identifier (UnsupportedOperationException)) [UIdentifier (Identifier (UnsupportedOperationException))] - USimpleNameReferenceExpression (identifier = ) [] : PsiType:UnsupportedOperationException + USimpleNameReferenceExpression (identifier = , resolvesTo = UnsupportedOperationException) [] : PsiType:UnsupportedOperationException UAnnotationMethod (name = Model) [public fun Model() {...}] UBlockExpression [{...}] UBlockExpression [{...}] : PsiType:void UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [crashMe(Callback.java, { ...})] : PsiType:void UIdentifier (Identifier (crashMe)) [UIdentifier (Identifier (crashMe))] - USimpleNameReferenceExpression (identifier = crashMe) [crashMe] : PsiType:void + USimpleNameReferenceExpression (identifier = crashMe, resolvesTo = null) [crashMe] : PsiType:void UQualifiedReferenceExpression [Callback.java] : PsiType:Class UClassLiteralExpression [Callback] : PsiType:KClass USimpleNameReferenceExpression (identifier = java) [java] : PsiType:Class @@ -34,6 +34,6 @@ UFile (package = ) [public abstract interface Callback {...] UThrowExpression [throw ("")] : PsiType:Void UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) [("")] : PsiType:UnsupportedOperationException UIdentifier (Identifier (UnsupportedOperationException)) [UIdentifier (Identifier (UnsupportedOperationException))] - USimpleNameReferenceExpression (identifier = ) [] : PsiType:UnsupportedOperationException + USimpleNameReferenceExpression (identifier = , resolvesTo = UnsupportedOperationException) [] : PsiType:UnsupportedOperationException ULiteralExpression (value = "") [""] : PsiType:String UAnnotationMethod (name = Model$1$1) [fun Model$1$1() = UastEmptyExpression] diff --git a/plugins/uast-kotlin/testData/WhenAndDestructing.log.txt b/plugins/uast-kotlin/testData/WhenAndDestructing.log.txt index 83ae1d3adc1..1d1c4d186c8 100644 --- a/plugins/uast-kotlin/testData/WhenAndDestructing.log.txt +++ b/plugins/uast-kotlin/testData/WhenAndDestructing.log.txt @@ -8,7 +8,7 @@ UFile (package = ) ULocalVariable (name = arr) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) UIdentifier (Identifier (listOf)) - USimpleNameReferenceExpression (identifier = listOf) + USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null) ULiteralExpression (value = "1") ULiteralExpression (value = "2") USwitchExpression @@ -32,14 +32,14 @@ UFile (package = ) USimpleNameReferenceExpression (identifier = var837f1e82) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (component1)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) ULocalVariable (name = statementFilter) UAnnotation (fqName = null) UQualifiedReferenceExpression USimpleNameReferenceExpression (identifier = var837f1e82) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (component2)) - USimpleNameReferenceExpression (identifier = ) + USimpleNameReferenceExpression (identifier = , resolvesTo = null) UReturnExpression USimpleNameReferenceExpression (identifier = bindingContext) UBreakExpression (label = null) diff --git a/plugins/uast-kotlin/testData/WhenStringLiteral.log.txt b/plugins/uast-kotlin/testData/WhenStringLiteral.log.txt index 6976fdd45ba..001ebb0f2e2 100644 --- a/plugins/uast-kotlin/testData/WhenStringLiteral.log.txt +++ b/plugins/uast-kotlin/testData/WhenStringLiteral.log.txt @@ -4,7 +4,7 @@ UFile (package = ) UAnnotation (fqName = org.jetbrains.annotations.Nullable) UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) UIdentifier (Identifier (readLine)) - USimpleNameReferenceExpression (identifier = readLine) + USimpleNameReferenceExpression (identifier = readLine, resolvesTo = null) UField (name = b) UAnnotation (fqName = org.jetbrains.annotations.NotNull) USwitchExpression diff --git a/plugins/uast-kotlin/testData/ea101715.types.txt b/plugins/uast-kotlin/testData/ea101715.types.txt index 37644126bc9..161061eebf3 100644 --- a/plugins/uast-kotlin/testData/ea101715.types.txt +++ b/plugins/uast-kotlin/testData/ea101715.types.txt @@ -6,7 +6,7 @@ UFile (package = ) [public final class Ea101715Kt {...] ULocalVariable (name = a) [var a: = Obj(555)] UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [Obj(555)] UIdentifier (Identifier (Obj)) [UIdentifier (Identifier (Obj))] - USimpleNameReferenceExpression (identifier = Obj) [Obj] + USimpleNameReferenceExpression (identifier = Obj, resolvesTo = null) [Obj] ULiteralExpression (value = 555) [555] : PsiType:int UClass (name = Obj) [public final class Obj {...}] UField (name = INSTANCE) [@null public static final var INSTANCE: Obj]