mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
20 lines
332 B
Kotlin
Vendored
20 lines
332 B
Kotlin
Vendored
// !LANGUAGE: -ProhibitOperatorMod
|
|
|
|
class A() {
|
|
var x = 5
|
|
|
|
operator fun mod(y: Int) { throw RuntimeException("mod has been called instead of rem") }
|
|
operator fun rem(y: Int) { x -= y }
|
|
}
|
|
|
|
fun box(): String {
|
|
val a = A()
|
|
|
|
a % 5
|
|
|
|
if (a.x != 0) {
|
|
return "Fail: a.x(${a.x}) != 0"
|
|
}
|
|
|
|
return "OK"
|
|
} |