Uast: KotlinIDERenderLogTest for running UAST tests with ULC
In case of result difference the `-ide`-suffixed testdata is used. Actually the difference in results is more likely to be a bug but currently we are fixating at least some behaviour to protect from unexpected regressions in Ultra Light Classes. `object Local` were removed because there is no local objects in actual Kotlin syntax
This commit is contained in:
@@ -19,7 +19,7 @@ package org.jetbrains.uast.kotlin
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiMethod
|
||||
import org.jetbrains.kotlin.asJava.LightClassUtil
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForLocalDeclaration
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
|
||||
import org.jetbrains.kotlin.asJava.toLightGetter
|
||||
import org.jetbrains.kotlin.asJava.toLightSetter
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isPropertyParameter
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.kotlin.expressions.KotlinLocalFunctionULambdaExpression
|
||||
import org.jetbrains.uast.kotlin.expressions.KotlinUElvisExpression
|
||||
@@ -61,9 +62,10 @@ abstract class KotlinAbstractUElement(private val givenParent: UElement?) : Kotl
|
||||
|
||||
}
|
||||
|
||||
if (psi is KtLightClassForLocalDeclaration) {
|
||||
val originParent = psi.kotlinOrigin.parent
|
||||
if (psi is KtLightElement<*, *> && sourcePsi.safeAs<KtClassOrObject>()?.isLocal == true) {
|
||||
val originParent = psi.kotlinOrigin?.parent
|
||||
parent = when (originParent) {
|
||||
null -> parent
|
||||
is KtClassBody -> originParent.parent
|
||||
else -> originParent
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiEnumConstant
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
@@ -450,7 +451,7 @@ internal object KotlinConverter {
|
||||
|
||||
private fun convertEnumEntry(original: KtEnumEntry, givenParent: UElement?): UElement? {
|
||||
return LightClassUtil.getLightClassBackingField(original)?.let { psiField ->
|
||||
if (psiField is KtLightFieldImpl.KtLightEnumConstant) {
|
||||
if (psiField is KtLightField && psiField is PsiEnumConstant) {
|
||||
KotlinUEnumConstant(psiField, psiField.kotlinOrigin, givenParent)
|
||||
} else {
|
||||
null
|
||||
@@ -489,8 +490,11 @@ internal object KotlinConverter {
|
||||
}
|
||||
else -> el<UClass> { KotlinUClass.create(original, givenParent) }
|
||||
}
|
||||
is KtLightFieldImpl.KtLightEnumConstant -> el<UEnumConstant>(buildKtOpt(original.kotlinOrigin, ::KotlinUEnumConstant))
|
||||
is KtLightField -> el<UField>(buildKtOpt(original.kotlinOrigin, ::KotlinUField))
|
||||
is KtLightField ->
|
||||
if (original is PsiEnumConstant)
|
||||
el<UEnumConstant>(buildKtOpt(original.kotlinOrigin, ::KotlinUEnumConstant))
|
||||
else
|
||||
el<UField>(buildKtOpt(original.kotlinOrigin, ::KotlinUField))
|
||||
is KtLightParameter -> el<UParameter>(buildKtOpt(original.kotlinOrigin, ::KotlinUParameter))
|
||||
is UastKotlinPsiParameter -> el<UParameter>(buildKt(original.ktParameter, ::KotlinUParameter))
|
||||
is UastKotlinPsiVariable -> el<UVariable>(buildKt(original.ktElement, ::KotlinUVariable))
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
UFile (package = )
|
||||
UImportStatement (isOnDemand = false)
|
||||
UImportStatement (isOnDemand = false)
|
||||
UClass (name = AnonymousKt)
|
||||
UMethod (name = foo)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = runnable)
|
||||
UObjectLiteralExpression
|
||||
UClass (name = null)
|
||||
UMethod (name = run)
|
||||
UBlockExpression
|
||||
UMethod (name = )
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = runnable)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (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, resolvesTo = Runnable)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = closeableRunnable)
|
||||
UObjectLiteralExpression
|
||||
UClass (name = null)
|
||||
UMethod (name = close)
|
||||
UBlockExpression
|
||||
UMethod (name = run)
|
||||
UBlockExpression
|
||||
UMethod (name = )
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = runnableIs)
|
||||
UObjectLiteralExpression
|
||||
UClass (name = null)
|
||||
UMethod (name = read)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 0)
|
||||
UMethod (name = run)
|
||||
UBlockExpression
|
||||
UMethod (name = )
|
||||
UMethod (name = withErr)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = runnable)
|
||||
UObjectLiteralExpression
|
||||
UClass (name = <invalid object code>)
|
||||
@@ -0,0 +1,49 @@
|
||||
UFile (package = )
|
||||
UClass (name = ConstructorDelegateKt)
|
||||
UMethod (name = createBase)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (BaseImpl))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = BaseImpl)
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UClass (name = Base)
|
||||
UMethod (name = print)
|
||||
UClass (name = BaseImpl)
|
||||
UField (name = x)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = print)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (print))
|
||||
USimpleNameReferenceExpression (identifier = print, resolvesTo = null)
|
||||
USimpleNameReferenceExpression (identifier = x)
|
||||
UMethod (name = getX)
|
||||
UMethod (name = BaseImpl)
|
||||
UParameter (name = x)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UClass (name = Derived)
|
||||
UExpressionList (super_delegation)
|
||||
UTypeReferenceExpression (name = Base)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (createBase))
|
||||
USimpleNameReferenceExpression (identifier = createBase, resolvesTo = null)
|
||||
ULiteralExpression (value = 10)
|
||||
UExpressionList (super_delegation)
|
||||
UTypeReferenceExpression (name = java.lang.CharSequence)
|
||||
ULiteralExpression (value = "abc")
|
||||
UMethod (name = Derived)
|
||||
UParameter (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = print)
|
||||
UMethod (name = getLength)
|
||||
UMethod (name = get)
|
||||
UParameter (name = index)
|
||||
UAnnotation (fqName = null)
|
||||
UMethod (name = subSequence)
|
||||
UParameter (name = startIndex)
|
||||
UAnnotation (fqName = null)
|
||||
UParameter (name = endIndex)
|
||||
UAnnotation (fqName = null)
|
||||
@@ -0,0 +1,26 @@
|
||||
public final class ConstructorDelegateKt {
|
||||
public static final fun createBase(@org.jetbrains.annotations.NotNull i: int) : Base {
|
||||
return <init>(i)
|
||||
}
|
||||
}
|
||||
|
||||
public abstract interface Base {
|
||||
public abstract fun print() : void = UastEmptyExpression
|
||||
}
|
||||
|
||||
public final class BaseImpl : Base {
|
||||
@org.jetbrains.annotations.NotNull private final var x: int
|
||||
public fun print() : void {
|
||||
print(x)
|
||||
}
|
||||
public final fun getX() : int = UastEmptyExpression
|
||||
public fun BaseImpl(@org.jetbrains.annotations.NotNull x: int) = UastEmptyExpression
|
||||
}
|
||||
|
||||
public final class Derived : Base, java.lang.CharSequence {
|
||||
public fun Derived(@org.jetbrains.annotations.NotNull b: Base) = UastEmptyExpression
|
||||
public fun print() : void = UastEmptyExpression
|
||||
public fun getLength() : int = UastEmptyExpression
|
||||
public fun get(@null index: int) : char = UastEmptyExpression
|
||||
public fun subSequence(@null startIndex: int, @null endIndex: int) : java.lang.CharSequence = UastEmptyExpression
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
UFile (package = )
|
||||
UClass (name = A)
|
||||
UField (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = getStr)
|
||||
UMethod (name = A)
|
||||
UParameter (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = A)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (this))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toString))
|
||||
USimpleNameReferenceExpression (identifier = toString, resolvesTo = null)
|
||||
UClass (name = AWithInit)
|
||||
UField (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = getStr)
|
||||
UMethod (name = AWithInit)
|
||||
UParameter (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (println))
|
||||
USimpleNameReferenceExpression (identifier = println, resolvesTo = null)
|
||||
UMethod (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 = <init>, resolvesTo = AWithInit)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toString))
|
||||
USimpleNameReferenceExpression (identifier = toString, resolvesTo = null)
|
||||
UClass (name = AWith2Init)
|
||||
UField (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = getStr)
|
||||
UMethod (name = AWith2Init)
|
||||
UParameter (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
ULiteralExpression (value = 2)
|
||||
UMethod (name = AWith2Init)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (this))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = AWith2Init)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toString))
|
||||
USimpleNameReferenceExpression (identifier = toString, resolvesTo = null)
|
||||
UClass (name = AOnlyInit)
|
||||
UMethod (name = AOnlyInit)
|
||||
UBlockExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
ULiteralExpression (value = 2)
|
||||
UClass (name = AWithSecondary)
|
||||
UField (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = getA)
|
||||
UMethod (name = setA)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = AWithSecondary)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier ())
|
||||
USimpleNameReferenceExpression (identifier = <init>, 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, resolvesTo = null)
|
||||
UMethod (name = AWithSecondary)
|
||||
UParameter (name = s)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier ())
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Object)
|
||||
UBinaryExpression (operator = =)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = s)
|
||||
UClass (name = AWithSecondaryInit)
|
||||
UField (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = getA)
|
||||
UMethod (name = setA)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = AWithSecondaryInit)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier ())
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Object)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
UMethod (name = AWithSecondaryInit)
|
||||
UParameter (name = s)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier ())
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Object)
|
||||
UBinaryExpression (operator = =)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = s)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = local)
|
||||
USimpleNameReferenceExpression (identifier = s)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = local)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toString))
|
||||
USimpleNameReferenceExpression (identifier = toString, resolvesTo = null)
|
||||
@@ -0,0 +1,81 @@
|
||||
public final class A {
|
||||
@org.jetbrains.annotations.NotNull private final var str: java.lang.String
|
||||
public final fun getStr() : java.lang.String = UastEmptyExpression
|
||||
public fun A(@org.jetbrains.annotations.NotNull str: java.lang.String) = UastEmptyExpression
|
||||
public fun A(@org.jetbrains.annotations.NotNull i: int) {
|
||||
<init>(i.toString())
|
||||
}
|
||||
}
|
||||
|
||||
public final class AWithInit {
|
||||
@org.jetbrains.annotations.NotNull private final var str: java.lang.String
|
||||
public final fun getStr() : java.lang.String = UastEmptyExpression
|
||||
public fun AWithInit(@org.jetbrains.annotations.NotNull str: java.lang.String) {
|
||||
{
|
||||
println()
|
||||
}
|
||||
}
|
||||
public fun AWithInit(@org.jetbrains.annotations.NotNull i: int) {
|
||||
<init>(i.toString())
|
||||
}
|
||||
}
|
||||
|
||||
public final class AWith2Init {
|
||||
@org.jetbrains.annotations.NotNull private final var str: java.lang.String
|
||||
public final fun getStr() : java.lang.String = UastEmptyExpression
|
||||
public fun AWith2Init(@org.jetbrains.annotations.NotNull str: java.lang.String) {
|
||||
{
|
||||
println(1)
|
||||
}
|
||||
{
|
||||
println(2)
|
||||
}
|
||||
}
|
||||
public fun AWith2Init(@org.jetbrains.annotations.NotNull i: int) {
|
||||
<init>(i.toString())
|
||||
}
|
||||
}
|
||||
|
||||
public final class AOnlyInit {
|
||||
public fun AOnlyInit() {
|
||||
{
|
||||
println(1)
|
||||
}
|
||||
{
|
||||
println(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class AWithSecondary {
|
||||
@org.jetbrains.annotations.NotNull public var a: java.lang.String
|
||||
public final fun getA() : java.lang.String = UastEmptyExpression
|
||||
public final fun setA(@org.jetbrains.annotations.NotNull a: java.lang.String) : void = UastEmptyExpression
|
||||
public fun AWithSecondary(@org.jetbrains.annotations.NotNull i: int) {
|
||||
<init>()
|
||||
a = i.toString()
|
||||
}
|
||||
public fun AWithSecondary(@org.jetbrains.annotations.NotNull s: java.lang.String) {
|
||||
<init>()
|
||||
a = s
|
||||
}
|
||||
}
|
||||
|
||||
public final class AWithSecondaryInit {
|
||||
@org.jetbrains.annotations.NotNull public var a: java.lang.String
|
||||
public final fun getA() : java.lang.String = UastEmptyExpression
|
||||
public final fun setA(@org.jetbrains.annotations.NotNull a: java.lang.String) : void = UastEmptyExpression
|
||||
public fun AWithSecondaryInit(@org.jetbrains.annotations.NotNull i: int) {
|
||||
<init>()
|
||||
{
|
||||
println()
|
||||
}
|
||||
a = i.toString()
|
||||
}
|
||||
public fun AWithSecondaryInit(@org.jetbrains.annotations.NotNull s: java.lang.String) {
|
||||
<init>()
|
||||
a = s
|
||||
var local: java.lang.String = s
|
||||
local.toString()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
UFile (package = )
|
||||
UClass (name = DestructuringDeclarationKt)
|
||||
UMethod (name = foo)
|
||||
UParameter (name = data)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = var268d41a5)
|
||||
UAnnotation (fqName = null)
|
||||
UBinaryExpression (operator = <other>)
|
||||
ULiteralExpression (value = "foo")
|
||||
ULiteralExpression (value = 1)
|
||||
ULocalVariable (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var268d41a5)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component1))
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, resolvesTo = null)
|
||||
ULocalVariable (name = b)
|
||||
UAnnotation (fqName = null)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var268d41a5)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component2))
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, resolvesTo = null)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = var465978a0)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotation (fqName = kotlin.Suppress)
|
||||
UNamedExpression (name = names)
|
||||
ULiteralExpression (value = "UNCHECKED_CAST")
|
||||
UBinaryExpressionWithType
|
||||
USimpleNameReferenceExpression (identifier = data)
|
||||
UTypeReferenceExpression (name = kotlin.Pair<? extends java.lang.String,? extends java.lang.String>)
|
||||
ULocalVariable (name = k)
|
||||
UAnnotation (fqName = null)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var465978a0)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component1))
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, resolvesTo = null)
|
||||
ULocalVariable (name = v)
|
||||
UAnnotation (fqName = null)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var465978a0)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component2))
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, resolvesTo = null)
|
||||
@@ -0,0 +1,10 @@
|
||||
public final class DestructuringDeclarationKt {
|
||||
public static final fun foo(@org.jetbrains.annotations.NotNull data: java.lang.Object) : void {
|
||||
@null var var268d41a5: <ErrorType> = "foo" <other> 1
|
||||
@null var a: java.lang.String = var268d41a5.<ERROR FUNCTION>()
|
||||
@null var b: int = var268d41a5.<ERROR FUNCTION>()
|
||||
@null @kotlin.Suppress(names = "UNCHECKED_CAST") var var465978a0: <ErrorType> = data as kotlin.Pair<? extends java.lang.String,? extends java.lang.String>
|
||||
@null var k: java.lang.String = var465978a0.<ERROR FUNCTION>()
|
||||
@null var v: java.lang.String = var465978a0.<ERROR FUNCTION>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
UFile (package = )
|
||||
UClass (name = Style)
|
||||
UField (name = value)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UEnumConstant (name = SHEET)
|
||||
UAnnotation (fqName = null)
|
||||
USimpleNameReferenceExpression (identifier = Style)
|
||||
ULiteralExpression (value = "foo")
|
||||
UClass (name = SHEET)
|
||||
UMethod (name = getExitAnimation)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = "bar")
|
||||
UMethod (name = SHEET)
|
||||
UMethod (name = getExitAnimation)
|
||||
UMethod (name = getValue)
|
||||
UMethod (name = Style)
|
||||
UParameter (name = value)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
@@ -0,0 +1,12 @@
|
||||
public enum Style {
|
||||
@org.jetbrains.annotations.NotNull private final var value: java.lang.String
|
||||
@null SHEET("foo") {
|
||||
public fun getExitAnimation() : java.lang.String {
|
||||
return "bar"
|
||||
}
|
||||
fun SHEET() = UastEmptyExpression
|
||||
}
|
||||
public abstract fun getExitAnimation() : java.lang.String = UastEmptyExpression
|
||||
public final fun getValue() : java.lang.String = UastEmptyExpression
|
||||
private fun Style(@org.jetbrains.annotations.NotNull value: java.lang.String) = UastEmptyExpression
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
UFile (package = org.jetbrains.uast.kotlin)
|
||||
UClass (name = LambdaReturnKt)
|
||||
UMethod (name = foo)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = lam1)
|
||||
ULambdaExpression
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = b)
|
||||
ULiteralExpression (value = 1)
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = +)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = b)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = lam2)
|
||||
ULambdaExpression
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = c)
|
||||
ULiteralExpression (value = 1)
|
||||
UReturnExpression
|
||||
UIfExpression
|
||||
UBinaryExpression (operator = >)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
ULiteralExpression (value = 0)
|
||||
UBinaryExpression (operator = +)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = c)
|
||||
UBinaryExpression (operator = -)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = c)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = lam3)
|
||||
ULabeledExpression (label = lbd)
|
||||
ULambdaExpression
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = d)
|
||||
ULiteralExpression (value = 1)
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = +)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = d)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = lam4)
|
||||
ULambdaExpression
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UIfExpression
|
||||
UBinaryExpression (operator = <)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
ULiteralExpression (value = 5)
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = "5")
|
||||
UIfExpression
|
||||
UBinaryExpression (operator = >)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
ULiteralExpression (value = 0)
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = "1")
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = "2")
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = lam5)
|
||||
ULambdaExpression
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = +)
|
||||
ULiteralExpression (value = "a")
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (bar))
|
||||
USimpleNameReferenceExpression (identifier = bar, resolvesTo = null)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UIfExpression
|
||||
UBinaryExpression (operator = >)
|
||||
USimpleNameReferenceExpression (identifier = it)
|
||||
ULiteralExpression (value = 5)
|
||||
UReturnExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = b)
|
||||
ULiteralExpression (value = 1)
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = +)
|
||||
USimpleNameReferenceExpression (identifier = it)
|
||||
USimpleNameReferenceExpression (identifier = b)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = x)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = vardbcd0724)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (Identifier (listOf))
|
||||
USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null)
|
||||
ULiteralExpression (value = 1)
|
||||
ULiteralExpression (value = 2)
|
||||
ULocalVariable (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = vardbcd0724)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component1))
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, resolvesTo = null)
|
||||
ULocalVariable (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = vardbcd0724)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component2))
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, resolvesTo = null)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = y)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (listOf))
|
||||
USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null)
|
||||
ULiteralExpression (value = 1)
|
||||
UMethod (name = bar)
|
||||
UParameter (name = lmbd)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (lmbd))
|
||||
USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null)
|
||||
ULiteralExpression (value = 1)
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
public final class LambdaReturnKt {
|
||||
public static final fun foo() : void {
|
||||
var lam1: kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.Integer> = { @org.jetbrains.annotations.NotNull var a: int ->
|
||||
|
||||
var b: int = 1
|
||||
return a + b
|
||||
}
|
||||
var lam2: kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.Integer> = { @org.jetbrains.annotations.NotNull var a: int ->
|
||||
|
||||
var c: int = 1
|
||||
return if (a > 0) a + c else a - c
|
||||
}
|
||||
var lam3: kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.Integer> = lbd@ { @org.jetbrains.annotations.NotNull var a: int ->
|
||||
|
||||
var d: int = 1
|
||||
return a + d
|
||||
}
|
||||
var lam4: kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.String> = fun (@org.jetbrains.annotations.NotNull var a: int) {
|
||||
if (a < 5) return "5"
|
||||
if (a > 0) return "1" else return "2"
|
||||
}
|
||||
var lam5: kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.String> = fun (@org.jetbrains.annotations.NotNull var a: int) {
|
||||
return "a" + a
|
||||
}
|
||||
bar({
|
||||
if (it > 5) return
|
||||
var b: int = 1
|
||||
return it + b
|
||||
})
|
||||
var x: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = {
|
||||
@org.jetbrains.annotations.NotNull var vardbcd0724: <ErrorType> = listOf(1, 2)
|
||||
@org.jetbrains.annotations.NotNull var a: int = vardbcd0724.<ERROR FUNCTION>()
|
||||
@org.jetbrains.annotations.NotNull var b: int = vardbcd0724.<ERROR FUNCTION>()
|
||||
}
|
||||
var y: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = {
|
||||
listOf(1)
|
||||
}
|
||||
}
|
||||
private static final fun bar(@org.jetbrains.annotations.NotNull lmbd: kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Integer>) : void {
|
||||
invoke(1)
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,6 @@
|
||||
[1]:[USimpleNameReferenceExpression (identifier = String)]
|
||||
[1]:[UIdentifier (Identifier (String))]
|
||||
[1]:[ULiteralExpression (value = 42)]
|
||||
[1]:[UClass (name = LocalObject)]
|
||||
[1]:[UIdentifier (Identifier (LocalObject))]
|
||||
[1]:[UReturnExpression]
|
||||
[1]:[UBinaryExpression (operator = ==)]
|
||||
[1]:[UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))]
|
||||
|
||||
@@ -9,7 +9,6 @@ Boolean -> USimpleNameReferenceExpression (identifier = Boolean)
|
||||
someLocalFun -> ULambdaExpression
|
||||
text -> [!] UnknownKotlinExpression (VALUE_PARAMETER)
|
||||
String -> USimpleNameReferenceExpression (identifier = String)
|
||||
LocalObject -> UClass (name = LocalObject)
|
||||
bar -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
== -> USimpleNameReferenceExpression (identifier = ==)
|
||||
Local -> UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
|
||||
@@ -8,7 +8,5 @@ fun foo(): Boolean {
|
||||
|
||||
fun Int.someLocalFun(text: String) = 42
|
||||
|
||||
object LocalObject
|
||||
|
||||
return bar() == Local()
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
UFile (package = )
|
||||
UClass (name = LocalDeclarationsKt)
|
||||
UMethod (name = foo)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
UClass (name = Local)
|
||||
UMethod (name = Local)
|
||||
UDeclarationsExpression
|
||||
UVariable (name = bar)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (Local))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Local)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = baz)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (Local))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Local)
|
||||
UDeclarationsExpression
|
||||
UVariable (name = someLocalFun)
|
||||
ULambdaExpression
|
||||
UParameter (name = text)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 42)
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = ==)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (bar))
|
||||
USimpleNameReferenceExpression (identifier = bar, resolvesTo = null)
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (Local))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Local)
|
||||
@@ -28,11 +28,6 @@ UFile (package = )
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 42)
|
||||
UDeclarationsExpression
|
||||
UClass (name = LocalObject)
|
||||
UField (name = INSTANCE)
|
||||
UAnnotation (fqName = null)
|
||||
UMethod (name = LocalDeclarationsKt$foo$LocalObject)
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = ==)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
public final class LocalDeclarationsKt {
|
||||
public static final fun foo() : boolean {
|
||||
public static final class Local {
|
||||
public fun Local() = UastEmptyExpression
|
||||
}
|
||||
var bar: <ErrorType> = fun () {
|
||||
return <init>()
|
||||
}
|
||||
var baz: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = fun () {
|
||||
<init>()
|
||||
}
|
||||
var someLocalFun: kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.String,? extends java.lang.Integer> = fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {
|
||||
return 42
|
||||
}
|
||||
return bar() == <init>()
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,6 @@ public final class LocalDeclarationsKt {
|
||||
var someLocalFun: kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.String,? extends java.lang.Integer> = fun (@org.jetbrains.annotations.NotNull var text: java.lang.String) {
|
||||
return 42
|
||||
}
|
||||
public static final class LocalObject {
|
||||
@null public static final var INSTANCE: LocalDeclarationsKt.foo.LocalObject
|
||||
private fun LocalDeclarationsKt$foo$LocalObject() = UastEmptyExpression
|
||||
}
|
||||
return bar() == <init>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,6 @@ UFile (package = ) [public final class LocalDeclarationsKt {...]
|
||||
UBlockExpression [{...}]
|
||||
UReturnExpression [return 42]
|
||||
ULiteralExpression (value = 42) [42] : PsiType:int
|
||||
UDeclarationsExpression [public static final class LocalObject {...}]
|
||||
UClass (name = LocalObject) [public static final class LocalObject {...}]
|
||||
UField (name = INSTANCE) [@null public static final var INSTANCE: LocalDeclarationsKt.foo.LocalObject]
|
||||
UAnnotation (fqName = null) [@null]
|
||||
UMethod (name = LocalDeclarationsKt$foo$LocalObject) [private fun LocalDeclarationsKt$foo$LocalObject() = UastEmptyExpression]
|
||||
UReturnExpression [return bar() == <init>()] : PsiType:Void
|
||||
UBinaryExpression (operator = ==) [bar() == <init>()] : PsiType:boolean
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] : PsiType:<ErrorType>
|
||||
|
||||
@@ -28,11 +28,6 @@ UFile (package = ) [public final class LocalDeclarationsKt {...]
|
||||
UBlockExpression [{...}] = Nothing
|
||||
UReturnExpression [return 42] = Undetermined
|
||||
ULiteralExpression (value = 42) [42] = 42
|
||||
UDeclarationsExpression [public static final class LocalObject {...}] = Undetermined
|
||||
UClass (name = LocalObject) [public static final class LocalObject {...}]
|
||||
UField (name = INSTANCE) [@null public static final var INSTANCE: LocalDeclarationsKt.foo.LocalObject]
|
||||
UAnnotation (fqName = null) [@null]
|
||||
UMethod (name = LocalDeclarationsKt$foo$LocalObject) [private fun LocalDeclarationsKt$foo$LocalObject() = UastEmptyExpression]
|
||||
UReturnExpression [return bar() == <init>()] = Nothing
|
||||
UBinaryExpression (operator = ==) [bar() == <init>()] = Undetermined
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] = external bar()()
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
UFile (package = )
|
||||
UClass (name = MyAnnotation)
|
||||
UClass (name = MyAnnotation2)
|
||||
UClass (name = MyAnnotation3)
|
||||
UClass (name = MyAnnotation4)
|
||||
UClass (name = MyAnnotation5)
|
||||
UClass (name = Test1)
|
||||
UField (name = bar)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = getBar)
|
||||
UMethod (name = setBar)
|
||||
UParameter (name = bar)
|
||||
UAnnotation (fqName = null)
|
||||
UMethod (name = Test1)
|
||||
UParameter (name = bar)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UAnnotation (fqName = MyAnnotation)
|
||||
UClass (name = Test2)
|
||||
UField (name = bar)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UAnnotation (fqName = MyAnnotation5)
|
||||
UMethod (name = getBar)
|
||||
UAnnotation (fqName = MyAnnotation)
|
||||
UMethod (name = setBar)
|
||||
UAnnotation (fqName = MyAnnotation2)
|
||||
UParameter (name = bar)
|
||||
UAnnotation (fqName = MyAnnotation3)
|
||||
UAnnotation (fqName = null)
|
||||
UMethod (name = Test2)
|
||||
UParameter (name = bar)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
@@ -0,0 +1,30 @@
|
||||
public abstract annotation MyAnnotation {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation2 {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation3 {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation4 {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation5 {
|
||||
}
|
||||
|
||||
public final class Test1 {
|
||||
@org.jetbrains.annotations.NotNull private var bar: int
|
||||
public final fun getBar() : int = UastEmptyExpression
|
||||
public final fun setBar(@null bar: int) : void = UastEmptyExpression
|
||||
public fun Test1(@org.jetbrains.annotations.NotNull @MyAnnotation bar: int) = UastEmptyExpression
|
||||
}
|
||||
|
||||
public final class Test2 {
|
||||
@org.jetbrains.annotations.NotNull @MyAnnotation5 private var bar: int
|
||||
@MyAnnotation
|
||||
public final fun getBar() : int = UastEmptyExpression
|
||||
@MyAnnotation2
|
||||
public final fun setBar(@MyAnnotation3 @null bar: int) : void = UastEmptyExpression
|
||||
public fun Test2(@org.jetbrains.annotations.NotNull bar: int) = UastEmptyExpression
|
||||
}
|
||||
+1
-1
@@ -31,5 +31,5 @@ open class Parent(a: String, b: Int)
|
||||
|
||||
fun objectLiteral() {
|
||||
|
||||
object : Parent(b = 1, a = "foo")
|
||||
object : Parent(b = 1, a = "foo") { }
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
UFile (package = )
|
||||
UClass (name = ParametersDisorderKt)
|
||||
UMethod (name = global)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UMethod (name = withDefault)
|
||||
UParameter (name = c)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
ULiteralExpression (value = 1)
|
||||
UParameter (name = d)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
ULiteralExpression (value = "aaa")
|
||||
UBlockExpression
|
||||
UMethod (name = withReceiver)
|
||||
UParameter (name = $this$withReceiver)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UMethod (name = call)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
ULiteralExpression (value = "bbb")
|
||||
UQualifiedReferenceExpression
|
||||
ULiteralExpression (value = "abc")
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
ULiteralExpression (value = 1.3)
|
||||
ULiteralExpression (value = 3.4)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (Identifier (unresolvedMethod))
|
||||
USimpleNameReferenceExpression (identifier = <anonymous class>, resolvesTo = null)
|
||||
ULiteralExpression (value = "param1")
|
||||
ULiteralExpression (value = "param2")
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = java)
|
||||
USimpleNameReferenceExpression (identifier = lang)
|
||||
USimpleNameReferenceExpression (identifier = String)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 4))
|
||||
UIdentifier (Identifier (format))
|
||||
USimpleNameReferenceExpression (identifier = format, resolvesTo = null)
|
||||
ULiteralExpression (value = "%i %i %i")
|
||||
ULiteralExpression (value = 1)
|
||||
ULiteralExpression (value = 2)
|
||||
ULiteralExpression (value = 3)
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = java)
|
||||
USimpleNameReferenceExpression (identifier = lang)
|
||||
USimpleNameReferenceExpression (identifier = String)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
ULiteralExpression (value = 1)
|
||||
ULiteralExpression (value = 2)
|
||||
ULiteralExpression (value = 3)
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = java)
|
||||
USimpleNameReferenceExpression (identifier = lang)
|
||||
USimpleNameReferenceExpression (identifier = String)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 3))
|
||||
UIdentifier (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, 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, resolvesTo = null)
|
||||
ULiteralExpression (value = 4)
|
||||
ULiteralExpression (value = 5)
|
||||
ULiteralExpression (value = 6)
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = java)
|
||||
USimpleNameReferenceExpression (identifier = lang)
|
||||
USimpleNameReferenceExpression (identifier = String)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
ULiteralExpression (value = 2)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toTypedArray))
|
||||
USimpleNameReferenceExpression (identifier = toTypedArray, resolvesTo = null)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (Identifier (with))
|
||||
USimpleNameReferenceExpression (identifier = with, resolvesTo = null)
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (A))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UQualifiedReferenceExpression
|
||||
ULiteralExpression (value = "def")
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (Identifier (with2Receivers))
|
||||
USimpleNameReferenceExpression (identifier = with2Receivers, resolvesTo = null)
|
||||
ULiteralExpression (value = 8)
|
||||
ULiteralExpression (value = 7.0)
|
||||
UMethod (name = objectLiteral)
|
||||
UBlockExpression
|
||||
UObjectLiteralExpression
|
||||
ULiteralExpression (value = 1)
|
||||
ULiteralExpression (value = "foo")
|
||||
UClass (name = null)
|
||||
UMethod (name = )
|
||||
UClass (name = A)
|
||||
UMethod (name = with2Receivers)
|
||||
UParameter (name = $this$with2Receivers)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UMethod (name = A)
|
||||
UClass (name = Parent)
|
||||
UMethod (name = Parent)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
@@ -20,8 +20,7 @@ public final class ParametersDisorderKt {
|
||||
})
|
||||
}
|
||||
public static final fun objectLiteral() : void {
|
||||
anonymous object : Parent(b = 1, a = "foo")
|
||||
|
||||
anonymous object : Parent(b = 1, a = "foo") { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
UFile (package = )
|
||||
UClass (name = TestPropertyInitializer)
|
||||
UMethod (name = getWithSetter)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
USimpleNameReferenceExpression (identifier = field)
|
||||
UMethod (name = setWithSetter)
|
||||
UParameter (name = p)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UBinaryExpression (operator = =)
|
||||
USimpleNameReferenceExpression (identifier = field)
|
||||
USimpleNameReferenceExpression (identifier = p)
|
||||
UMethod (name = TestPropertyInitializer)
|
||||
@@ -0,0 +1,9 @@
|
||||
public final class TestPropertyInitializer {
|
||||
public final fun getWithSetter() : java.lang.String {
|
||||
return field
|
||||
}
|
||||
public final fun setWithSetter(@org.jetbrains.annotations.NotNull p: java.lang.String) : void {
|
||||
field = p
|
||||
}
|
||||
public fun TestPropertyInitializer() = UastEmptyExpression
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
UFile (package = )
|
||||
UClass (name = PropertyInitializerWithoutSetterKt)
|
||||
UField (name = withoutSetter)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
ULiteralExpression (value = "/sdcard")
|
||||
UMethod (name = getWithoutSetter)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
USimpleNameReferenceExpression (identifier = field)
|
||||
UMethod (name = setWithoutSetter)
|
||||
UParameter (name = withoutSetter)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
@@ -0,0 +1,7 @@
|
||||
public final class PropertyInitializerWithoutSetterKt {
|
||||
@org.jetbrains.annotations.NotNull private static var withoutSetter: java.lang.String = "/sdcard"
|
||||
public static final fun getWithoutSetter() : java.lang.String {
|
||||
return field
|
||||
}
|
||||
public static final fun setWithoutSetter(@org.jetbrains.annotations.NotNull withoutSetter: java.lang.String) : void = UastEmptyExpression
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
UFile (package = )
|
||||
UClass (name = PropertyWithAnnotationKt)
|
||||
UField (name = prop1)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UAnnotation (fqName = TestAnnotation)
|
||||
ULiteralExpression (value = 0)
|
||||
UMethod (name = getProp1)
|
||||
UMethod (name = getProp2)
|
||||
UAnnotation (fqName = TestAnnotation)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 0)
|
||||
UMethod (name = getProp3)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 0)
|
||||
UMethod (name = setProp3)
|
||||
UAnnotation (fqName = TestAnnotation)
|
||||
UParameter (name = value)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UBinaryExpression (operator = =)
|
||||
USimpleNameReferenceExpression (identifier = field)
|
||||
USimpleNameReferenceExpression (identifier = value)
|
||||
UClass (name = TestAnnotation)
|
||||
@@ -0,0 +1,18 @@
|
||||
public final class PropertyWithAnnotationKt {
|
||||
@org.jetbrains.annotations.NotNull @TestAnnotation private static final var prop1: int = 0
|
||||
public static final fun getProp1() : int = UastEmptyExpression
|
||||
@TestAnnotation
|
||||
public static final fun getProp2() : int {
|
||||
return 0
|
||||
}
|
||||
public static final fun getProp3() : int {
|
||||
return 0
|
||||
}
|
||||
@TestAnnotation
|
||||
public static final fun setProp3(@org.jetbrains.annotations.NotNull value: int) : void {
|
||||
field = value
|
||||
}
|
||||
}
|
||||
|
||||
public abstract annotation TestAnnotation {
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
UFile (package = )
|
||||
UClass (name = SimpleScript)
|
||||
UMethod (name = getBarOrNull)
|
||||
UParameter (name = flag)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UIfExpression
|
||||
USimpleNameReferenceExpression (identifier = flag)
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (Bar))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Bar)
|
||||
ULiteralExpression (value = 42)
|
||||
ULiteralExpression (value = null)
|
||||
UMethod (name = main)
|
||||
UParameter (name = strings)
|
||||
UAnnotation (fqName = null)
|
||||
UMethod (name = SimpleScript)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (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, resolvesTo = null)
|
||||
ULiteralExpression (value = true)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (println))
|
||||
USimpleNameReferenceExpression (identifier = println, resolvesTo = null)
|
||||
ULiteralExpression (value = "Goodbye World!")
|
||||
UClass (name = Bar)
|
||||
UField (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
ULiteralExpression (value = 0)
|
||||
UField (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = getB)
|
||||
UMethod (name = getAPlusB)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = +)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = b)
|
||||
UMethod (name = getA)
|
||||
UMethod (name = Bar)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UClass (name = Baz)
|
||||
UMethod (name = doSomething)
|
||||
UBlockExpression
|
||||
UMethod (name = Baz)
|
||||
@@ -0,0 +1,26 @@
|
||||
public class SimpleScript {
|
||||
public final fun getBarOrNull(@org.jetbrains.annotations.NotNull flag: boolean) : SimpleScript.Bar {
|
||||
return if (flag) <init>(42) else null
|
||||
}
|
||||
public static final fun main(@null strings: java.lang.String[]) : void = UastEmptyExpression
|
||||
public fun SimpleScript() {
|
||||
println("Hello World!")
|
||||
getBarOrNull(true)
|
||||
println("Goodbye World!")
|
||||
}
|
||||
public static final class Bar {
|
||||
@org.jetbrains.annotations.NotNull private final var b: int = 0
|
||||
@org.jetbrains.annotations.NotNull private final var a: int
|
||||
public final fun getB() : int = UastEmptyExpression
|
||||
public final fun getAPlusB() : int {
|
||||
return a + b
|
||||
}
|
||||
public final fun getA() : int = UastEmptyExpression
|
||||
public fun Bar(@org.jetbrains.annotations.NotNull a: int) = UastEmptyExpression
|
||||
public static final class Baz {
|
||||
public final fun doSomething() : void {
|
||||
}
|
||||
public fun Baz() = UastEmptyExpression
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,6 @@ bar -> UMethod (name = bar)
|
||||
cons -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
object -> UClass (name = null)
|
||||
A -> UObjectLiteralExpression
|
||||
innerObject -> UClass (name = innerObject)
|
||||
A -> UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
InnerClass -> UClass (name = InnerClass)
|
||||
A -> UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
cons -> UMethod (name = cons)
|
||||
|
||||
+1
-3
@@ -24,11 +24,9 @@ object O : A("text")
|
||||
|
||||
val anon = object : A("textForAnon") {
|
||||
fun bar() {
|
||||
cons(object : A("inner literal"))
|
||||
cons(object : A("inner literal") { })
|
||||
}
|
||||
|
||||
object innerObject : A("inner object")
|
||||
|
||||
inner class InnerClass : A("inner class")
|
||||
}
|
||||
|
||||
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
UFile (package = )
|
||||
UClass (name = SuperCallsKt)
|
||||
UField (name = anon)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UObjectLiteralExpression
|
||||
ULiteralExpression (value = "textForAnon")
|
||||
UClass (name = null)
|
||||
UMethod (name = bar)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (cons))
|
||||
USimpleNameReferenceExpression (identifier = cons, resolvesTo = null)
|
||||
UObjectLiteralExpression
|
||||
ULiteralExpression (value = "inner literal")
|
||||
UClass (name = null)
|
||||
UMethod (name = )
|
||||
UMethod (name = )
|
||||
UClass (name = InnerClass)
|
||||
UMethod (name = InnerClass)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (A))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
ULiteralExpression (value = "inner class")
|
||||
UMethod (name = getAnon)
|
||||
UMethod (name = cons)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UClass (name = A)
|
||||
UField (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = foo)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UMethod (name = getStr)
|
||||
UMethod (name = A)
|
||||
UParameter (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = A)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (this))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toString))
|
||||
USimpleNameReferenceExpression (identifier = toString, resolvesTo = null)
|
||||
UClass (name = B)
|
||||
UMethod (name = B)
|
||||
UParameter (name = param)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (A))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
USimpleNameReferenceExpression (identifier = param)
|
||||
UClass (name = C)
|
||||
UMethod (name = foo)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UQualifiedReferenceExpression
|
||||
USuperExpression (label = null)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (foo))
|
||||
USimpleNameReferenceExpression (identifier = foo, resolvesTo = null)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
UMethod (name = C)
|
||||
UParameter (name = p)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (super))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
USimpleNameReferenceExpression (identifier = p)
|
||||
UMethod (name = C)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (super))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (println))
|
||||
USimpleNameReferenceExpression (identifier = println, resolvesTo = null)
|
||||
UClass (name = O)
|
||||
UField (name = INSTANCE)
|
||||
UAnnotation (fqName = null)
|
||||
UMethod (name = O)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (A))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
ULiteralExpression (value = "text")
|
||||
@@ -15,15 +15,6 @@ UFile (package = )
|
||||
UClass (name = null)
|
||||
UMethod (name = SuperCallsKt$anon$1$bar$1)
|
||||
UMethod (name = SuperCallsKt$anon$1)
|
||||
UClass (name = innerObject)
|
||||
UField (name = INSTANCE)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UMethod (name = innerObject)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (A))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = A)
|
||||
ULiteralExpression (value = "inner object")
|
||||
UClass (name = InnerClass)
|
||||
UMethod (name = InnerClass)
|
||||
UBlockExpression
|
||||
|
||||
@@ -24,5 +24,4 @@ cons -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
A -> USimpleNameReferenceExpression (identifier = A) from KtObjectLiteralExpression
|
||||
A -> UObjectLiteralExpression from KtNameReferenceExpression
|
||||
A -> UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) from KtNameReferenceExpression
|
||||
A -> UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) from KtNameReferenceExpression
|
||||
A -> USimpleNameReferenceExpression (identifier = A) from KtNameReferenceExpression
|
||||
|
||||
+1
-3
@@ -1,11 +1,9 @@
|
||||
public final class SuperCallsKt {
|
||||
@org.jetbrains.annotations.NotNull private static final var anon: A = anonymous object : A("textForAnon") {
|
||||
fun bar() {
|
||||
cons(object : A("inner literal"))
|
||||
cons(object : A("inner literal") { })
|
||||
}
|
||||
|
||||
object innerObject : A("inner object")
|
||||
|
||||
inner class InnerClass : A("inner class")
|
||||
}
|
||||
public static final fun getAnon() : A = UastEmptyExpression
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
UFile (package = test.pkg)
|
||||
UClass (name = SuspendKt)
|
||||
UMethod (name = top)
|
||||
UParameter (name = $completion)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UQualifiedReferenceExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (Context))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = Context)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (inner))
|
||||
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
|
||||
UClass (name = Context)
|
||||
UMethod (name = inner)
|
||||
UParameter (name = $completion)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (suspendPrivate))
|
||||
USimpleNameReferenceExpression (identifier = suspendPrivate, resolvesTo = null)
|
||||
UMethod (name = Context)
|
||||
UMethod (name = suspendPrivate)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (inner))
|
||||
USimpleNameReferenceExpression (identifier = inner, resolvesTo = null)
|
||||
@@ -0,0 +1,17 @@
|
||||
package test.pkg
|
||||
|
||||
public final class SuspendKt {
|
||||
public static final fun top(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
|
||||
return <init>().inner()
|
||||
}
|
||||
}
|
||||
|
||||
public final class Context {
|
||||
public final fun inner(@org.jetbrains.annotations.NotNull $completion: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
|
||||
return suspendPrivate()
|
||||
}
|
||||
public fun Context() = UastEmptyExpression
|
||||
fun suspendPrivate() : int {
|
||||
return inner()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
UFile (package = )
|
||||
UClass (name = Callback)
|
||||
UMethod (name = onError)
|
||||
UParameter (name = throwable)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UClass (name = Model)
|
||||
UMethod (name = crashMe)
|
||||
UParameter (name = clazz)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = factory)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UThrowExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (UnsupportedOperationException))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = UnsupportedOperationException)
|
||||
UMethod (name = Model)
|
||||
UBlockExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (Identifier (crashMe))
|
||||
USimpleNameReferenceExpression (identifier = crashMe, resolvesTo = null)
|
||||
UQualifiedReferenceExpression
|
||||
UClassLiteralExpression
|
||||
USimpleNameReferenceExpression (identifier = java)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UObjectLiteralExpression
|
||||
UClass (name = null)
|
||||
UMethod (name = onError)
|
||||
UParameter (name = throwable)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UThrowExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (UnsupportedOperationException))
|
||||
USimpleNameReferenceExpression (identifier = <init>, resolvesTo = UnsupportedOperationException)
|
||||
ULiteralExpression (value = "")
|
||||
UMethod (name = )
|
||||
@@ -0,0 +1,45 @@
|
||||
UFile (package = )
|
||||
UClass (name = WhenAndDestructingKt)
|
||||
UMethod (name = getElementsAdditionalResolve)
|
||||
UParameter (name = string)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = arr)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (Identifier (listOf))
|
||||
USimpleNameReferenceExpression (identifier = listOf, resolvesTo = null)
|
||||
ULiteralExpression (value = "1")
|
||||
ULiteralExpression (value = "2")
|
||||
USwitchExpression
|
||||
USimpleNameReferenceExpression (identifier = string)
|
||||
UExpressionList (when)
|
||||
USwitchClauseExpressionWithBody
|
||||
ULiteralExpression (value = "aaaa")
|
||||
UExpressionList (when_entry)
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = "bindingContext")
|
||||
UBreakExpression (label = null)
|
||||
USwitchClauseExpressionWithBody
|
||||
UExpressionList (when_entry)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = var837f1e82)
|
||||
UAnnotation (fqName = null)
|
||||
USimpleNameReferenceExpression (identifier = arr)
|
||||
ULocalVariable (name = bindingContext)
|
||||
UAnnotation (fqName = null)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var837f1e82)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component1))
|
||||
USimpleNameReferenceExpression (identifier = <ERROR FUNCTION>, 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 = <ERROR FUNCTION>, resolvesTo = null)
|
||||
UReturnExpression
|
||||
USimpleNameReferenceExpression (identifier = bindingContext)
|
||||
UBreakExpression (label = null)
|
||||
@@ -0,0 +1,21 @@
|
||||
public final class WhenAndDestructingKt {
|
||||
public static final fun getElementsAdditionalResolve(@org.jetbrains.annotations.NotNull string: java.lang.String) : java.lang.String {
|
||||
var arr: java.util.List<? extends java.lang.String> = listOf("1", "2")
|
||||
switch (string) {
|
||||
"aaaa" -> {
|
||||
return "bindingContext"
|
||||
break
|
||||
}
|
||||
|
||||
-> {
|
||||
@null var var837f1e82: <ErrorType> = arr
|
||||
@null var bindingContext: java.lang.String = var837f1e82.<ERROR FUNCTION>()
|
||||
@null var statementFilter: java.lang.String = var837f1e82.<ERROR FUNCTION>()
|
||||
return bindingContext
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import kotlin.test.assertNotNull
|
||||
abstract class AbstractKotlinIdentifiersTest : AbstractKotlinUastTest(), IdentifiersTestBase {
|
||||
|
||||
private fun getTestFile(testName: String, ext: String) =
|
||||
File(File(AbstractKotlinUastTest.TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
|
||||
override fun getIdentifiersFile(testName: String): File = getTestFile(testName, "identifiers.txt")
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import com.intellij.util.PairProcessor
|
||||
import com.intellij.util.ref.DebugReflectionUtil
|
||||
import junit.framework.TestCase
|
||||
import junit.framework.TestCase.*
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
@@ -26,9 +27,9 @@ import org.junit.Assert
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
abstract class AbstractKotlinRenderLogTest : AbstractKotlinUastTest(), RenderLogTestBase {
|
||||
interface AbstractKotlinRenderLogTest : RenderLogTestBase {
|
||||
override fun getTestFile(testName: String, ext: String) =
|
||||
File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
|
||||
override fun check(testName: String, file: UFile) {
|
||||
check(testName, file, true)
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.io.File
|
||||
abstract class AbstractKotlinResolveEverythingTest : AbstractKotlinUastTest() {
|
||||
|
||||
private fun getTestFile(testName: String, ext: String) =
|
||||
File(File(AbstractKotlinUastTest.TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
|
||||
|
||||
private fun UFile.resolvableWithTargets() = object : IndentedPrintingVisitor(KtBlockExpression::class) {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.uast.test.kotlin
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.util.io.URLUtil
|
||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
import org.jetbrains.uast.UFile
|
||||
import org.jetbrains.uast.UastFacade
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractKotlinUastLightCodeInsightFixtureTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor =
|
||||
KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
Registry.get("kotlin.uast.multiresolve.enabled").setValue(true, testRootDisposable)
|
||||
}
|
||||
|
||||
fun getVirtualFile(testName: String): VirtualFile {
|
||||
val testFile = TEST_KOTLIN_MODEL_DIR.listFiles { pathname -> pathname.nameWithoutExtension == testName }.first()
|
||||
val vfs = VirtualFileManager.getInstance().getFileSystem(URLUtil.FILE_PROTOCOL)
|
||||
return vfs.findFileByPath(testFile.canonicalPath)!!
|
||||
}
|
||||
|
||||
abstract fun check(testName: String, file: UFile)
|
||||
|
||||
fun doTest(testName: String, checkCallback: (String, UFile) -> Unit = { testName, file -> check(testName, file) }) {
|
||||
val virtualFile = getVirtualFile(testName)
|
||||
|
||||
val psiFile = myFixture.configureByText(virtualFile.name, File(virtualFile.canonicalPath!!).readText())
|
||||
val uFile = UastFacade.convertElementWithParent(psiFile, null) ?: error("Can't get UFile for $testName")
|
||||
checkCallback(testName, uFile as UFile)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,9 +38,6 @@ import org.jetbrains.uast.test.env.kotlin.AbstractUastTest
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractKotlinUastTest : AbstractUastTest() {
|
||||
protected companion object {
|
||||
val TEST_KOTLIN_MODEL_DIR = File("plugins/uast-kotlin/testData")
|
||||
}
|
||||
|
||||
private lateinit var compilerConfiguration: CompilerConfiguration
|
||||
private var kotlinCoreEnvironment: KotlinCoreEnvironment? = null
|
||||
@@ -58,7 +55,7 @@ abstract class AbstractKotlinUastTest : AbstractUastTest() {
|
||||
|
||||
val environment = kotlinCoreEnvironment!!
|
||||
TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
project, environment.getSourceFiles(), trace, compilerConfiguration, environment::createPackagePartProvider
|
||||
project, environment.getSourceFiles(), trace, compilerConfiguration, environment::createPackagePartProvider
|
||||
)
|
||||
|
||||
val vfs = VirtualFileManager.getInstance().getFileSystem(URLUtil.FILE_PROTOCOL)
|
||||
@@ -94,13 +91,14 @@ abstract class AbstractKotlinUastTest : AbstractUastTest() {
|
||||
private fun initializeKotlinEnvironment() {
|
||||
val area = Extensions.getRootArea()
|
||||
area.getExtensionPoint(UastLanguagePlugin.extensionPointName)
|
||||
.registerExtension(KotlinUastLanguagePlugin())
|
||||
.registerExtension(KotlinUastLanguagePlugin())
|
||||
area.getExtensionPoint(UEvaluatorExtension.EXTENSION_POINT_NAME)
|
||||
.registerExtension(KotlinEvaluatorExtension())
|
||||
.registerExtension(KotlinEvaluatorExtension())
|
||||
|
||||
project.registerService(
|
||||
KotlinUastResolveProviderService::class.java,
|
||||
CliKotlinUastResolveProviderService::class.java)
|
||||
CliKotlinUastResolveProviderService::class.java
|
||||
)
|
||||
}
|
||||
|
||||
override fun createEnvironment(source: File): AbstractCoreEnvironment {
|
||||
@@ -115,7 +113,8 @@ abstract class AbstractKotlinUastTest : AbstractUastTest() {
|
||||
this.kotlinCoreEnvironment = kotlinCoreEnvironment
|
||||
|
||||
AnalysisHandlerExtension.registerExtension(
|
||||
kotlinCoreEnvironment.project, UastAnalysisHandlerExtension())
|
||||
kotlinCoreEnvironment.project, UastAnalysisHandlerExtension()
|
||||
)
|
||||
|
||||
return KotlinCoreEnvironmentWrapper(kotlinCoreEnvironment, parentDisposable, appWasNull)
|
||||
}
|
||||
@@ -140,9 +139,11 @@ abstract class AbstractKotlinUastTest : AbstractUastTest() {
|
||||
}
|
||||
}
|
||||
|
||||
private class KotlinCoreEnvironmentWrapper(val environment: KotlinCoreEnvironment,
|
||||
val parentDisposable: Disposable,
|
||||
val appWasNull: Boolean) : AbstractCoreEnvironment() {
|
||||
private class KotlinCoreEnvironmentWrapper(
|
||||
val environment: KotlinCoreEnvironment,
|
||||
val parentDisposable: Disposable,
|
||||
val appWasNull: Boolean
|
||||
) : AbstractCoreEnvironment() {
|
||||
override fun addJavaSourceRoot(root: File) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
@@ -161,4 +162,6 @@ abstract class AbstractKotlinUastTest : AbstractUastTest() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val TEST_KOTLIN_MODEL_DIR = File("plugins/uast-kotlin/testData")
|
||||
@@ -6,7 +6,7 @@ import java.io.File
|
||||
abstract class AbstractKotlinValuesTest : AbstractKotlinUastTest(), ValuesTestBase {
|
||||
|
||||
private fun getTestFile(testName: String, ext: String) =
|
||||
File(File(AbstractKotlinUastTest.TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
|
||||
override fun getValuesFile(testName: String) = getTestFile(testName, "values.txt")
|
||||
}
|
||||
@@ -54,6 +54,6 @@ class AlternativesRenderLogTest : AbstractKotlinUastTest() {
|
||||
}
|
||||
|
||||
private fun getTestFile(testName: String, ext: String) =
|
||||
File(File(AbstractKotlinUastTest.TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
package org.jetbrains.uast.test.kotlin
|
||||
|
||||
import org.jetbrains.uast.UFile
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class KotlinIDERenderLogTest : AbstractKotlinUastLightCodeInsightFixtureTest(), AbstractKotlinRenderLogTest {
|
||||
|
||||
override fun getTestFile(testName: String, ext: String): File {
|
||||
if (ext.endsWith(".txt")) {
|
||||
val testFile = super.getTestFile(testName, ext.removeSuffix(".txt") + "-ide.txt")
|
||||
if (testFile.exists()) return testFile
|
||||
}
|
||||
return super.getTestFile(testName, ext)
|
||||
}
|
||||
|
||||
override fun check(testName: String, file: UFile) = super.check(testName, file)
|
||||
|
||||
|
||||
@Test
|
||||
fun testLocalDeclarations() = doTest("LocalDeclarations")
|
||||
|
||||
@Test
|
||||
fun testSimple() = doTest("Simple")
|
||||
|
||||
@Test
|
||||
fun testWhenIs() = doTest("WhenIs")
|
||||
|
||||
@Test
|
||||
fun testDefaultImpls() = doTest("DefaultImpls")
|
||||
|
||||
@Test
|
||||
fun testBitwise() = doTest("Bitwise")
|
||||
|
||||
@Test
|
||||
fun testElvis() = doTest("Elvis")
|
||||
|
||||
@Test
|
||||
fun testPropertyAccessors() = doTest("PropertyAccessors")
|
||||
|
||||
@Test
|
||||
fun testPropertyInitializer() = doTest("PropertyInitializer")
|
||||
|
||||
@Test
|
||||
fun testPropertyInitializerWithoutSetter() = doTest("PropertyInitializerWithoutSetter")
|
||||
|
||||
@Test
|
||||
fun testAnnotationParameters() = doTest("AnnotationParameters")
|
||||
|
||||
@Test
|
||||
fun testEnumValueMembers() = doTest("EnumValueMembers")
|
||||
|
||||
@Test
|
||||
fun testStringTemplate() = doTest("StringTemplate")
|
||||
|
||||
@Test
|
||||
fun testStringTemplateComplex() = doTest("StringTemplateComplex")
|
||||
|
||||
@Test
|
||||
fun testStringTemplateComplexForUInjectionHost() = withForceUInjectionHostValue {
|
||||
doTest("StringTemplateComplexForUInjectionHost")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testQualifiedConstructorCall() = doTest("QualifiedConstructorCall")
|
||||
|
||||
@Test
|
||||
fun testPropertyDelegate() = doTest("PropertyDelegate")
|
||||
|
||||
@Test
|
||||
fun testLocalVariableWithAnnotation() = doTest("LocalVariableWithAnnotation")
|
||||
|
||||
@Test
|
||||
fun testPropertyWithAnnotation() = doTest("PropertyWithAnnotation")
|
||||
|
||||
@Test
|
||||
fun testIfStatement() = doTest("IfStatement")
|
||||
|
||||
@Test
|
||||
fun testInnerClasses() = doTest("InnerClasses")
|
||||
|
||||
@Test
|
||||
@Ignore // there is a descriptor leak probably, unignore when fixed
|
||||
fun ingoretestSimpleScript() = doTest("SimpleScript") { testName, file -> check(testName, file, false) }
|
||||
|
||||
@Test
|
||||
fun testDestructuringDeclaration() = doTest("DestructuringDeclaration")
|
||||
|
||||
@Test
|
||||
fun testDefaultParameterValues() = doTest("DefaultParameterValues")
|
||||
|
||||
@Test
|
||||
fun testParameterPropertyWithAnnotation() = doTest("ParameterPropertyWithAnnotation")
|
||||
|
||||
@Test
|
||||
fun testParametersWithDefaultValues() = doTest("ParametersWithDefaultValues")
|
||||
|
||||
@Test
|
||||
fun testUnexpectedContainer() = doTest("UnexpectedContainerException")
|
||||
|
||||
@Test
|
||||
fun testWhenStringLiteral() = doTest("WhenStringLiteral")
|
||||
|
||||
@Test
|
||||
fun testWhenAndDestructing() = doTest("WhenAndDestructing") { testName, file -> check(testName, file, false) }
|
||||
|
||||
@Test
|
||||
fun testSuperCalls() = doTest("SuperCalls")
|
||||
|
||||
@Test
|
||||
fun testConstructors() = doTest("Constructors")
|
||||
|
||||
@Test
|
||||
fun testClassAnnotation() = doTest("ClassAnnotation")
|
||||
|
||||
@Test
|
||||
fun testReceiverFun() = doTest("ReceiverFun")
|
||||
|
||||
@Test
|
||||
fun testAnonymous() = doTest("Anonymous")
|
||||
|
||||
@Test
|
||||
fun testAnnotationComplex() = doTest("AnnotationComplex")
|
||||
|
||||
@Test
|
||||
fun testParametersDisorder() = doTest("ParametersDisorder") { testName, file ->
|
||||
// disabled due to inconsistent parents for 2-receivers call (KT-22344)
|
||||
check(testName, file, false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLambdas() = doTest("Lambdas")
|
||||
|
||||
@Test
|
||||
fun testTypeReferences() = doTest("TypeReferences")
|
||||
|
||||
@Test
|
||||
fun testDelegate() = doTest("Delegate")
|
||||
|
||||
@Test
|
||||
fun testConstructorDelegate() = doTest("ConstructorDelegate") { testName, file ->
|
||||
// Igor Yakovlev told that delegation is a little bit broken in ULC and not expected to be fixed
|
||||
check(testName, file, false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLambdaReturn() = doTest("LambdaReturn")
|
||||
|
||||
@Test
|
||||
fun testReified() = doTest("Reified")
|
||||
|
||||
@Test
|
||||
fun testSuspend() = doTest("Suspend")
|
||||
|
||||
@Test
|
||||
fun testDeprecatedHidden() = doTest("DeprecatedHidden")
|
||||
}
|
||||
@@ -290,7 +290,6 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
|
||||
doTest("SuperCalls") { _, file ->
|
||||
file.checkUastSuperTypes("B", listOf("A"))
|
||||
file.checkUastSuperTypes("O", listOf("A"))
|
||||
file.checkUastSuperTypes("innerObject ", listOf("A"))
|
||||
file.checkUastSuperTypes("InnerClass", listOf("A"))
|
||||
file.checkUastSuperTypes("object : A(\"textForAnon\")", listOf("A"))
|
||||
}
|
||||
@@ -427,7 +426,6 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
|
||||
)
|
||||
assertArguments(listOf("\"%i %i %i\"", "\"\".chunked(2).toTypedArray()"), "format(\"%i %i %i\", *\"\".chunked(2).toTypedArray())")
|
||||
assertArguments(listOf("\"def\"", "8", "7.0"), "with2Receivers(8, 7.0F)")
|
||||
assertArguments(listOf("\"foo\"", "1"), "object : Parent(b = 1, a = \"foo\")\n")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -48,6 +48,6 @@ class MultiplesRequiredTypesTest : AbstractKotlinUastTest() {
|
||||
}
|
||||
|
||||
private fun getTestFile(testName: String, ext: String) =
|
||||
File(File(AbstractKotlinUastTest.TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext)
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package org.jetbrains.uast.test.kotlin
|
||||
|
||||
import org.jetbrains.uast.UFile
|
||||
import org.jetbrains.uast.kotlin.KotlinConverter
|
||||
import org.junit.Test
|
||||
|
||||
class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() {
|
||||
@Test fun testLocalDeclarations() = doTest("LocalDeclarations")
|
||||
class SimpleKotlinRenderLogTest : AbstractKotlinUastTest(), AbstractKotlinRenderLogTest {
|
||||
|
||||
@Test fun testSimple() = doTest("Simple")
|
||||
override fun check(testName: String, file: UFile) = super.check(testName, file)
|
||||
|
||||
@Test fun testWhenIs() = doTest("WhenIs")
|
||||
@Test
|
||||
fun testLocalDeclarations() = doTest("LocalDeclarations")
|
||||
|
||||
@Test fun testDefaultImpls() = doTest("DefaultImpls")
|
||||
@Test
|
||||
fun testSimple() = doTest("Simple")
|
||||
|
||||
@Test fun testBitwise() = doTest("Bitwise")
|
||||
@Test
|
||||
fun testWhenIs() = doTest("WhenIs")
|
||||
|
||||
@Test
|
||||
fun testDefaultImpls() = doTest("DefaultImpls")
|
||||
|
||||
@Test
|
||||
fun testBitwise() = doTest("Bitwise")
|
||||
|
||||
@Test fun testElvis() = doTest("Elvis")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user