Test experimental coroutines version requirement on JVM only
Modify 'suspendFun' and 'nestedClassMembers' tests so that pre-release suspend functions are tested only on JVM, where they are still supported.
This commit is contained in:
@@ -5,12 +5,12 @@ import kotlin.internal.RequireKotlin
|
||||
|
||||
class Outer {
|
||||
inner class Inner {
|
||||
@RequireKotlin("1.1")
|
||||
inner class Deep @RequireKotlin("1.1") constructor() {
|
||||
@RequireKotlin("1.1")
|
||||
@RequireKotlin("1.3")
|
||||
inner class Deep @RequireKotlin("1.3") constructor() {
|
||||
@RequireKotlin("1.3")
|
||||
fun f() {}
|
||||
|
||||
@RequireKotlin("1.1")
|
||||
@RequireKotlin("1.3")
|
||||
val x = ""
|
||||
|
||||
suspend fun s() {}
|
||||
@@ -18,13 +18,13 @@ class Outer {
|
||||
}
|
||||
|
||||
class Nested {
|
||||
@RequireKotlin("1.1")
|
||||
@RequireKotlin("1.3")
|
||||
fun g() {}
|
||||
}
|
||||
|
||||
@RequireKotlin("1.1")
|
||||
@RequireKotlin("1.3")
|
||||
companion object
|
||||
}
|
||||
|
||||
@RequireKotlin("1.1")
|
||||
@RequireKotlin("1.3")
|
||||
fun topLevel() {}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package test
|
||||
|
||||
suspend fun topLevel() {}
|
||||
|
||||
class Foo {
|
||||
constructor(block: suspend () -> Unit)
|
||||
|
||||
suspend fun member() {}
|
||||
}
|
||||
|
||||
fun async1(block: suspend () -> Unit) {}
|
||||
fun (suspend () -> Unit).async2() {}
|
||||
fun async3(): suspend () -> Unit = null!!
|
||||
fun async4(): Map<Int, suspend () -> Unit>? = null
|
||||
|
||||
val (suspend () -> Unit).asyncVal: () -> Unit get() = {}
|
||||
+2
-17
@@ -76,21 +76,6 @@ abstract class AbstractVersionRequirementTest : TestCaseWithTmpdir() {
|
||||
protected abstract fun loadModule(directory: File): ModuleDescriptor
|
||||
|
||||
fun testSuspendFun() {
|
||||
doTest(
|
||||
VersionRequirement.Version(1, 1), DeprecationLevel.ERROR, null, ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION, null,
|
||||
customLanguageVersion = LanguageVersion.KOTLIN_1_2,
|
||||
fqNames = listOf(
|
||||
"test.topLevel",
|
||||
"test.Foo.member",
|
||||
"test.Foo.<init>",
|
||||
"test.async1",
|
||||
"test.async2",
|
||||
"test.async3",
|
||||
"test.async4",
|
||||
"test.asyncVal"
|
||||
)
|
||||
)
|
||||
|
||||
doTest(
|
||||
VersionRequirement.Version(1, 3), DeprecationLevel.ERROR, null, ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION, null,
|
||||
customLanguageVersion = LanguageVersion.KOTLIN_1_3,
|
||||
@@ -158,8 +143,8 @@ abstract class AbstractVersionRequirementTest : TestCaseWithTmpdir() {
|
||||
|
||||
fun testNestedClassMembers() {
|
||||
doTest(
|
||||
VersionRequirement.Version(1, 1), DeprecationLevel.ERROR, null, ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION, null,
|
||||
customLanguageVersion = LanguageVersion.KOTLIN_1_2,
|
||||
VersionRequirement.Version(1, 3), DeprecationLevel.ERROR, null, ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION, null,
|
||||
customLanguageVersion = LanguageVersion.KOTLIN_1_3,
|
||||
fqNames = listOf(
|
||||
"test.Outer.Inner.Deep",
|
||||
"test.Outer.Inner.Deep.<init>",
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION
|
||||
import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
@@ -88,4 +89,21 @@ class JvmVersionRequirementTest : AbstractVersionRequirementTest() {
|
||||
customLanguageVersion = LanguageVersion.KOTLIN_1_4
|
||||
)
|
||||
}
|
||||
|
||||
fun testSuspendFun_1_2() {
|
||||
doTest(
|
||||
VersionRequirement.Version(1, 1), DeprecationLevel.ERROR, null, LANGUAGE_VERSION, null,
|
||||
customLanguageVersion = LanguageVersion.KOTLIN_1_2,
|
||||
fqNames = listOf(
|
||||
"test.topLevel",
|
||||
"test.Foo.member",
|
||||
"test.Foo.<init>",
|
||||
"test.async1",
|
||||
"test.async2",
|
||||
"test.async3",
|
||||
"test.async4",
|
||||
"test.asyncVal"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user