Raise deprecation level for mod operators to ERROR in stdlib

#KT-25217 In Progress
This commit is contained in:
Mikhail Zarechenskiy
2018-09-07 11:44:37 +03:00
parent b12e0aab2f
commit 7595cb23ab
15 changed files with 109 additions and 89 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ const val prop1: Int = 1.plus(1)
const val prop2: Int = 1.minus(1)
const val prop3: Int = 1.times(1)
const val prop4: Int = 1.div(1)
const val prop5: Int = 1.mod(1)
const val prop5: Int = 1.rem(1)
@Ann(prop1, prop2, prop3, prop4, prop5) class MyClass
@@ -21,7 +21,7 @@ val l20: Int = <!INTEGER_OVERFLOW!>30 * 24 * 60 * 60 * 1000<!>
val l21: Int = intMinValue - intMinValue
val l22: Int = <!INTEGER_OVERFLOW!>intMinValue + <!INTEGER_OVERFLOW!>-intMinValue<!><!>
val l23: Int = intMaxValue + <!INTEGER_OVERFLOW!>-intMinValue<!>
val l24: Int = (-1).<!DEPRECATION!>mod<!>(5)
val l24: Int = (-1).<!DEPRECATION_ERROR!>mod<!>(5)
val l25: Int = (-1).rem(5)
val l26: Int = (-1) % 5
@@ -45,7 +45,7 @@ fun foo() {
val l21: Int = intMinValue - intMinValue
val l22: Int = <!INTEGER_OVERFLOW!>intMinValue + <!INTEGER_OVERFLOW!>-intMinValue<!><!>
val l23: Int = intMaxValue + <!INTEGER_OVERFLOW!>-intMinValue<!>
val l24: Int = (-1).<!DEPRECATION!>mod<!>(5)
val l24: Int = (-1).<!DEPRECATION_ERROR!>mod<!>(5)
val l25: Int = (-1).rem(5)
val l26: Int = (-1) % 5
}
@@ -70,7 +70,7 @@ class A {
val l21: Int = intMinValue - intMinValue
val l22: Int = <!INTEGER_OVERFLOW!>intMinValue + <!INTEGER_OVERFLOW!>-intMinValue<!><!>
val l23: Int = intMaxValue + <!INTEGER_OVERFLOW!>-intMinValue<!>
val l24: Int = (-1).<!DEPRECATION!>mod<!>(5)
§ val l24: Int = (-1).<!DEPRECATION_ERROR!>mod<!>(5)
val l25: Int = (-1).rem(5)
val l26: Int = (-1) % 5
}
@@ -19,10 +19,10 @@ fun test() {
fooLong(1.div(1))
fooShort(1.div(1))
fooInt(1.<!DEPRECATION!>mod<!>(1))
fooByte(1.<!DEPRECATION!>mod<!>(1))
fooLong(1.<!DEPRECATION!>mod<!>(1))
fooShort(1.<!DEPRECATION!>mod<!>(1))
fooInt(1.<!DEPRECATION_ERROR!>mod<!>(1))
fooByte(1.<!DEPRECATION_ERROR!>mod<!>(1))
fooLong(1.<!DEPRECATION_ERROR!>mod<!>(1))
fooShort(1.<!DEPRECATION_ERROR!>mod<!>(1))
fooInt(1.rem(1))
fooByte(1.rem(1))
@@ -19,10 +19,10 @@ fun test() {
fooLong(1 <!INFIX_MODIFIER_REQUIRED!>div<!> 1)
fooShort(1 <!INFIX_MODIFIER_REQUIRED!>div<!> 1)
fooInt(1 <!DEPRECATION, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooByte(1 <!DEPRECATION, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooLong(1 <!DEPRECATION, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooShort(1 <!DEPRECATION, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooInt(1 <!DEPRECATION_ERROR, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooByte(1 <!DEPRECATION_ERROR, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooLong(1 <!DEPRECATION_ERROR, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooShort(1 <!DEPRECATION_ERROR, INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooInt(1 <!INFIX_MODIFIER_REQUIRED!>rem<!> 1)
fooByte(1 <!INFIX_MODIFIER_REQUIRED!>rem<!> 1)
@@ -82,7 +82,7 @@ const val nonConstInitializer9 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1.0/0.0
const val nonConstInitializer10 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0/0<!>
const val nonConstInitializer11 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1 % 0<!>
const val nonConstInitializer12 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0 % 0<!>
const val nonConstInitializer13 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.<!DEPRECATION!>mod<!>(0)<!>
const val nonConstInitializer13 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.<!DEPRECATION_ERROR!>mod<!>(0)<!>
const val nonConstInitializer14 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.rem(0)<!>
const val nonConstInitializer15 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.div(0)<!>
@@ -99,7 +99,7 @@ const val constInitializer10 = 1.0 % 0
const val constInitializer11 = 0.0 % 0
const val constInitializer12 = (-1.0) % 0
const val constInitializer13 = 1.0.rem(0)
const val constInitializer14 = 1.0.<!DEPRECATION!>mod<!>(0)
const val constInitializer14 = 1.0.<!DEPRECATION_ERROR!>mod<!>(0)
const val constInitializer15 = 1.0.div(0)
// ------------------
@@ -6,7 +6,7 @@ const val b = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1.0 / 0<!>
const val c = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.0 / 0<!>
const val d = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>1.0 % 0<!>
const val e = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.0 % 0<!>
const val f = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.0.<!DEPRECATION!>mod<!>(0)<!>
const val f = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.0.<!DEPRECATION_ERROR!>mod<!>(0)<!>
const val g = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.0.rem(0)<!>
const val h = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>0.0.div(0)<!>
@@ -16,6 +16,6 @@ val nonConst1 = 1.0 / 0
val nonConst2 = 1 / 0
val nonConst3 = 1.0 % 0
val nonConst4 = 1 % 0
val nonConst5 = 1.<!DEPRECATION!>mod<!>(0)
val nonConst5 = 1.<!DEPRECATION_ERROR!>mod<!>(0)
val nonConst6 = 1.rem(0)
val nonConst7 = 1.div(0)
@@ -0,0 +1,3 @@
fun test() {
1.<!DEPRECATION_ERROR!>mod<!>(3)
}
@@ -0,0 +1,3 @@
package
public fun test(): kotlin.Unit
@@ -137,12 +137,12 @@ private val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<A
binaryOperation(BYTE, INT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(BYTE, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(BYTE, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(BYTE, BYTE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, DOUBLE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(BYTE, FLOAT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(BYTE, INT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, LONG, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, SHORT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, BYTE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, DOUBLE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(BYTE, FLOAT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(BYTE, INT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, LONG, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, SHORT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(BYTE, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
binaryOperation(BYTE, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(BYTE, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun),
@@ -179,12 +179,12 @@ private val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<A
binaryOperation(DOUBLE, INT, "div", { a, b -> a.div(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, LONG, "div", { a, b -> a.div(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, SHORT, "div", { a, b -> a.div(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, BYTE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, DOUBLE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, FLOAT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, INT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, LONG, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, SHORT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, BYTE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, DOUBLE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, FLOAT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, INT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, LONG, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, SHORT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, BYTE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(DOUBLE, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun),
@@ -216,12 +216,12 @@ private val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<A
binaryOperation(FLOAT, INT, "div", { a, b -> a.div(b) }, emptyBinaryFun),
binaryOperation(FLOAT, LONG, "div", { a, b -> a.div(b) }, emptyBinaryFun),
binaryOperation(FLOAT, SHORT, "div", { a, b -> a.div(b) }, emptyBinaryFun),
binaryOperation(FLOAT, BYTE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, DOUBLE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, FLOAT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, INT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, LONG, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, SHORT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, BYTE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, DOUBLE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, FLOAT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, INT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, LONG, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, SHORT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(FLOAT, BYTE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(FLOAT, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(FLOAT, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun),
@@ -250,12 +250,12 @@ private val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<A
binaryOperation(INT, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(INT, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(INT, INT, "shr", { a, b -> a.shr(b) }, emptyBinaryFun),
binaryOperation(INT, BYTE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, DOUBLE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(INT, FLOAT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(INT, INT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, LONG, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, SHORT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, BYTE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, DOUBLE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(INT, FLOAT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(INT, INT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, LONG, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, SHORT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(INT, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
binaryOperation(INT, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(INT, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun),
@@ -293,12 +293,12 @@ private val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<A
binaryOperation(LONG, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(LONG, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(LONG, INT, "shr", { a, b -> a.shr(b) }, emptyBinaryFun),
binaryOperation(LONG, BYTE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, DOUBLE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(LONG, FLOAT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(LONG, INT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, LONG, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, SHORT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, BYTE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, DOUBLE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(LONG, FLOAT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(LONG, INT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, LONG, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, SHORT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(LONG, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
binaryOperation(LONG, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(LONG, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun),
@@ -339,12 +339,12 @@ private val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<A
binaryOperation(SHORT, INT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(SHORT, LONG, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(SHORT, SHORT, "div", { a, b -> a.div(b) }, { a, b -> a.divide(b) }),
binaryOperation(SHORT, BYTE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, DOUBLE, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(SHORT, FLOAT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(SHORT, INT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, LONG, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, SHORT, "mod", { a, b -> a.<!DEPRECATION!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, BYTE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, DOUBLE, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(SHORT, FLOAT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, emptyBinaryFun),
binaryOperation(SHORT, INT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, LONG, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, SHORT, "mod", { a, b -> a.<!DEPRECATION_ERROR!>mod<!>(b) }, { a, b -> a.mod(b) }),
binaryOperation(SHORT, BYTE, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
binaryOperation(SHORT, DOUBLE, "times", { a, b -> a.times(b) }, emptyBinaryFun),
binaryOperation(SHORT, FLOAT, "times", { a, b -> a.times(b) }, emptyBinaryFun),