172: Uast: testdata fixes

This commit is contained in:
Nicolay Mitropolsky
2018-06-04 14:34:41 +03:00
parent 5c8e4958db
commit c150878086
10 changed files with 105 additions and 20 deletions
+65
View File
@@ -0,0 +1,65 @@
UFile (package = ) [public final class MyColor {...]
UClass (name = MyColor) [public final class MyColor {...}]
UField (name = x) [private final var x: int]
UAnnotation (fqName = null) [@null]
UField (name = y) [private final var y: int]
UAnnotation (fqName = null) [@null]
UField (name = z) [private final var z: int]
UAnnotation (fqName = null) [@null]
UAnnotationMethod (name = getX) [public final fun getX() : int = UastEmptyExpression]
UAnnotationMethod (name = getY) [public final fun getY() : int = UastEmptyExpression]
UAnnotationMethod (name = getZ) [public final fun getZ() : int = UastEmptyExpression]
UAnnotationMethod (name = MyColor) [public fun MyColor(x: int, y: int, z: int) = UastEmptyExpression]
UParameter (name = x) [var x: int]
UAnnotation (fqName = null) [@null]
UParameter (name = y) [var y: int]
UAnnotation (fqName = null) [@null]
UParameter (name = z) [var z: int]
UAnnotation (fqName = null) [@null]
UClass (name = Some) [public final class Some {...}]
UField (name = delegate$delegate) [private final var delegate$delegate: kotlin.Lazy]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [lazy({ ...})] = external lazy({
<init>(18, 2, 3)
})(Undetermined)
UIdentifier (Identifier (lazy)) [UIdentifier (Identifier (lazy))]
USimpleNameReferenceExpression (identifier = lazy) [lazy] = external lazy({
<init>(18, 2, 3)
})(Undetermined)
ULambdaExpression [{ ...}] = Undetermined
UBlockExpression [{...}] = external <init>(18, 2, 3)(18, 2, 3)
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) [<init>(18, 2, 3)] = external <init>(18, 2, 3)(18, 2, 3)
UIdentifier (Identifier (MyColor)) [UIdentifier (Identifier (MyColor))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>(18, 2, 3)(18, 2, 3)
ULiteralExpression (value = 18) [18] = 18
ULiteralExpression (value = 2) [2] = 2
ULiteralExpression (value = 3) [3] = 3
UField (name = lambda) [private final var lambda: kotlin.Lazy<MyColor> = lazy({ ...})]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [lazy({ ...})] = external lazy({
<init>(1, 2, 3)
})(Undetermined)
UIdentifier (Identifier (lazy)) [UIdentifier (Identifier (lazy))]
USimpleNameReferenceExpression (identifier = lazy) [lazy] = external lazy({
<init>(1, 2, 3)
})(Undetermined)
ULambdaExpression [{ ...}] = Undetermined
UBlockExpression [{...}] = external <init>(1, 2, 3)(1, 2, 3)
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) [<init>(1, 2, 3)] = external <init>(1, 2, 3)(1, 2, 3)
UIdentifier (Identifier (MyColor)) [UIdentifier (Identifier (MyColor))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>(1, 2, 3)(1, 2, 3)
ULiteralExpression (value = 1) [1] = 1
ULiteralExpression (value = 2) [2] = 2
ULiteralExpression (value = 3) [3] = 3
UField (name = nonLazy) [private final var nonLazy: MyColor = <init>(1, 2, 3)]
UAnnotation (fqName = org.jetbrains.annotations.NotNull) [@org.jetbrains.annotations.NotNull]
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 3)) [<init>(1, 2, 3)] = external <init>(1, 2, 3)(1, 2, 3)
UIdentifier (Identifier (MyColor)) [UIdentifier (Identifier (MyColor))]
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>(1, 2, 3)(1, 2, 3)
ULiteralExpression (value = 1) [1] = 1
ULiteralExpression (value = 2) [2] = 2
ULiteralExpression (value = 3) [3] = 3
UAnnotationMethod (name = getDelegate) [public final fun getDelegate() : MyColor = UastEmptyExpression]
UAnnotationMethod (name = getLambda) [public final fun getLambda() : kotlin.Lazy<MyColor> = UastEmptyExpression]
UAnnotationMethod (name = getNonLazy) [public final fun getNonLazy() : MyColor = UastEmptyExpression]
UAnnotationMethod (name = Some) [public fun Some() = UastEmptyExpression]
+6 -2
View File
@@ -1,6 +1,10 @@
public final class ElvisKt {
public static final fun foo(bar: java.lang.String) : java.lang.String = null
public static final fun bar() : int = 42
public static final fun foo(bar: java.lang.String) : java.lang.String {
return null
}
public static final fun bar() : int {
return 42
}
public static final fun baz() : java.lang.String {
return elvis {
var var243c51a0: java.lang.String = elvis {
+6 -2
View File
@@ -3,12 +3,16 @@ public final class Foo {
public static final class Bar {
private final var a: int
private final var b: int
public final fun getAPlusB() : int = a + b
public final fun getAPlusB() : int {
return a + b
}
public final fun getA() : int = UastEmptyExpression
public final fun getB() : int = UastEmptyExpression
public fun Bar(a: int, b: int) = UastEmptyExpression
public static final class Baz {
public final fun doNothing() : void = Unit
public final fun doNothing() : void {
return Unit
}
public fun Baz() = UastEmptyExpression
}
}
@@ -1,5 +1,7 @@
public final class PropertyTest {
public final fun getStringRepresentation() : java.lang.String = this.toString()
public final fun getStringRepresentation() : java.lang.String {
return this.toString()
}
public final fun setStringRepresentation(value: java.lang.String) : void {
setDataFromString(value)
}
@@ -1,6 +1,8 @@
public final class TestPropertyInitializer {
private var withSetter: java.lang.String = "/sdcard"
public final fun getWithSetter() : java.lang.String = field
public final fun getWithSetter() : java.lang.String {
return field
}
public final fun setWithSetter(p: java.lang.String) : void {
field = p
}
@@ -1,5 +1,7 @@
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 getWithoutSetter() : java.lang.String {
return field
}
public static final fun setWithoutSetter(p: java.lang.String) : void = UastEmptyExpression
}
@@ -9,7 +9,9 @@ public final class StringTemplateComplexKt {
public static final fun getCase5() : java.lang.String = UastEmptyExpression
public static final fun getLiteralInLiteral() : java.lang.String = UastEmptyExpression
public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression
public static final fun simpleForTemplate(i: int) : java.lang.String = i
public static final fun simpleForTemplate(i: int) : java.lang.String {
return i
}
public static final fun foo() : void {
println(baz)
var template1: java.lang.String = simpleForTemplate()
@@ -43,11 +43,13 @@ UFile (package = ) [public final class StringTemplateComplexKt {...]
UAnnotationMethod (name = getCase5) [public static final fun getCase5() : java.lang.String = UastEmptyExpression]
UAnnotationMethod (name = getLiteralInLiteral) [public static final fun getLiteralInLiteral() : java.lang.String = UastEmptyExpression]
UAnnotationMethod (name = getLiteralInLiteral2) [public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression]
UAnnotationMethod (name = simpleForTemplate) [public static final fun simpleForTemplate(i: int) : java.lang.String = i]
UAnnotationMethod (name = simpleForTemplate) [public static final fun simpleForTemplate(i: int) : java.lang.String {...}]
UParameter (name = i) [var i: int = 0]
UAnnotation (fqName = null) [@null]
ULiteralExpression (value = 0) [0] : PsiType:int
USimpleNameReferenceExpression (identifier = i) [i] : PsiType:int
UBlockExpression [{...}]
UReturnExpression [return i]
USimpleNameReferenceExpression (identifier = i) [i] : PsiType:int
UAnnotationMethod (name = foo) [public static final fun foo() : void {...}]
UBlockExpression [{...}] : PsiType:Unit
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [println(baz)] : PsiType:Unit
+1 -1
View File
@@ -17,7 +17,7 @@ UFile (package = )
UAnnotationMethod (name = SuperCallsKt$anon$1)
UClass (name = innerObject)
UField (name = INSTANCE)
UAnnotation (fqName = null)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UAnnotationMethod (name = innerObject)
UBlockExpression
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
+11 -9
View File
@@ -1,15 +1,17 @@
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
}
public static final fun foo(bar: java.lang.Object) : java.lang.String {
return switch (bar) {
it is java.lang.String -> {
bar
break
}
it !is java.lang.String -> {
"<error>"
break
}
it !is java.lang.String -> {
"<error>"
break
}
}
}