diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/Suspend.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/Suspend.kt new file mode 100644 index 00000000000..b95cfe3866d --- /dev/null +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/Suspend.kt @@ -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() diff --git a/plugins/uast-kotlin/testData/DeprecatedHidden.kt b/plugins/uast-kotlin/testData/DeprecatedHidden.kt new file mode 100644 index 00000000000..0d4798dd4c6 --- /dev/null +++ b/plugins/uast-kotlin/testData/DeprecatedHidden.kt @@ -0,0 +1,7 @@ +package test.pkg +class Test { + fun test1() { } + + @Deprecated(level = DeprecationLevel.HIDDEN, message="nothing") + fun test2() { } +} \ No newline at end of file diff --git a/plugins/uast-kotlin/testData/DeprecatedHidden.log.txt b/plugins/uast-kotlin/testData/DeprecatedHidden.log.txt new file mode 100644 index 00000000000..7784271414a --- /dev/null +++ b/plugins/uast-kotlin/testData/DeprecatedHidden.log.txt @@ -0,0 +1,7 @@ +UFile (package = test.pkg) + UClass (name = Test) + UMethod (name = test1) + UBlockExpression + UMethod (name = Test) + UMethod (name = test2) + UBlockExpression diff --git a/plugins/uast-kotlin/testData/DeprecatedHidden.render.txt b/plugins/uast-kotlin/testData/DeprecatedHidden.render.txt new file mode 100644 index 00000000000..80cc0488ed2 --- /dev/null +++ b/plugins/uast-kotlin/testData/DeprecatedHidden.render.txt @@ -0,0 +1,9 @@ +package test.pkg + +public final class Test { + public final fun test1() : void { + } + public fun Test() = UastEmptyExpression + fun test2() { + } +} diff --git a/plugins/uast-kotlin/testData/Suspend.kt b/plugins/uast-kotlin/testData/Suspend.kt new file mode 100644 index 00000000000..b95cfe3866d --- /dev/null +++ b/plugins/uast-kotlin/testData/Suspend.kt @@ -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() diff --git a/plugins/uast-kotlin/testData/Suspend.log.txt b/plugins/uast-kotlin/testData/Suspend.log.txt new file mode 100644 index 00000000000..550624300f8 --- /dev/null +++ b/plugins/uast-kotlin/testData/Suspend.log.txt @@ -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 = , 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) diff --git a/plugins/uast-kotlin/testData/Suspend.render.txt b/plugins/uast-kotlin/testData/Suspend.render.txt new file mode 100644 index 00000000000..d580927d7db --- /dev/null +++ b/plugins/uast-kotlin/testData/Suspend.render.txt @@ -0,0 +1,17 @@ +package test.pkg + +public final class SuspendKt { + public static final fun top(@org.jetbrains.annotations.NotNull p: kotlin.coroutines.Continuation) : java.lang.Object { + return ().inner() + } +} + +public final class Context { + public final fun inner(@org.jetbrains.annotations.NotNull p: kotlin.coroutines.Continuation) : java.lang.Object { + return suspendPrivate() + } + public fun Context() = UastEmptyExpression + fun suspendPrivate() { + return inner() + } +} diff --git a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt b/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt index ea75394f97d..72d6e68b642 100644 --- a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt +++ b/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt @@ -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) { diff --git a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 b/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 index 9181a11c574..d987e7a00b7 100644 --- a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 +++ b/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 @@ -99,4 +99,10 @@ class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() { @Test fun testReified() = doTest("Reified") + + @Test + fun testSuspend() = doTest("Suspend") + + @Test + fun testDeprecatedHidden() = doTest("DeprecatedHidden") }