Deserialize constructors and properties with version requirement 1.3
if they have suspend function type in their descriptors. Also, review fixes. #KT-25256: Fixed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
$TESTDATA_DIR$/releaseCoroutinesApiVersion1.2.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-language-version
|
||||
1.3
|
||||
-api-version
|
||||
1.2
|
||||
@@ -0,0 +1,13 @@
|
||||
suspend fun dummy() {}
|
||||
|
||||
val c: suspend () -> Unit = {}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
|
||||
val d = suspend {}
|
||||
|
||||
suspend fun check() {
|
||||
dummy()
|
||||
c()
|
||||
builder {}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||
compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:1:1: error: unsupported [cannot use release coroutines with api version less than 1.3]
|
||||
suspend fun dummy() {}
|
||||
^
|
||||
compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:3:8: error: unsupported [cannot use release coroutines with api version less than 1.3]
|
||||
val c: suspend () -> Unit = {}
|
||||
^
|
||||
compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:5:16: error: unsupported [cannot use release coroutines with api version less than 1.3]
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
^
|
||||
compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:7:9: error: unsupported [cannot use release coroutines with api version less than 1.3]
|
||||
val d = suspend {}
|
||||
^
|
||||
compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:9:1: error: unsupported [cannot use release coroutines with api version less than 1.3]
|
||||
suspend fun check() {
|
||||
^
|
||||
compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:12:5: error: unsupported [cannot use release coroutines with api version less than 1.3]
|
||||
builder {}
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
@@ -1,11 +0,0 @@
|
||||
// !API_VERSION: 1.3
|
||||
// LANGUAGE_VERSION: 1.3
|
||||
|
||||
suspend fun named() {}
|
||||
|
||||
suspend fun withStateMachine() {
|
||||
named()
|
||||
named()
|
||||
}
|
||||
|
||||
val l: suspend() -> Unit = {}
|
||||
+8
@@ -1,3 +1,11 @@
|
||||
suspend fun callRelease() {
|
||||
dummy()
|
||||
|
||||
C().dummy()
|
||||
|
||||
// TODO: This should be error
|
||||
WithNested.Nested().dummy()
|
||||
|
||||
// TODO: This should be error
|
||||
WithInner().Inner().dummy()
|
||||
}
|
||||
+17
-1
@@ -1 +1,17 @@
|
||||
suspend fun dummy() {}
|
||||
suspend fun dummy() {}
|
||||
|
||||
class C {
|
||||
suspend fun dummy() = "OK"
|
||||
}
|
||||
|
||||
class WithNested {
|
||||
class Nested {
|
||||
suspend fun dummy() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class WithInner {
|
||||
inner class Inner {
|
||||
suspend fun dummy() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt
Vendored
+3
@@ -1,4 +1,7 @@
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/experimental.kt:2:5: error: 'dummy(): Unit' is only available since Kotlin 1.3 and cannot be used in Kotlin 1.2
|
||||
dummy()
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/experimental.kt:4:9: error: 'dummy(): String' is only available since Kotlin 1.3 and cannot be used in Kotlin 1.2
|
||||
C().dummy()
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
@@ -27,6 +27,6 @@ fun ok(continuation: Continuation<String>): Any? {
|
||||
fun box(): String {
|
||||
if ((::ok).builder() != "OK") return "FAIL 1"
|
||||
if (({ cont: Continuation<String> -> "OK" }).builder() != "OK") return "FAIL 2"
|
||||
if ((fun (cont: Continuation<String>): Any? = "OK").builder() != "OK") return "FAIL 2"
|
||||
if ((fun (cont: Continuation<String>): Any? = "OK").builder() != "OK") return "FAIL 3"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -7,6 +7,23 @@ suspend fun String.dummy() = this + "K"
|
||||
|
||||
suspend fun String.dummy(s: String) = this + s
|
||||
|
||||
class C {
|
||||
suspend fun dummy() = "OK"
|
||||
}
|
||||
|
||||
class WithNested {
|
||||
class Nested {
|
||||
suspend fun dummy() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class WithInner {
|
||||
inner class Inner {
|
||||
suspend fun dummy() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE: B.kt
|
||||
// LANGUAGE_VERSION: 1.3
|
||||
import kotlin.coroutines.experimental.*
|
||||
@@ -23,5 +40,8 @@ fun box(): String {
|
||||
if (dummy(continuation) != "OK") return "FAIL 1"
|
||||
if ("O".dummy(continuation) != "OK") return "FAIL 2"
|
||||
if ("O".dummy("K", continuation) != "OK") return "FAIL 3"
|
||||
if (C().dummy(continuation) != "OK") return "FAIL 4"
|
||||
if (WithNested.Nested().dummy(continuation) != "OK") return "FAIL 5"
|
||||
if (WithInner().Inner().dummy(continuation) != "OK") return "FAIL 6"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+15
-10
@@ -1,21 +1,26 @@
|
||||
// !API_VERSION: 1.2
|
||||
// !DIAGNOSTICS: -PRE_RELEASE_CLASS
|
||||
// !DIAGNOSTICS: -PRE_RELEASE_CLASS, -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// SKIP_TXT
|
||||
|
||||
suspend fun dummy() {}
|
||||
<!UNSUPPORTED!>suspend<!> fun dummy() {}
|
||||
|
||||
suspend fun test1() {
|
||||
// TODO: Forbid
|
||||
fun builder(c: <!UNSUPPORTED!>suspend<!> () -> Unit) {}
|
||||
|
||||
<!UNSUPPORTED!>suspend<!> fun test1() {
|
||||
kotlin.coroutines.<!UNRESOLVED_REFERENCE!>coroutineContext<!>
|
||||
|
||||
kotlin.coroutines.experimental.<!UNSUPPORTED, UNSUPPORTED!>coroutineContext<!>
|
||||
kotlin.coroutines.experimental.<!UNSUPPORTED!>coroutineContext<!>
|
||||
|
||||
<!UNSUPPORTED!>suspend {}()<!>
|
||||
<!UNSUPPORTED!>suspend<!> {}()
|
||||
|
||||
<!UNSUPPORTED!>dummy<!>()
|
||||
dummy()
|
||||
|
||||
val c: suspend () -> Unit = {}
|
||||
<!UNSUPPORTED!>c<!>()
|
||||
val c: <!UNSUPPORTED!>suspend<!> () -> Unit = {}
|
||||
c()
|
||||
|
||||
<!UNSUPPORTED!>builder<!> {}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
@@ -27,6 +32,6 @@ fun test2() {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun test3(): Unit = <!TYPE_MISMATCH!>kotlin.coroutines.experimental.<!NO_VALUE_FOR_PARAMETER, TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>suspendCoroutine<!> <!TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>_<!> -> Unit }<!><!>
|
||||
<!UNSUPPORTED!>suspend<!> fun test3(): Unit = <!TYPE_MISMATCH!>kotlin.coroutines.experimental.<!NO_VALUE_FOR_PARAMETER, TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>suspendCoroutine<!> <!TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>_<!> -> Unit }<!><!>
|
||||
|
||||
suspend fun test4(): Unit = kotlin.coroutines.<!UNRESOLVED_REFERENCE!>suspendCoroutine<!> { <!CANNOT_INFER_PARAMETER_TYPE!>_<!> -> Unit }
|
||||
<!UNSUPPORTED!>suspend<!> fun test4(): Unit = kotlin.coroutines.<!UNRESOLVED_REFERENCE!>suspendCoroutine<!> { <!CANNOT_INFER_PARAMETER_TYPE!>_<!> -> Unit }
|
||||
+4
-4
@@ -7,7 +7,7 @@ import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
class Controller {
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
||||
suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
||||
if (hashCode() % 2 == 0) {
|
||||
it.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
@@ -16,7 +16,7 @@ class Controller {
|
||||
Unit
|
||||
}
|
||||
}
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
||||
suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
||||
it.resume(1)
|
||||
it checkType { _<Continuation<Int>>() }
|
||||
it.<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>resume<!>("")
|
||||
@@ -27,10 +27,10 @@ class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: <!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> Controller.() -> Unit) {}
|
||||
fun builder(c: suspend Controller.() -> Unit) {}
|
||||
|
||||
fun test() {
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>builder<!> {
|
||||
builder {
|
||||
noParams() checkType { _<Unit>() }
|
||||
yieldString("abc") checkType { _<Int>() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user