mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
- Put extensionReceiver to candidate even if it's explicit (for sake of clarity) - Split CheckReceiver (dispatch part should only check nullability)
22 lines
635 B
Kotlin
Vendored
22 lines
635 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
// IGNORE_BACKEND: JVM
|
|
// IGNORE_LIGHT_ANALYSIS
|
|
inline class IC(val x: String)
|
|
|
|
fun IC?.foo() = toString() // `IC?` unboxed into `String?`
|
|
fun IC?.bar() = "$this"
|
|
|
|
fun assertEquals(a: String, b: String) {
|
|
if (a != b) throw AssertionError("$a != $b")
|
|
}
|
|
|
|
fun box(): String {
|
|
assertEquals((null as IC?).foo(), "null")
|
|
assertEquals((null as IC?).foo(), (null as IC?).toString())
|
|
assertEquals((null as IC?).foo(), (null as IC?).bar())
|
|
assertEquals(IC("x").foo(), "IC(x=x)")
|
|
assertEquals(IC("x").foo(), IC("x").toString())
|
|
assertEquals(IC("x").foo(), IC("x").bar())
|
|
return "OK"
|
|
}
|