From 2988d671f75455bd99ff6a4f15983062b60c8ce1 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 17 Jan 2023 15:59:50 +0200 Subject: [PATCH] [Test] Update CompileKotlinAgainstCustomBinariesTest We have several tests which tests how compiler with LV = LATEST_STABLE can consume binaries compiled with LV = LATEST_STABLE + 1 with different CLI flags. For LV = 2.0 we have special rules for those flags, so testdata was changed After switching LV in repository to 2.0 this testdata should be rolled back --- .../output.txt | 27 ++++++++++++++++++- .../output.txt | 27 ++++++++++++++++++- .../library/a.kt | 9 +++++++ .../output.txt | 1 + .../source.kt | 15 +++++++++++ .../CompileKotlinAgainstCustomBinariesTest.kt | 4 +++ 6 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/library/a.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/output.txt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/source.kt diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/output.txt index a0aba9318ad..f343913497a 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/output.txt @@ -1 +1,26 @@ -OK \ No newline at end of file +error: classes compiled by the new Kotlin compiler frontend were found in dependencies. Remove them from the classpath or use '-Xallow-unstable-dependencies' to suppress errors +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:6:16: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler +fun baz(param: A) { + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:7:23: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val constructor = A() + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:8:22: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val methodCall = param.hashCode() + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:9:30: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val supertype = object : A() {} + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:11:13: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val x = foo() + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:12:13: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val y = bar + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:13:5: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + bar = 239 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck/source.kt:14:12: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val z: TA = "" + ^ +COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/output.txt index a0aba9318ad..83ff5c94886 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/output.txt @@ -1 +1,26 @@ -OK \ No newline at end of file +error: classes compiled by the new Kotlin compiler frontend were found in dependencies. Remove them from the classpath or use '-Xallow-unstable-dependencies' to suppress errors +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:6:16: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler +fun baz(param: A) { + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:7:23: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val constructor = A() + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:8:22: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val methodCall = param.hashCode() + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:9:30: error: class 'a.A' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val supertype = object : A() {} + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:11:13: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val x = foo() + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:12:13: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val y = bar + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:13:5: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + bar = 239 + ^ +compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck/source.kt:14:12: error: class 'a.AKt' is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler + val z: TA = "" + ^ +COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/library/a.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/library/a.kt new file mode 100644 index 00000000000..a311bb96854 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/library/a.kt @@ -0,0 +1,9 @@ +package a + +open class A { + class Nested +} + +fun foo() {} +var bar = 42 +typealias TA = String diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/output.txt new file mode 100644 index 00000000000..a0aba9318ad --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/output.txt @@ -0,0 +1 @@ +OK \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/source.kt b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/source.kt new file mode 100644 index 00000000000..6f6e9ef8209 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/releaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies/source.kt @@ -0,0 +1,15 @@ +@file:Suppress("UNUSED_VARIABLE") +package usage + +import a.* + +fun baz(param: A) { + val constructor = A() + val methodCall = param.hashCode() + val supertype = object : A() {} + + val x = foo() + val y = bar + bar = 239 + val z: TA = "" +} diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index bb0d6b9c6fa..9b7c98e5f68 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -325,6 +325,10 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir, "-Xskip-metadata-version-check") } + fun testReleaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheckAllowUnstableDependencies() { + doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir, "-Xallow-unstable-dependencies", "-Xskip-prerelease-check") + } + fun testWrongMetadataVersion() { doTestKotlinLibraryWithWrongMetadataVersion("library", null) }