Fix resolve (members/extensions with 'infix' has higher priority)

This commit is contained in:
Yan Zhulanow
2015-09-30 21:39:26 +03:00
parent d28ecc2316
commit 7e8674c6ee
9 changed files with 65 additions and 25 deletions
@@ -0,0 +1,41 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Example
fun Example.plus(other: Example) = 0
operator infix fun Example.minus(other: Example) = 0
operator infix fun Example.times(other: Example) = 0
fun Example.div(other: Example) = 0
fun a() {
with (Example()) {
operator infix fun Example.plus(other: Example) = ""
fun Example.minus(other: Example) = ""
operator infix fun Example.times(other: Example) = ""
fun Example.div(other: Example) = ""
with (Example()) {
val a = Example()
val b = Example()
consumeString(a + b)
consumeInt(a - b)
consumeString(a plus b)
consumeInt(a minus b)
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>*<!> b
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>/<!> b
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>times<!> b
a <!OVERLOAD_RESOLUTION_AMBIGUITY!>div<!> b
}
}
}
public fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
fun consumeInt(i: Int) {}
fun consumeString(s: String) {}