Files
kotlin-fork/compiler/visualizer/testData/rawBuilder/expressions/calls.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

73 lines
2.0 KiB
Kotlin
Vendored

// WITH_STDLIB
// fun (Int).plus(Int): Int
// Int │ distance.y: Int
// │ │ │
infix fun Int.distance(y: Int) = this + y
// Int
// │ Int
// │ │ fun Int.distance(Int): Int
// │ │ │ Int
// │ │ │ │
fun test(): Int = 3 distance 4
// Int
// │ Int
// │ │ fun Int.distance(Int): Int
// │ │ │ Int
// │ │ │ │
fun testRegular(): Int = 3.distance(4)
class My(var x: Int) {
// Int
// │ var (My).x: Int
// │ │
operator fun invoke() = x
fun foo() {}
// My
// │ constructor My(Int)
// │ │ var (My).x: Int
// │ │ │
fun copy() = My(x)
}
// Int
// │ constructor My(Int)
// │ fun (My).invoke(): Int
// │ │ Int
// │ │ │
fun testInvoke(): Int = My(13)()
fun testQualified(first: My, second: My?) {
// fun io/println(Int): Unit
// │ testQualified.first: My
// │ │ var (My).x: Int
// │ │ │
println(first.x)
// fun io/println(Any?): Unit
// │ testQualified.second: My?
// │ │ var (My).x: Int
// │ │ │
println(second?.x)
// testQualified.first: My
// │ fun (My).foo(): Unit
// │ │
first.foo()
// testQualified.second: My?
// │ fun (My).foo(): Unit
// │ │
second?.foo()
// testQualified.first: My
// │ fun (My).copy(): My
// │ │ fun (My).foo(): Unit
// │ │ │
first.copy().foo()
// testQualified.first: My
// │ var (My).x: Int
// │ │ Int
// │ │ │
first.x = 42
}