mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
25 lines
540 B
Kotlin
Vendored
25 lines
540 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
// IGNORE_BACKEND: JVM_IR
|
|
|
|
inline class Foo(val x: Int) {
|
|
fun empty() = ""
|
|
fun withParam(a: String) = a
|
|
fun withInlineClassParam(f: Foo) = f.toString()
|
|
|
|
fun test(): String {
|
|
val a = empty()
|
|
val b = withParam("hello")
|
|
val c = withInlineClassParam(this)
|
|
return a + b + c
|
|
}
|
|
|
|
override fun toString(): String {
|
|
return x.toString()
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
val f = Foo(12)
|
|
return if (f.test() != "hello12") "fail" else "OK"
|
|
return "OK"
|
|
} |