Update UAST to 1.0.10; move uast-kotlin tests to Kotlin project

This commit is contained in:
Dmitry Jemerov
2017-02-06 19:52:52 +01:00
parent cfe159181d
commit 5dc178460e
62 changed files with 865 additions and 53 deletions
+5
View File
@@ -0,0 +1,5 @@
annotation class IntRange(val from: Long, val to: Long)
@IntRange(from = 10, to = 0)
fun foo(): Int = 5
@@ -0,0 +1,23 @@
UFile (package = )
UClass (name = AnnotationParametersKt)
UAnnotationMethod (name = foo)
UAnnotation (fqName = IntRange)
UNamedExpression (name = from)
ULiteralExpression (value = 10)
UNamedExpression (name = to)
ULiteralExpression (value = 0)
ULiteralExpression (value = 5)
UClass (name = IntRange)
UAnnotation (fqName = java.lang.annotation.Retention)
UNamedExpression (name = )
UQualifiedReferenceExpression
UQualifiedReferenceExpression
UQualifiedReferenceExpression
UQualifiedReferenceExpression
USimpleNameReferenceExpression (identifier = java)
USimpleNameReferenceExpression (identifier = lang)
USimpleNameReferenceExpression (identifier = annotation)
USimpleNameReferenceExpression (identifier = RetentionPolicy)
USimpleNameReferenceExpression (identifier = RUNTIME)
UAnnotationMethod (name = from)
UAnnotationMethod (name = to)
@@ -0,0 +1,9 @@
public final class AnnotationParametersKt {
@IntRange(from = 10, to = 0)
public static final fun foo() : int = 5
}
public abstract annotation IntRange {
public abstract fun from() : long = UastEmptyExpression
public abstract fun to() : long = UastEmptyExpression
}
+4
View File
@@ -0,0 +1,4 @@
fun foo(): String {
val s: String? = "Not Null"
return s!!
}
+10
View File
@@ -0,0 +1,10 @@
UFile (package = ) [public final class AssertionKt {...]
UClass (name = AssertionKt) [public final class AssertionKt {...}]
UAnnotationMethod (name = foo) [public static final fun foo() : java.lang.String {...}]
UBlockExpression [{...}] = Nothing
UDeclarationsExpression [var s: java.lang.String = "Not Null"] = Undetermined
ULocalVariable (name = s) [var s: java.lang.String = "Not Null"]
ULiteralExpression (value = "Not Null") ["Not Null"] = "Not Null"
UReturnExpression [return s!!] = Nothing
UPostfixExpression (operator = !!) [s!!] = (var s = "Not Null")
USimpleNameReferenceExpression (identifier = s) [s] = (var s = "Not Null")
+6
View File
@@ -0,0 +1,6 @@
interface Foo {
fun bar() = "Hello!"
}
class Baz : Foo
+6
View File
@@ -0,0 +1,6 @@
UFile (package = )
UClass (name = Foo)
UAnnotationMethod (name = bar)
ULiteralExpression (value = "Hello!")
UClass (name = Baz)
UAnnotationMethod (name = Baz)
+7
View File
@@ -0,0 +1,7 @@
public abstract interface Foo {
public abstract fun bar() : java.lang.String = "Hello!"
}
public final class Baz : Foo {
public fun Baz() = UastEmptyExpression
}
+6
View File
@@ -0,0 +1,6 @@
fun foo(bar: String): Any? = null
fun baz(): Any? {
return foo("Lorem ipsum") ?: foo("dolor sit amet") ?: foo("consectetuer adipiscing elit")
}
+37
View File
@@ -0,0 +1,37 @@
UFile (package = )
UClass (name = ElvisKt)
UAnnotationMethod (name = foo)
UParameter (name = bar)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = null)
UAnnotationMethod (name = baz)
UBlockExpression
UReturnExpression
UExpressionList (elvis)
UDeclarationsExpression
ULocalVariable (name = var243c4e1a)
UExpressionList (elvis)
UDeclarationsExpression
ULocalVariable (name = varc4aef1e3)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (foo))
USimpleNameReferenceExpression (identifier = foo)
ULiteralExpression (value = "Lorem ipsum")
UIfExpression
UBinaryExpression (operator = !=)
USimpleNameReferenceExpression (identifier = varc4aef1e3)
ULiteralExpression (value = null)
USimpleNameReferenceExpression (identifier = varc4aef1e3)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (foo))
USimpleNameReferenceExpression (identifier = foo)
ULiteralExpression (value = "dolor sit amet")
UIfExpression
UBinaryExpression (operator = !=)
USimpleNameReferenceExpression (identifier = var243c4e1a)
ULiteralExpression (value = null)
USimpleNameReferenceExpression (identifier = var243c4e1a)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (foo))
USimpleNameReferenceExpression (identifier = foo)
ULiteralExpression (value = "consectetuer adipiscing elit")
+12
View File
@@ -0,0 +1,12 @@
public final class ElvisKt {
public static final fun foo(bar: java.lang.String) : java.lang.Object = null
public static final fun baz() : java.lang.Object {
return elvis {
var var243c4e1a: <ErrorType> = elvis {
var varc4aef1e3: <ErrorType> = foo("Lorem ipsum")
if (varc4aef1e3 != null) varc4aef1e3 else foo("dolor sit amet")
}
if (var243c4e1a != null) var243c4e1a else foo("consectetuer adipiscing elit")
}
}
}
+8
View File
@@ -0,0 +1,8 @@
enum class Style(val value: String) {
SHEET("foo") {
override val exitAnimation: String
get() = "bar"
};
abstract val exitAnimation: String
}
+15
View File
@@ -0,0 +1,15 @@
UFile (package = )
UClass (name = Style)
UEnumConstant (name = SHEET)
USimpleNameReferenceExpression (identifier = Style)
UClass (name = null)
UAnnotationMethod (name = getExitAnimation)
ULiteralExpression (value = "bar")
UAnnotationMethod (name = SHEET)
UField (name = value)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UAnnotationMethod (name = getExitAnimation)
UAnnotationMethod (name = getValue)
UAnnotationMethod (name = Style)
UParameter (name = value)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
@@ -0,0 +1,10 @@
public enum Style {
SHEET {
public fun getExitAnimation() : java.lang.String = "bar"
fun SHEET() = UastEmptyExpression
}
private final var value: java.lang.String
public abstract fun getExitAnimation() : java.lang.String = UastEmptyExpression
public final fun getValue() : java.lang.String = UastEmptyExpression
protected fun Style(value: java.lang.String) = UastEmptyExpression
}
+5
View File
@@ -0,0 +1,5 @@
fun foo(): Boolean {
val x = 1
val y = 10
return x in 0..5 && y !in 4..9
}
+22
View File
@@ -0,0 +1,22 @@
UFile (package = ) [public final class InKt {...]
UClass (name = InKt) [public final class InKt {...}]
UAnnotationMethod (name = foo) [public static final fun foo() : boolean {...}]
UBlockExpression [{...}] = Nothing
UDeclarationsExpression [var x: <ErrorType> = 1] = Undetermined
ULocalVariable (name = x) [var x: <ErrorType> = 1]
ULiteralExpression (value = 1) [1] = 1
UDeclarationsExpression [var y: <ErrorType> = 10] = Undetermined
ULocalVariable (name = y) [var y: <ErrorType> = 10]
ULiteralExpression (value = 10) [10] = 10
UReturnExpression [return x in 0 .. 5 && y !in 4 .. 9] = Nothing
UBinaryExpression (operator = &&) [x in 0 .. 5 && y !in 4 .. 9] = true (depending on: (var x = 1), (var y = 10))
UBinaryExpression (operator = in) [x in 0 .. 5] = true (depending on: (var x = 1))
USimpleNameReferenceExpression (identifier = x) [x] = (var x = 1)
UBinaryExpression (operator = ..) [0 .. 5] = 0..5
ULiteralExpression (value = 0) [0] = 0
ULiteralExpression (value = 5) [5] = 5
UBinaryExpression (operator = !in) [y !in 4 .. 9] = true (depending on: (var y = 10))
USimpleNameReferenceExpression (identifier = y) [y] = (var y = 10)
UBinaryExpression (operator = ..) [4 .. 9] = 4..9
ULiteralExpression (value = 4) [4] = 4
ULiteralExpression (value = 9) [9] = 9
+10
View File
@@ -0,0 +1,10 @@
fun foo(): Boolean {
class Local
fun bar() = Local()
val baz = fun() {
Local()
}
return bar() == Local()
}
+28
View File
@@ -0,0 +1,28 @@
UFile (package = )
UClass (name = LocalDeclarationsKt)
UAnnotationMethod (name = foo)
UBlockExpression
UDeclarationsExpression
UClass (name = Local)
UAnnotationMethod (name = LocalDeclarationsKt$foo$Local)
UDeclarationsExpression
UVariable (name = bar)
ULambdaExpression
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
UIdentifier (Identifier (Local))
USimpleNameReferenceExpression (identifier = <init>)
UDeclarationsExpression
ULocalVariable (name = baz)
ULambdaExpression
UBlockExpression
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
UIdentifier (Identifier (Local))
USimpleNameReferenceExpression (identifier = <init>)
UReturnExpression
UBinaryExpression (operator = ==)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (bar))
USimpleNameReferenceExpression (identifier = bar)
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
UIdentifier (Identifier (Local))
USimpleNameReferenceExpression (identifier = <init>)
@@ -0,0 +1,14 @@
public final class LocalDeclarationsKt {
public static final fun foo() : boolean {
public static final class Local {
public fun LocalDeclarationsKt$foo$Local() = UastEmptyExpression
}
var bar: <ErrorType> = fun () {
<init>()
}
var baz: <ErrorType> = fun () {
<init>()
}
return bar() == <init>()
}
}
@@ -0,0 +1,28 @@
UFile (package = ) [public final class LocalDeclarationsKt {...]
UClass (name = LocalDeclarationsKt) [public final class LocalDeclarationsKt {...}]
UAnnotationMethod (name = foo) [public static final fun foo() : boolean {...}]
UBlockExpression [{...}] : PsiType:Void
UDeclarationsExpression [public static final class Local {...}]
UClass (name = Local) [public static final class Local {...}]
UAnnotationMethod (name = LocalDeclarationsKt$foo$Local) [public fun LocalDeclarationsKt$foo$Local() = UastEmptyExpression]
UDeclarationsExpression [var bar: <ErrorType> = fun () {...}]
UVariable (name = bar) [var bar: <ErrorType> = fun () {...}]
ULambdaExpression [fun () {...}]
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] : PsiType:<ErrorType>
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:<ErrorType>
UDeclarationsExpression [var baz: <ErrorType> = fun () {...}]
ULocalVariable (name = baz) [var baz: <ErrorType> = fun () {...}]
ULambdaExpression [fun () {...}]
UBlockExpression [{...}] : PsiType:<ErrorType>
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] : PsiType:<ErrorType>
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:<ErrorType>
UReturnExpression [return bar() == <init>()] : PsiType:Void
UBinaryExpression (operator = ==) [bar() == <init>()] : PsiType:boolean
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] : PsiType:<ErrorType>
UIdentifier (Identifier (bar)) [UIdentifier (Identifier (bar))]
USimpleNameReferenceExpression (identifier = bar) [bar] : PsiType:<ErrorType>
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] : PsiType:<ErrorType>
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:<ErrorType>
@@ -0,0 +1,28 @@
UFile (package = ) [public final class LocalDeclarationsKt {...]
UClass (name = LocalDeclarationsKt) [public final class LocalDeclarationsKt {...}]
UAnnotationMethod (name = foo) [public static final fun foo() : boolean {...}]
UBlockExpression [{...}] = Nothing
UDeclarationsExpression [public static final class Local {...}] = Undetermined
UClass (name = Local) [public static final class Local {...}]
UAnnotationMethod (name = LocalDeclarationsKt$foo$Local) [public fun LocalDeclarationsKt$foo$Local() = UastEmptyExpression]
UDeclarationsExpression [var bar: <ErrorType> = fun () {...}] = Undetermined
UVariable (name = bar) [var bar: <ErrorType> = fun () {...}]
ULambdaExpression [fun () {...}] = Undetermined
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] = external <init>()()
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>()
UDeclarationsExpression [var baz: <ErrorType> = fun () {...}] = Undetermined
ULocalVariable (name = baz) [var baz: <ErrorType> = fun () {...}]
ULambdaExpression [fun () {...}] = Undetermined
UBlockExpression [{...}] = external <init>()()
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] = external <init>()()
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>()
UReturnExpression [return bar() == <init>()] = Nothing
UBinaryExpression (operator = ==) [bar() == <init>()] = Undetermined
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] = external bar()()
UIdentifier (Identifier (bar)) [UIdentifier (Identifier (bar))]
USimpleNameReferenceExpression (identifier = bar) [bar] = external bar()
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] = external <init>()()
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>()
+9
View File
@@ -0,0 +1,9 @@
class Foo {
fun bar() {
}
}
val x = Foo::bar
// REF:Foo::bar
// RESULT:KtLightAnnotationMethod:bar
+12
View File
@@ -0,0 +1,12 @@
class PropertyTest {
var stringRepresentation: String
get() = this.toString()
set(value) {
setDataFromString(value)
}
fun setDataFromString(data: String) {
}
}
+21
View File
@@ -0,0 +1,21 @@
UFile (package = )
UClass (name = PropertyTest)
UAnnotationMethod (name = getStringRepresentation)
UQualifiedReferenceExpression
UThisExpression (label = null)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (toString))
USimpleNameReferenceExpression (identifier = toString)
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 = value)
UAnnotationMethod (name = setDataFromString)
UParameter (name = data)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UBlockExpression
UAnnotationMethod (name = PropertyTest)
@@ -0,0 +1,9 @@
public final class PropertyTest {
public final fun getStringRepresentation() : java.lang.String = this.toString()
public final fun setStringRepresentation(value: java.lang.String) : void {
setDataFromString(value)
}
public final fun setDataFromString(data: java.lang.String) : void {
}
public fun PropertyTest() = UastEmptyExpression
}
+8
View File
@@ -0,0 +1,8 @@
class TestPropertyInitializer {
var withSetter = "/sdcard"
get() = field
set(p) {
field = p
}
}
@@ -0,0 +1,15 @@
UFile (package = )
UClass (name = TestPropertyInitializer)
UField (name = withSetter)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = "/sdcard")
UAnnotationMethod (name = getWithSetter)
USimpleNameReferenceExpression (identifier = field)
UAnnotationMethod (name = setWithSetter)
UParameter (name = p)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UBlockExpression
UBinaryExpression (operator = =)
USimpleNameReferenceExpression (identifier = field)
USimpleNameReferenceExpression (identifier = p)
UAnnotationMethod (name = TestPropertyInitializer)
@@ -0,0 +1,8 @@
public final class TestPropertyInitializer {
private var withSetter: java.lang.String = "/sdcard"
public final fun getWithSetter() : java.lang.String = field
public final fun setWithSetter(p: java.lang.String) : void {
field = p
}
public fun TestPropertyInitializer() = UastEmptyExpression
}
@@ -0,0 +1,3 @@
var withoutSetter = "/sdcard"
get() = field
@@ -0,0 +1,10 @@
UFile (package = )
UClass (name = PropertyInitializerWithoutSetterKt)
UField (name = withoutSetter)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = "/sdcard")
UAnnotationMethod (name = getWithoutSetter)
USimpleNameReferenceExpression (identifier = field)
UAnnotationMethod (name = setWithoutSetter)
UParameter (name = p)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
@@ -0,0 +1,5 @@
public final class PropertyInitializerWithoutSetterKt {
private static var withoutSetter: java.lang.String = "/sdcard"
public static final fun getWithoutSetter() : java.lang.String = field
public static final fun setWithoutSetter(p: java.lang.String) : void = UastEmptyExpression
}
@@ -0,0 +1,9 @@
package A.B.C
internal class Foo
internal class Bar {
fun getFoo(): Foo {
return A.B.C.Foo()
}
}
@@ -0,0 +1,17 @@
UFile (package = A.B.C)
UClass (name = Foo)
UAnnotationMethod (name = Foo)
UClass (name = Bar)
UAnnotationMethod (name = getFoo)
UBlockExpression
UReturnExpression
UQualifiedReferenceExpression
UQualifiedReferenceExpression
UQualifiedReferenceExpression
USimpleNameReferenceExpression (identifier = A)
USimpleNameReferenceExpression (identifier = B)
USimpleNameReferenceExpression (identifier = C)
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
UIdentifier (Identifier (Foo))
USimpleNameReferenceExpression (identifier = <init>)
UAnnotationMethod (name = Bar)
@@ -0,0 +1,12 @@
package A.B.C
public final class Foo {
public fun Foo() = UastEmptyExpression
}
public final class Bar {
public final fun getFoo() : A.B.C.Foo {
return A.B.C.<init>()
}
public fun Bar() = UastEmptyExpression
}
+7
View File
@@ -0,0 +1,7 @@
class Simple {
fun method() {
println("Hello, world!")
}
val property: String = "Mary"
}
+13
View File
@@ -0,0 +1,13 @@
UFile (package = )
UClass (name = Simple)
UField (name = property)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = "Mary")
UAnnotationMethod (name = method)
UBlockExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (println))
USimpleNameReferenceExpression (identifier = println)
ULiteralExpression (value = "Hello, world!")
UAnnotationMethod (name = getProperty)
UAnnotationMethod (name = Simple)
+8
View File
@@ -0,0 +1,8 @@
public final class Simple {
private final var property: java.lang.String = "Mary"
public final fun method() : void {
println("Hello, world!")
}
public final fun getProperty() : java.lang.String = UastEmptyExpression
public fun Simple() = UastEmptyExpression
}
+13
View File
@@ -0,0 +1,13 @@
UFile (package = ) [public final class Simple {...]
UClass (name = Simple) [public final class Simple {...}]
UField (name = property) [private final var property: java.lang.String = "Mary"]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
ULiteralExpression (value = "Mary") ["Mary"] = "Mary"
UAnnotationMethod (name = method) [public final fun method() : void {...}]
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()
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]
+5
View File
@@ -0,0 +1,5 @@
val foo = "lorem"
val bar = "ipsum"
val baz = "dolor"
val foobarbaz = "$foo $bar $baz"
+23
View File
@@ -0,0 +1,23 @@
UFile (package = )
UClass (name = StringTemplateKt)
UField (name = foo)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = "lorem")
UField (name = bar)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = "ipsum")
UField (name = baz)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = "dolor")
UField (name = foobarbaz)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UPolyadicExpression (operator = +)
USimpleNameReferenceExpression (identifier = foo)
ULiteralExpression (value = " ")
USimpleNameReferenceExpression (identifier = bar)
ULiteralExpression (value = " ")
USimpleNameReferenceExpression (identifier = baz)
UAnnotationMethod (name = getFoo)
UAnnotationMethod (name = getBar)
UAnnotationMethod (name = getBaz)
UAnnotationMethod (name = getFoobarbaz)
+10
View File
@@ -0,0 +1,10 @@
public final class StringTemplateKt {
private static final var foo: java.lang.String = "lorem"
private static final var bar: java.lang.String = "ipsum"
private static final var baz: java.lang.String = "dolor"
private static final var foobarbaz: java.lang.String = foo + " " + bar + " " + baz
public static final fun getFoo() : java.lang.String = UastEmptyExpression
public static final fun getBar() : java.lang.String = UastEmptyExpression
public static final fun getBaz() : java.lang.String = UastEmptyExpression
public static final fun getFoobarbaz() : java.lang.String = UastEmptyExpression
}
@@ -0,0 +1,19 @@
interface Callback {
fun onError(throwable: Throwable)
}
class Model {
init {
crashMe(Callback::class.java) {
object : Callback {
override fun onError(throwable: Throwable) {
throw UnsupportedOperationException("")
}
}
}
}
fun <T : Any> crashMe(clazz: Class<T>, factory: () -> T) {
throw UnsupportedOperationException()
}
}
@@ -0,0 +1,39 @@
UFile (package = ) [public abstract interface Callback {...]
UClass (name = Callback) [public abstract interface Callback {...}]
UAnnotationMethod (name = onError) [public abstract fun onError(throwable: java.lang.Throwable) : void = UastEmptyExpression]
UParameter (name = throwable) [var throwable: java.lang.Throwable]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
UClass (name = Model) [public final class Model {...}]
UAnnotationMethod (name = crashMe) [public final fun crashMe(clazz: java.lang.Class<T>, factory: kotlin.jvm.functions.Function0<? extends T>) : void {...}]
UParameter (name = clazz) [var clazz: java.lang.Class<T>]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
UParameter (name = factory) [var factory: kotlin.jvm.functions.Function0<? extends T>]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
UBlockExpression [{...}] : PsiType:Void
UThrowExpression [throw <init>()] : PsiType:Void
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] : PsiType:UnsupportedOperationException
UIdentifier (Identifier (UnsupportedOperationException)) [UIdentifier (Identifier (UnsupportedOperationException))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:UnsupportedOperationException
UMethod (name = Model) [public fun Model() {...}]
UBlockExpression [{...}]
UBlockExpression [{...}] : PsiType:Unit
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [crashMe(Callback.java, { ...})] : PsiType:Unit
UIdentifier (Identifier (crashMe)) [UIdentifier (Identifier (crashMe))]
USimpleNameReferenceExpression (identifier = crashMe) [crashMe] : PsiType:Unit
UQualifiedReferenceExpression [Callback.java] : PsiType:Class<Callback>
UClassLiteralExpression [Callback] : PsiType:KClass<Callback>
USimpleNameReferenceExpression (identifier = java) [java] : PsiType:Class<Callback>
ULambdaExpression [{ ...}] : PsiType:<ErrorType>
UBlockExpression [{...}]
UObjectLiteralExpression [anonymous object : Callback {... }] : PsiType:Callback
UClass (name = null) [final class null {...}]
UAnnotationMethod (name = onError) [public fun onError(throwable: java.lang.Throwable) : void {...}]
UParameter (name = throwable) [var throwable: java.lang.Throwable]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
UBlockExpression [{...}] : PsiType:Void
UThrowExpression [throw <init>("")] : PsiType:Void
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1)) [<init>("")] : PsiType:UnsupportedOperationException
UIdentifier (Identifier (UnsupportedOperationException)) [UIdentifier (Identifier (UnsupportedOperationException))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:UnsupportedOperationException
ULiteralExpression (value = "") [""] : PsiType:String
UAnnotationMethod (name = Model$1$1) [fun Model$1$1() = UastEmptyExpression]
+4
View File
@@ -0,0 +1,4 @@
fun foo(bar: Any) = when(bar) {
is String -> bar
!is String -> "<error>"
}
+22
View File
@@ -0,0 +1,22 @@
UFile (package = )
UClass (name = WhenIsKt)
UAnnotationMethod (name = foo)
UParameter (name = bar)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
USwitchExpression
USimpleNameReferenceExpression (identifier = bar)
UExpressionList (when)
USwitchClauseExpressionWithBody
UBinaryExpressionWithType
USimpleNameReferenceExpression (identifier = it)
UTypeReferenceExpression (name = java.lang.String)
UExpressionList (when_entry)
USimpleNameReferenceExpression (identifier = bar)
UBreakExpression (label = null)
USwitchClauseExpressionWithBody
UBinaryExpressionWithType
USimpleNameReferenceExpression (identifier = it)
UTypeReferenceExpression (name = java.lang.String)
UExpressionList (when_entry)
ULiteralExpression (value = "<error>")
UBreakExpression (label = null)
+15
View File
@@ -0,0 +1,15 @@
public final class WhenIsKt {
public static final fun foo(bar: java.lang.Object) : java.lang.String = switch (bar) {
it is java.lang.String -> {
bar
break
}
it !is java.lang.String -> {
"<error>"
break
}
}
}