mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 00:21:28 +00:00
- Introduce new 'rem' operator convention - Prefer 'rem()' to 'mod()' when both are available, even if mod() is a member, and rem() -- an extension - Place operator 'rem' under the language feature
15 lines
228 B
Kotlin
Vendored
15 lines
228 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
|
|
|
|
class Foo {
|
|
operator fun rem(x: Int): Foo = Foo()
|
|
}
|
|
|
|
class Bar {
|
|
operator fun remAssign(x: Int) {}
|
|
}
|
|
|
|
fun baz() {
|
|
val f = Foo() % 1
|
|
val b = Bar()
|
|
b %= 1
|
|
} |