Files
kotlin-fork/compiler/testData/codegen/box/operatorConventions/infixFunctionOverBuiltinMember.kt
T
Andrey Zinovyev b1c8669b43 [FIR] Resolve infix calls to infix functions only
Implements INFIX_MODIFIER_REQUIRED diagnostics
2021-05-20 13:46:27 +03:00

18 lines
348 B
Kotlin
Vendored

infix fun Int.rem(other: Int) = 10
infix operator fun Int.minus(other: Int): Int = 20
fun box(): String {
val a = 5 rem 2
if (a != 10) return "fail 1"
val b = 5 minus 3
if (b != 20) return "fail 2"
val a1 = 5.rem(2)
if (a1 != 1) return "fail 3"
val b2 = 5.minus(3)
if (b2 != 2) return "fail 4"
return "OK"
}