Files
kotlin-fork/compiler/testData/codegen/box/extensionFunctions/contextReceivers/fromKEEP/canvas.kt
T
2021-12-09 13:26:37 +03:00

24 lines
443 B
Kotlin
Vendored

// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// FIR status: context receivers aren't yet supported
interface Canvas {
val suffix: String
}
interface Shape {
context(Canvas)
fun draw(): String
}
class Circle : Shape {
context(Canvas)
override fun draw() = "OK" + suffix
}
object MyCanvas : Canvas {
override val suffix = ""
}
fun box() = with(MyCanvas) { Circle().draw() }