Add tests on RequireKotlin on nested classes with metadata version 1.4

This commit is contained in:
Alexander Udalov
2018-07-17 20:25:27 +02:00
parent ea3c5c0107
commit 5fbe35d1c8
13 changed files with 117 additions and 0 deletions
@@ -0,0 +1,12 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package a
import kotlin.internal.RequireKotlin
class Outer {
@RequireKotlin("1.44")
class Nested {
@RequireKotlin("1.88")
fun f() {}
}
}
@@ -0,0 +1,7 @@
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.2
fun test(a: Outer.Nested) {
^
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClasses/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.2
a.f()
^
COMPILATION_ERROR
@@ -0,0 +1,5 @@
import a.Outer
fun test(a: Outer.Nested) {
a.f()
}
@@ -0,0 +1,12 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package a
import kotlin.internal.RequireKotlin
class Outer {
@RequireKotlin("1.44")
class Nested {
@RequireKotlin("1.88")
fun f() {}
}
}
@@ -0,0 +1,7 @@
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.2
fun test(a: Outer.Nested) {
^
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.2
a.f()
^
COMPILATION_ERROR
@@ -0,0 +1,5 @@
import a.Outer
fun test(a: Outer.Nested) {
a.f()
}
@@ -0,0 +1,12 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package a
import kotlin.internal.RequireKotlin
class Outer {
@RequireKotlin("1.44")
class Nested {
@RequireKotlin("1.88")
fun f() {}
}
}
@@ -0,0 +1,7 @@
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.2
fun test(a: Outer.Nested) {
^
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesAgainst14Js/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.2
a.f()
^
COMPILATION_ERROR
@@ -0,0 +1,5 @@
import a.Outer
fun test(a: Outer.Nested) {
a.f()
}
@@ -0,0 +1,12 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package a
import kotlin.internal.RequireKotlin
class Outer {
@RequireKotlin("1.44")
class Nested {
@RequireKotlin("1.88")
fun f() {}
}
}
@@ -0,0 +1,7 @@
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/source.kt:3:19: error: 'Nested' is only available since Kotlin 1.44 and cannot be used in Kotlin 1.2
fun test(a: Outer.Nested) {
^
compiler/testData/compileKotlinAgainstCustomBinaries/requireKotlinInNestedClassesJs/source.kt:4:7: error: 'f(): Unit' is only available since Kotlin 1.88 and cannot be used in Kotlin 1.2
a.f()
^
COMPILATION_ERROR
@@ -0,0 +1,5 @@
import a.Outer
fun test(a: Outer.Nested) {
a.f()
}
@@ -295,6 +295,27 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
doTestKotlinLibraryWithWrongMetadataVersionJs("library", "-Xskip-metadata-version-check")
}
fun testRequireKotlinInNestedClasses() {
compileKotlin("source.kt", tmpdir, listOf(compileLibrary("library")))
}
fun testRequireKotlinInNestedClassesJs() {
compileKotlin("source.kt", File(tmpdir, "usage.js"), listOf(compileJsLibrary("library")), K2JSCompiler())
}
fun testRequireKotlinInNestedClassesAgainst14() {
val library = compileLibrary("library", additionalOptions = listOf("-Xmetadata-version=1.4.0"))
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xskip-metadata-version-check"))
}
fun testRequireKotlinInNestedClassesAgainst14Js() {
val library = compileJsLibrary("library", additionalOptions = listOf("-Xmetadata-version=1.4.0"))
compileKotlin(
"source.kt", File(tmpdir, "usage.js"), listOf(library), K2JSCompiler(),
additionalOptions = listOf("-Xskip-metadata-version-check")
)
}
/*test source mapping generation when source info is absent*/
fun testInlineFunWithoutDebugInfo() {
compileKotlin("sourceInline.kt", tmpdir)