[Tests] Add CompileKotlinAgainstCustomBinaries test for CR

This commit is contained in:
Anastasia.Shadrina
2022-01-21 16:37:37 +07:00
committed by teamcity
parent a86b4d767e
commit 87b0670bbb
4 changed files with 52 additions and 0 deletions
@@ -0,0 +1,12 @@
package test
fun callOrdinaryAndContextualDeclaration() {
ordinary()
with(42) {
f()
val a = A()
a.p
a.m()
p
}
}
@@ -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!")
}
@@ -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