Do not use deprecated operations in ranges and progressions hashCode.
This commit is contained in:
@@ -40,7 +40,7 @@ public class ByteProgression(
|
||||
start == other.start && end == other.end && increment == other.increment)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * (31 * start.toInt() + end) + increment)
|
||||
if (isEmpty()) -1 else (31 * (31 * start.toInt() + end.toInt()) + increment)
|
||||
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class CharProgression(
|
||||
start == other.start && end == other.end && increment == other.increment)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * (31 * start.toInt() + end) + increment)
|
||||
if (isEmpty()) -1 else (31 * (31 * start.toInt() + end.toInt()) + increment)
|
||||
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class ShortProgression(
|
||||
start == other.start && end == other.end && increment == other.increment)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * (31 * start.toInt() + end) + increment)
|
||||
if (isEmpty()) -1 else (31 * (31 * start.toInt() + end.toInt()) + increment)
|
||||
|
||||
override fun toString(): String = if (increment > 0) "$start..$end step $increment" else "$start downTo $end step ${-increment}"
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ByteRange(override val start: Byte, override val end: Byte) : Range
|
||||
start == other.start && end == other.end)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end)
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end.toInt())
|
||||
|
||||
companion object {
|
||||
/** An empty range of values of type Byte. */
|
||||
@@ -62,7 +62,7 @@ public class CharRange(override val start: Char, override val end: Char) : Range
|
||||
start == other.start && end == other.end)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end)
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end.toInt())
|
||||
|
||||
companion object {
|
||||
/** An empty range of values of type Char. */
|
||||
@@ -88,7 +88,7 @@ public class ShortRange(override val start: Short, override val end: Short) : Ra
|
||||
start == other.start && end == other.end)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end)
|
||||
if (isEmpty()) -1 else (31 * start.toInt() + end.toInt())
|
||||
|
||||
companion object {
|
||||
/** An empty range of values of type Short. */
|
||||
|
||||
@@ -46,7 +46,7 @@ class GenerateProgressions(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
|
||||
val hashCode = when (kind) {
|
||||
BYTE, CHAR, SHORT -> "=\n" +
|
||||
" if (isEmpty()) -1 else (31 * (31 * start.toInt() + end) + increment)"
|
||||
" if (isEmpty()) -1 else (31 * (31 * start.toInt() + end.toInt()) + increment)"
|
||||
INT -> "=\n" +
|
||||
" if (isEmpty()) -1 else (31 * (31 * start + end) + increment)"
|
||||
LONG -> "=\n" +
|
||||
|
||||
@@ -46,7 +46,7 @@ class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
|
||||
val hashCode = when (kind) {
|
||||
BYTE, CHAR, SHORT -> "=\n" +
|
||||
" if (isEmpty()) -1 else (31 * start.toInt() + end)"
|
||||
" if (isEmpty()) -1 else (31 * start.toInt() + end.toInt())"
|
||||
INT -> "=\n" +
|
||||
" if (isEmpty()) -1 else (31 * start + end)"
|
||||
LONG -> "=\n" +
|
||||
|
||||
Reference in New Issue
Block a user