blob: d3376fd4cf4303526fb15a6b9672a9cbc28639ab [file]
// LANGUAGE: +CompanionBlocks +CompanionExtensions
class Box<T>(val item: T)
companion fun Box.create(s: String) = Box(s)
companion val Box.defaultValue = "default"
fun box(): String {
val b = Box.create("hello")
if (b.item != "hello") return "FAIL: item=${b.item}"
if (Box.defaultValue != "default") return "FAIL: defaultValue=${Box.defaultValue}"
return "OK"
}