Uast: tests for UClass.uastSuperTypes

This commit is contained in:
Nicolay Mitropolsky
2018-01-18 18:48:55 +03:00
parent 7b212c5650
commit d5d49c65b4
6 changed files with 106 additions and 13 deletions
+10
View File
@@ -0,0 +1,10 @@
import java.io.Closeable
import java.io.InputStream
fun foo() {
val runnable = object : Runnable { override fun run() {} }
runnable.run()
val closeableRunnable = object : Runnable, Closeable { override fun close() {} override fun run() {} }
val runnableIs = object : InputStream(), Runnable { override fun read(): Int = 0; override fun run() {} }
}
+36
View File
@@ -0,0 +1,36 @@
UFile (package = )
UImportStatement (isOnDemand = false)
UImportStatement (isOnDemand = false)
UClass (name = AnonymousKt)
UAnnotationMethod (name = foo)
UBlockExpression
UDeclarationsExpression
ULocalVariable (name = runnable)
UObjectLiteralExpression
UClass (name = null)
UAnnotationMethod (name = run)
UBlockExpression
UAnnotationMethod (name = AnonymousKt$foo$runnable$1)
UQualifiedReferenceExpression
USimpleNameReferenceExpression (identifier = runnable)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (run))
USimpleNameReferenceExpression (identifier = run)
UDeclarationsExpression
ULocalVariable (name = closeableRunnable)
UObjectLiteralExpression
UClass (name = null)
UAnnotationMethod (name = close)
UBlockExpression
UAnnotationMethod (name = run)
UBlockExpression
UAnnotationMethod (name = AnonymousKt$foo$closeableRunnable$1)
UDeclarationsExpression
ULocalVariable (name = runnableIs)
UObjectLiteralExpression
UClass (name = null)
UAnnotationMethod (name = read)
ULiteralExpression (value = 0)
UAnnotationMethod (name = run)
UBlockExpression
UAnnotationMethod (name = AnonymousKt$foo$runnableIs$1)
+11
View File
@@ -0,0 +1,11 @@
import java.io.Closeable
import java.io.InputStream
public final class AnonymousKt {
public static final fun foo() : void {
var runnable: <ErrorType> = anonymous object : Runnable { override fun run() {} }
runnable.run()
var closeableRunnable: <ErrorType> = anonymous object : Runnable, Closeable { override fun close() {} override fun run() {} }
var runnableIs: <ErrorType> = anonymous object : InputStream(), Runnable { override fun read(): Int = 0; override fun run() {} }
}
}