[FIR] Resolve operator calls to operator functions only

This commit is contained in:
Andrey Zinovyev
2021-05-17 11:46:04 +03:00
committed by TeamCityServer
parent b1c8669b43
commit e021e25d6c
10 changed files with 19 additions and 97 deletions
@@ -1,39 +0,0 @@
// !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(<!ARGUMENT_TYPE_MISMATCH!>a - b<!>)
consumeString(a plus b)
consumeInt(a minus b)
a * b
a / b
a times b
a <!INFIX_MODIFIER_REQUIRED!>div<!> b
}
}
}
fun consumeInt(i: Int) {}
fun consumeString(s: String) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Example
@@ -1,45 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -EXTENSION_SHADOWED_BY_MEMBER
class Example {
operator infix fun plus(other: Example) = 0
fun minus(other: Example) = 0
operator infix fun times(other: Example) = 0
fun div(other: Example) = 0
}
fun Example.plus(other: Example) = ""
operator infix fun Example.minus(other: Example) = ""
operator infix fun Example.times(other: Example) = ""
fun Example.div(other: Example) = ""
fun a() {
val a = Example()
val b = Example()
a + b
a - b
a * b
a / b
a plus b
a minus b
a times b
a <!INFIX_MODIFIER_REQUIRED!>div<!> b
with (Example()) {
consumeInt(this + a)
consumeString(<!ARGUMENT_TYPE_MISMATCH!>this - b<!>)
consumeInt(this * a)
consumeInt(this / b)
consumeInt(this plus a)
consumeString(this minus b)
consumeInt(this times a)
consumeInt(this <!INFIX_MODIFIER_REQUIRED!>div<!> b)
}
}
fun consumeInt(i: Int) {}
fun consumeString(s: String) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -EXTENSION_SHADOWED_BY_MEMBER
class Example {