LV 2.0: move testStrictMetadataVersionSemanticsOldVersion to pure K2 tests

This commit is contained in:
Mikhail Glukhikh
2023-09-07 13:37:41 +02:00
committed by Space Team
parent 8ba2cab989
commit 96ea0c2eb8
4 changed files with 11 additions and 35 deletions
@@ -1,21 +0,0 @@
error: incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
$TMP_DIR$/library.jar!/META-INF/main.kotlin_module: error: module was compiled with an incompatible version of Kotlin. The binary version of its metadata is $ABI_VERSION_NEXT$, expected version is $ABI_VERSION$.
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:3:13: error: class 'a.C' was compiled with an incompatible version of Kotlin. The actual metadata version is $ABI_VERSION_NEXT$, but the compiler version $ABI_VERSION$ can read versions up to $ABI_VERSION$.
The class is loaded from $TMP_DIR$/library.jar!/a/C.class
fun test(c: C) {
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:4:5: error: unresolved reference 'f'.
f()
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:5:5: error: unresolved reference 'v'.
v
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:6:5: error: class 'a.C' was compiled with an incompatible version of Kotlin. The actual metadata version is $ABI_VERSION_NEXT$, but the compiler version $ABI_VERSION$ can read versions up to $ABI_VERSION$.
The class is loaded from $TMP_DIR$/library.jar!/a/C.class
c.let { C() }
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:6:13: error: class 'a.C' was compiled with an incompatible version of Kotlin. The actual metadata version is $ABI_VERSION_NEXT$, but the compiler version $ABI_VERSION$ can read versions up to $ABI_VERSION$.
The class is loaded from $TMP_DIR$/library.jar!/a/C.class
c.let { C() }
^
COMPILATION_ERROR
@@ -4,20 +4,16 @@ compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemant
The class is loaded from $TMP_DIR$/library.jar!/a/C.class
fun test(c: C) {
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:4:5: error: unresolved reference: f
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:4:5: error: unresolved reference 'f'.
f()
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:5:5: error: unresolved reference: v
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:5:5: error: unresolved reference 'v'.
v
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:6:5: error: class 'a.C' was compiled with an incompatible version of Kotlin. The actual metadata version is $ABI_VERSION_NEXT$, but the compiler version $ABI_VERSION$ can read versions up to $ABI_VERSION$.
The class is loaded from $TMP_DIR$/library.jar!/a/C.class
c.let { C() }
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:6:7: error: class 'a.C' was compiled with an incompatible version of Kotlin. The actual metadata version is $ABI_VERSION_NEXT$, but the compiler version $ABI_VERSION$ can read versions up to $ABI_VERSION$.
The class is loaded from $TMP_DIR$/library.jar!/a/C.class
c.let { C() }
^
compiler/testData/compileKotlinAgainstCustomBinaries/strictMetadataVersionSemanticsOldVersion/source.kt:6:13: error: class 'a.C' was compiled with an incompatible version of Kotlin. The actual metadata version is $ABI_VERSION_NEXT$, but the compiler version $ABI_VERSION$ can read versions up to $ABI_VERSION$.
The class is loaded from $TMP_DIR$/library.jar!/a/C.class
c.let { C() }
@@ -342,14 +342,6 @@ abstract class AbstractCompileKotlinAgainstCustomBinariesTest : AbstractKotlinCo
compileKotlin("source.kt", tmpdir, listOf(library))
}
fun testStrictMetadataVersionSemanticsOldVersion() {
val nextMetadataVersion = languageVersion.toMetadataVersion().next()
val library = compileLibrary(
"library", additionalOptions = listOf("-Xgenerate-strict-metadata-version", "-Xmetadata-version=$nextMetadataVersion")
)
compileKotlin("source.kt", tmpdir, listOf(library))
}
fun testMetadataVersionDerivedFromLanguage() {
for (languageVersion in LanguageVersion.entries) {
if (languageVersion.isUnsupported) continue
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.jvm.compiler
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.utils.toMetadataVersion
class FirCompileKotlinAgainstCustomBinariesTest : AbstractCompileKotlinAgainstCustomBinariesTest() {
override val languageVersion: LanguageVersion
@@ -45,4 +46,12 @@ class FirCompileKotlinAgainstCustomBinariesTest : AbstractCompileKotlinAgainstCu
fun testFirAgainstFirUsingFlag() {
compileKotlin("source.kt", tmpdir, listOf(compileLibrary("library")), additionalOptions = listOf("-Xuse-k2"))
}
fun testStrictMetadataVersionSemanticsOldVersion() {
val nextMetadataVersion = languageVersion.toMetadataVersion().next()
val library = compileLibrary(
"library", additionalOptions = listOf("-Xgenerate-strict-metadata-version", "-Xmetadata-version=$nextMetadataVersion")
)
compileKotlin("source.kt", tmpdir, listOf(library))
}
}