Add test for calling release coroutine from experimental one

This commit is contained in:
Ilmir Usmanov
2018-07-09 17:37:22 +03:00
parent cbb81a343c
commit 03c50ea139
4 changed files with 19 additions and 1 deletions
@@ -0,0 +1,3 @@
suspend fun callRelease() {
dummy()
}
@@ -0,0 +1 @@
suspend fun dummy() {}
@@ -0,0 +1,4 @@
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()
^
COMPILATION_ERROR
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
@@ -432,6 +432,16 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
compileKotlin("source.kt", tmpdir, listOf(library))
}
fun testReleaseCoroutineCallFromExperimental() {
val library = compileLibrary("library", additionalOptions = listOf("-language-version", "1.3"), checkKotlinOutput = {})
compileKotlin(
"experimental.kt",
tmpdir,
listOf(library),
additionalOptions = listOf("-language-version", "1.2", "-Xskip-metadata-version-check")
)
}
companion object {
// compiler before 1.1.4 version did not include suspension marks into bytecode.
private fun stripSuspensionMarksToImitateLegacyCompiler(bytes: ByteArray): Pair<ByteArray, Int> {