Files
kotlin-fork/compiler/testData/diagnostics/tests/modifiers/operatorInfix/MemberFunctions.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

46 lines
1.0 KiB
Kotlin
Vendored

// !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 <!OPERATOR_MODIFIER_REQUIRED!>/<!> b
a plus b
a minus b
a times b
a <!INFIX_MODIFIER_REQUIRED!>div<!> b
with (Example()) {
consumeInt(this + a)
consumeString(this - b)
consumeInt(this * a)
consumeInt(this <!OPERATOR_MODIFIER_REQUIRED!>/<!> 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) {}