[Tests] Add CompileKotlinAgainstCustomBinaries test for CR
This commit is contained in:
committed by
teamcity
parent
a86b4d767e
commit
87b0670bbb
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun callOrdinaryAndContextualDeclaration() {
|
||||||
|
ordinary()
|
||||||
|
with(42) {
|
||||||
|
f()
|
||||||
|
val a = A()
|
||||||
|
a.p
|
||||||
|
a.m()
|
||||||
|
p
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
context(Int) val p get() = 42
|
||||||
|
|
||||||
|
context(Int)
|
||||||
|
class A {
|
||||||
|
context(Int) val p get() = 42
|
||||||
|
|
||||||
|
context(Int) fun m() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
context(String)
|
||||||
|
fun f() {
|
||||||
|
println(this@String)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ordinary() {
|
||||||
|
println("I do not require context receivers!")
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
compiler/testData/compileKotlinAgainstCustomBinaries/contextualDeclarationUse/contextualDeclarationUse.kt:6:9: error: to use contextual declarations, specify the `-Xcontext-receivers` compiler option
|
||||||
|
f()
|
||||||
|
^
|
||||||
|
compiler/testData/compileKotlinAgainstCustomBinaries/contextualDeclarationUse/contextualDeclarationUse.kt:7:17: error: to use contextual declarations, specify the `-Xcontext-receivers` compiler option
|
||||||
|
val a = A()
|
||||||
|
^
|
||||||
|
compiler/testData/compileKotlinAgainstCustomBinaries/contextualDeclarationUse/contextualDeclarationUse.kt:8:11: error: to use contextual declarations, specify the `-Xcontext-receivers` compiler option
|
||||||
|
a.p
|
||||||
|
^
|
||||||
|
compiler/testData/compileKotlinAgainstCustomBinaries/contextualDeclarationUse/contextualDeclarationUse.kt:9:11: error: to use contextual declarations, specify the `-Xcontext-receivers` compiler option
|
||||||
|
a.m()
|
||||||
|
^
|
||||||
|
compiler/testData/compileKotlinAgainstCustomBinaries/contextualDeclarationUse/contextualDeclarationUse.kt:10:9: error: to use contextual declarations, specify the `-Xcontext-receivers` compiler option
|
||||||
|
p
|
||||||
|
^
|
||||||
|
COMPILATION_ERROR
|
||||||
+5
@@ -542,6 +542,11 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
|||||||
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8", "-Xjvm-default=all"))
|
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8", "-Xjvm-default=all"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testContextualDeclarationUse() {
|
||||||
|
val library = compileLibrary("library", additionalOptions = listOf("-Xcontext-receivers"))
|
||||||
|
compileKotlin("contextualDeclarationUse.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xskip-prerelease-check"))
|
||||||
|
}
|
||||||
|
|
||||||
fun testJvmDefaultClashWithNoCompatibility() {
|
fun testJvmDefaultClashWithNoCompatibility() {
|
||||||
val library = compileLibrary("library", additionalOptions = listOf("-Xjvm-default=disable"))
|
val library = compileLibrary("library", additionalOptions = listOf("-Xjvm-default=disable"))
|
||||||
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8", "-Xjvm-default=all-compatibility"))
|
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8", "-Xjvm-default=all-compatibility"))
|
||||||
|
|||||||
Reference in New Issue
Block a user