Uast: tests for suspend and DeprecationLevel.HIDDEN functions appears in Uast tree (KT-27806, KT-32031)

This commit is contained in:
Nicolay Mitropolsky
2019-11-21 21:08:39 +03:00
parent 2772659ed2
commit 833571d8b2
9 changed files with 100 additions and 0 deletions
@@ -0,0 +1,9 @@
package test.pkg
class Context {
suspend fun inner(): Int = suspendPrivate()
private suspend fun suspendPrivate(): Int = inner()
}
suspend fun top(): Int = Context().inner()
+7
View File
@@ -0,0 +1,7 @@
package test.pkg
class Test {
fun test1() { }
@Deprecated(level = DeprecationLevel.HIDDEN, message="nothing")
fun test2() { }
}
+7
View File
@@ -0,0 +1,7 @@
UFile (package = test.pkg)
UClass (name = Test)
UMethod (name = test1)
UBlockExpression
UMethod (name = Test)
UMethod (name = test2)
UBlockExpression
@@ -0,0 +1,9 @@
package test.pkg
public final class Test {
public final fun test1() : void {
}
public fun Test() = UastEmptyExpression
fun test2() {
}
}
+9
View File
@@ -0,0 +1,9 @@
package test.pkg
class Context {
suspend fun inner(): Int = suspendPrivate()
private suspend fun suspendPrivate(): Int = inner()
}
suspend fun top(): Int = Context().inner()
+30
View File
@@ -0,0 +1,30 @@
UFile (package = test.pkg)
UClass (name = SuspendKt)
UMethod (name = top)
UParameter (name = p)
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 = p)
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)
+17
View File
@@ -0,0 +1,17 @@
package test.pkg
public final class SuspendKt {
public static final fun top(@org.jetbrains.annotations.NotNull p: 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 p: kotlin.coroutines.Continuation<? super java.lang.Integer>) : java.lang.Object {
return suspendPrivate()
}
public fun Context() = UastEmptyExpression
fun suspendPrivate() {
return inner()
}
}
@@ -105,6 +105,12 @@ class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() {
@Test
fun testReified() = doTest("Reified")
@Test
fun testSuspend() = doTest("Suspend")
@Test
fun testDeprecatedHidden() = doTest("DeprecatedHidden")
}
fun withForceUInjectionHostValue(call: () -> Unit) {
@@ -99,4 +99,10 @@ class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() {
@Test
fun testReified() = doTest("Reified")
@Test
fun testSuspend() = doTest("Suspend")
@Test
fun testDeprecatedHidden() = doTest("DeprecatedHidden")
}