172: Revert "UAST: Properly handle annotations on local variables"
This reverts commit 70de7cff5e23abf723009c8df8bc2df2f646a675.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
UFile (package = ) [public final class CycleInTypeParametersKt {...]
|
||||
UClass (name = CycleInTypeParametersKt) [public final class CycleInTypeParametersKt {...}]
|
||||
UField (name = a) [private static final var a: Device<?> = null as? Device<?>]
|
||||
UAnnotation (fqName = org.jetbrains.annotations.Nullable) [@org.jetbrains.annotations.Nullable]
|
||||
UBinaryExpressionWithType [null as? Device<?>] : PsiType:Device<?>
|
||||
ULiteralExpression (value = null) [null] : PsiType:Void
|
||||
UTypeReferenceExpression (name = Device<?>) [Device<?>]
|
||||
UAnnotationMethod (name = getA) [public static final fun getA() : Device<?> = UastEmptyExpression]
|
||||
UClass (name = Device) [public final class Device {...}]
|
||||
UAnnotationMethod (name = Device) [public fun Device() = UastEmptyExpression]
|
||||
+2
-6
@@ -1,10 +1,6 @@
|
||||
public final class ElvisKt {
|
||||
public static final fun foo(@org.jetbrains.annotations.NotNull bar: java.lang.String) : java.lang.String {
|
||||
return null
|
||||
}
|
||||
public static final fun bar() : int {
|
||||
return 42
|
||||
}
|
||||
public static final fun foo(bar: java.lang.String) : java.lang.String = null
|
||||
public static final fun bar() : int = 42
|
||||
public static final fun baz() : java.lang.String {
|
||||
return elvis {
|
||||
var var243c51a0: java.lang.String = elvis {
|
||||
|
||||
@@ -3,8 +3,8 @@ public enum Style {
|
||||
public fun getExitAnimation() : java.lang.String = "bar"
|
||||
fun SHEET() = UastEmptyExpression
|
||||
}
|
||||
@org.jetbrains.annotations.NotNull private final var value: java.lang.String
|
||||
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(@org.jetbrains.annotations.NotNull value: java.lang.String) = UastEmptyExpression
|
||||
protected fun Style(value: java.lang.String) = UastEmptyExpression
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
public final class LocalVariableWithAnnotationKt {
|
||||
public static final fun foo() : void {
|
||||
@TestAnnotation var bar: <ErrorType> = "lorem ipsum"
|
||||
}
|
||||
}
|
||||
|
||||
public abstract annotation TestAnnotation {
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
public final class PropertyDelegateKt {
|
||||
@org.jetbrains.annotations.NotNull private static final var sdCardPath$delegate: kotlin.Lazy
|
||||
private static final var sdCardPath$delegate: kotlin.Lazy
|
||||
public static final fun getSdCardPath() : java.lang.String = UastEmptyExpression
|
||||
public static final fun localPropertyTest() : void {
|
||||
var sdCardPathLocal: java.lang.String
|
||||
|
||||
@@ -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,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,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
|
||||
}
|
||||
@@ -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("Hello, world!")("Hello, world!")
|
||||
ULiteralExpression (value = "Hello, world!") ["Hello, world!"] = "Hello, world!"
|
||||
UAnnotationMethod (name = getProperty) [public final fun getProperty() : java.lang.String = UastEmptyExpression]
|
||||
UAnnotationMethod (name = Simple) [public fun Simple() = UastEmptyExpression]
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
UFile (package = ) [public abstract interface Callback {...]
|
||||
UClass (name = Callback) [public abstract interface Callback {...}]
|
||||
UAnnotationMethod (name = onError) [public abstract fun onError(@org.jetbrains.annotations.NotNull throwable: java.lang.Throwable) : void = UastEmptyExpression]
|
||||
UParameter (name = throwable) [@org.jetbrains.annotations.NotNull var throwable: java.lang.Throwable]
|
||||
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(@org.jetbrains.annotations.NotNull clazz: java.lang.Class<T>, @org.jetbrains.annotations.NotNull factory: kotlin.jvm.functions.Function0<? extends T>) : void {...}]
|
||||
UParameter (name = clazz) [@org.jetbrains.annotations.NotNull var clazz: java.lang.Class<T>]
|
||||
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) [@org.jetbrains.annotations.NotNull var factory: kotlin.jvm.functions.Function0<? extends T>]
|
||||
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
|
||||
@@ -27,8 +27,8 @@ UFile (package = ) [public abstract interface Callback {...]
|
||||
UBlockExpression [{...}]
|
||||
UObjectLiteralExpression [anonymous object : Callback {... }] : PsiType:Callback
|
||||
UClass (name = null) [final class null {...}]
|
||||
UAnnotationMethod (name = onError) [public fun onError(@org.jetbrains.annotations.NotNull throwable: java.lang.Throwable) : void {...}]
|
||||
UParameter (name = throwable) [@org.jetbrains.annotations.NotNull var throwable: java.lang.Throwable]
|
||||
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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package org.jetbrains.uast.test.kotlin
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() {
|
||||
@Test fun testLocalDeclarations() = doTest("LocalDeclarations")
|
||||
|
||||
@Test fun testSimple() = doTest("Simple")
|
||||
|
||||
@Test fun testWhenIs() = doTest("WhenIs")
|
||||
|
||||
@Test fun testDefaultImpls() = doTest("DefaultImpls")
|
||||
|
||||
@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 testQualifiedConstructorCall() = doTest("QualifiedConstructorCall")
|
||||
|
||||
@Test fun testPropertyDelegate() = doTest("PropertyDelegate") { testName, file -> check(testName, file, false) }
|
||||
|
||||
@Test fun testPropertyWithAnnotation() = doTest("PropertyWithAnnotation")
|
||||
|
||||
@Test fun testIfStatement() = doTest("IfStatement")
|
||||
|
||||
@Test fun testInnerClasses() = doTest("InnerClasses")
|
||||
|
||||
@Test fun testSimpleScript() = 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")
|
||||
}
|
||||
Reference in New Issue
Block a user