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:
Ilmir Usmanov
2018-07-10 18:55:09 +03:00
parent c460593b7d
commit 6ba2baa9da
24 changed files with 234 additions and 136 deletions
@@ -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 }
@@ -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>() }
}