Files
kotlin-fork/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

42 lines
927 B
Kotlin
Vendored

// !LANGUAGE: -ProhibitOperatorMod
// !DIAGNOSTICS: -UNUSED_PARAMETER
class OldAndNew {
<!DEPRECATED_BINARY_MOD!>operator<!> fun modAssign(x: Int) {}
operator fun remAssign(x: Int) {}
}
class OnlyOld {
<!DEPRECATED_BINARY_MOD!>operator<!> fun modAssign(x: Int) {}
}
class OnlyNew {
operator fun remAssign(x: Int) {}
}
class Sample
<!DEPRECATED_BINARY_MOD!>operator<!> fun Sample.modAssign(x: Int) {}
operator fun Sample.remAssign(x: Int) {}
class ModAndRemAssign {
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int): ModAndRemAssign = ModAndRemAssign()
operator fun remAssign(x: Int) {}
}
fun test() {
val oldAndNew = OldAndNew()
oldAndNew %= 1
val onlyOld = OnlyOld()
onlyOld <!DEPRECATED_BINARY_MOD_AS_REM!>%=<!> 1
val onlyNew = OnlyNew()
onlyNew %= 1
val sample = Sample()
sample %= 1
var modAndRemAssign = ModAndRemAssign()
modAndRemAssign %= 1
}