Tests: add CompileKotlinAgainstCustomBinariesTest for K2

This is needed because after changing default language version to 2.0,
we still need to test many scenarios from this test in K1.

Move K1-specific tests to OldCompileKotlinAgainstCustomBinariesTest, and
K2-specific tests to FirCompileKotlinAgainstCustomBinariesTest.

Mute failing K2 tests via `muteForK2`. It will throw exception if the
muted test will suddenly start passing.
This commit is contained in:
Alexander Udalov
2023-08-01 18:25:23 +02:00
committed by Space Team
parent 21c7325dbe
commit 54c7466074
26 changed files with 271 additions and 117 deletions
@@ -0,0 +1,8 @@
error: pre-release classes were found in dependencies. Remove them from the classpath, recompile with a release compiler or use '-Xskip-prerelease-check' to suppress errors
compiler/testData/compileKotlinAgainstCustomBinaries/againstFirWithUnstableAbi/source.kt:4:5: error: class 'lib.AKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
get { Box("OK").value }
^
compiler/testData/compileKotlinAgainstCustomBinaries/againstFirWithUnstableAbi/source.kt:4:11: error: class 'lib.Box' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
get { Box("OK").value }
^
COMPILATION_ERROR
@@ -0,0 +1,10 @@
compiler/testData/compileKotlinAgainstCustomBinaries/anonymousObjectTypeMetadata/anonymousObjectTypeMetadata.kt:11:10: error: cannot access 'val o3: Any': it is private in file
val e1 = o3
^
compiler/testData/compileKotlinAgainstCustomBinaries/anonymousObjectTypeMetadata/anonymousObjectTypeMetadata.kt:12:12: error: cannot access 'val o7: Any': it is private in 'lib/W'
val e2 = w.o7
^
compiler/testData/compileKotlinAgainstCustomBinaries/anonymousObjectTypeMetadata/anonymousObjectTypeMetadata.kt:13:12: error: cannot access 'val o10: Any': it is private in 'lib/O'
val e3 = O.o10
^
COMPILATION_ERROR
@@ -0,0 +1,10 @@
compiler/testData/compileKotlinAgainstCustomBinaries/anonymousObjectTypeMetadataKlib/anonymousObjectTypeMetadata.kt:11:10: error: cannot access 'val o3: Any': it is private in file
val e1 = o3
^
compiler/testData/compileKotlinAgainstCustomBinaries/anonymousObjectTypeMetadataKlib/anonymousObjectTypeMetadata.kt:12:12: error: cannot access 'val o7: Any': it is private in 'lib/W'
val e2 = w.o7
^
compiler/testData/compileKotlinAgainstCustomBinaries/anonymousObjectTypeMetadataKlib/anonymousObjectTypeMetadata.kt:13:12: error: cannot access 'val o10: Any': it is private in 'lib/O'
val e3 = O.o10
^
COMPILATION_ERROR
@@ -0,0 +1,4 @@
compiler/testData/compileKotlinAgainstCustomBinaries/classfileWithoutConstructors/shouldNotCompile.kt:6:9: error: resolution to the classifier 'class TopLevelKt : Any' is not appropriate here.
TopLevelKt() // error here
^
COMPILATION_ERROR
@@ -1,2 +1,2 @@
warning: compiler flag -Xuse-k2 is deprecated; please use "-language-version 2.0" instead
warning: deprecated compiler flag -Xuse-k2 is redundant because of "-language-version 2.0" and should be removed
OK
@@ -0,0 +1,19 @@
compiler/testData/compileKotlinAgainstCustomBinaries/internalFromForeignModule/source.kt:3:21: error: cannot access 'interface InternalInterface : Any': it is internal in file
private fun test(i: InternalInterface): InternalTypealias {
^
compiler/testData/compileKotlinAgainstCustomBinaries/internalFromForeignModule/source.kt:3:41: error: cannot access 'typealias InternalTypealias = InternalInterface': it is internal in file
private fun test(i: InternalInterface): InternalTypealias {
^
compiler/testData/compileKotlinAgainstCustomBinaries/internalFromForeignModule/source.kt:4:19: error: cannot access 'fun internalMemberFun(): Unit': it is internal in 'a/PublicClass'
PublicClass().internalMemberFun()
^
compiler/testData/compileKotlinAgainstCustomBinaries/internalFromForeignModule/source.kt:5:17: error: cannot access 'companion object Companion : Any': it is internal in 'a/PublicClass'
PublicClass.Companion
^
compiler/testData/compileKotlinAgainstCustomBinaries/internalFromForeignModule/source.kt:7:5: error: cannot access 'fun internalFun(s: String): String': it is internal in file
internalFun(internalVal)
^
compiler/testData/compileKotlinAgainstCustomBinaries/internalFromForeignModule/source.kt:7:17: error: cannot access 'val internalVal: String': it is internal in file
internalFun(internalVal)
^
COMPILATION_ERROR
@@ -0,0 +1,7 @@
compiler/testData/compileKotlinAgainstCustomBinaries/prohibitNestedClassesByDollarName/main.kt:6:10: error: unresolved reference: Outer$Nested
test.`Outer$Nested`()
^
compiler/testData/compileKotlinAgainstCustomBinaries/prohibitNestedClassesByDollarName/main.kt:9:10: error: unresolved reference: JavaOuter$JavaNested
test.`JavaOuter$JavaNested`()
^
COMPILATION_ERROR
@@ -0,0 +1,11 @@
warning: ATTENTION!
This build uses unsafe internal compiler arguments:
-XXLanguage:+AllowSealedInheritorsInDifferentFilesOfSamePackage
-XXLanguage:+SealedInterfaces
This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
OK