mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 15:53:40 +00:00
- locals win - unary calls to plus/minus are not supported in favor of unaryPlus/unaryMinus - unqualified nested classes are temporarily reported as unresolved - function without receiver win against extension function - explicit import win against star import
45 lines
802 B
Kotlin
Vendored
45 lines
802 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
|
|
open class Example {
|
|
fun invoke() = 0
|
|
fun get(i: Int) = 0
|
|
|
|
fun component1() = 0
|
|
fun component2() = 0
|
|
|
|
fun inc() = Example()
|
|
|
|
fun plus(o: Example) = 0
|
|
}
|
|
|
|
class Example2 : Example()
|
|
|
|
operator fun Example.invoke() = ""
|
|
operator fun Example.get(i: Int) = ""
|
|
|
|
operator fun Example.component1() = ""
|
|
operator fun Example.component2() = ""
|
|
|
|
operator fun Example.inc() = Example2()
|
|
|
|
infix fun Example.plus(o: Example) = ""
|
|
|
|
fun test() {
|
|
var a = Example()
|
|
val b = Example()
|
|
|
|
consumeString(a())
|
|
consumeString(a[1])
|
|
|
|
val (x, y) = Example()
|
|
consumeString(x)
|
|
consumeString(y)
|
|
|
|
consumeExample2(++a)
|
|
|
|
consumeString(a plus b)
|
|
}
|
|
|
|
fun consumeInt(i: Int) {}
|
|
fun consumeString(s: String) {}
|
|
fun consumeExample2(e: Example2) {} |