Allow calling some pieces of the experimental coroutine API
- Calling suspend functions is allowed - Presence of suspend function type still makes declaration unusable unless it belongs to a value parameter as a top-level type containing less then three parameters Still, warning should be emitted because they will become unsupported in 1.4 #KT-25683 In Progress
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {}
|
||||
fun builder2(c: suspend Int.(String) -> Unit) {}
|
||||
|
||||
fun (suspend (Int) -> Unit).start() {}
|
||||
|
||||
suspend fun suspendAcceptsSuspend(x: suspend () -> Unit) {}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||
warning: runtime JAR files in the classpath should have the same version. These files were found in the classpath:
|
||||
$DIST_DIR$/kotlin-stdlib-coroutines.jar (version 1.3)
|
||||
$PROJECT_DIR$/lib/kotlin-stdlib.jar (version 1.2)
|
||||
$PROJECT_DIR$/lib/kotlin-script-runtime.jar (version 1.2)
|
||||
$PROJECT_DIR$/lib/kotlin-reflect.jar (version 1.2)
|
||||
warning: consider providing an explicit dependency on kotlin-reflect 1.3 to prevent strange errors
|
||||
warning: some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:2:5: warning: 'builder(suspend () -> Unit): Unit' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
builder {}
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:3:5: warning: 'builder2(suspend Int.(String) -> Unit): Unit' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
builder2 { }
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:6:7: warning: 'start(): Unit' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
x.start()
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:8:5: warning: 'dummy(): Unit' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
dummy()
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:9:9: warning: 'dummy(): String' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
C().dummy()
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:10:25: warning: 'dummy(): String' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
WithNested.Nested().dummy()
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:11:25: warning: 'dummy(): String' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
WithInner().Inner().dummy()
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromReleaseWarnings/release.kt:13:5: warning: 'suspendAcceptsSuspend(suspend () -> Unit): Unit' is deprecated. Experimental coroutines support will be dropped in 1.4
|
||||
suspendAcceptsSuspend {
|
||||
^
|
||||
OK
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
suspend fun callRelease() {
|
||||
builder {}
|
||||
builder2 { }
|
||||
|
||||
val x: suspend (Int) -> Unit = {}
|
||||
x.start()
|
||||
|
||||
dummy()
|
||||
C().dummy()
|
||||
WithNested.Nested().dummy()
|
||||
WithInner().Inner().dummy()
|
||||
|
||||
suspendAcceptsSuspend {
|
||||
callRelease()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user