From 03c50ea139d0f7c190f9f16c844add0b6c1ee629 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Mon, 9 Jul 2018 17:37:22 +0300 Subject: [PATCH] Add test for calling release coroutine from experimental one --- .../experimental.kt | 3 +++ .../library/release.kt | 1 + .../releaseCoroutineCallFromExperimental/output.txt | 4 ++++ .../CompileKotlinAgainstCustomBinariesTest.kt | 12 +++++++++++- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/experimental.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/library/release.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/experimental.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/experimental.kt new file mode 100644 index 00000000000..6733fc0d677 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/experimental.kt @@ -0,0 +1,3 @@ +suspend fun callRelease() { + dummy() +} \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/library/release.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/library/release.kt new file mode 100644 index 00000000000..f50bff31509 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/library/release.kt @@ -0,0 +1 @@ +suspend fun dummy() {} \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt new file mode 100644 index 00000000000..aeea75ab542 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCoroutineCallFromExperimental/output.txt @@ -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 diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index 957eee2f650..fe129db1617 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -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 {