Files
kotlin-fork/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.kt
T
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00

43 lines
950 B
Kotlin
Vendored

// !LANGUAGE: -ProhibitOperatorMod
// !WITH_NEW_INFERENCE
// !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
}