Clarify how elements of arrays are compared by contentEquals function

Add clarification only for the particular group of overloads including
 arrays of object and floating point numbers.

#KT-22942 Fixed
This commit is contained in:
Ilya Gorbunov
2018-12-07 20:41:30 +03:00
parent ef278ea030
commit 23950042f6
5 changed files with 129 additions and 0 deletions
@@ -5617,6 +5617,9 @@ public expect fun CharArray.asList(): List<Char>
*
* If two corresponding elements are nested arrays, they are also compared deeply.
* If any of arrays contains itself on any nesting level the behavior is undefined.
*
* The elements of other types are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun <T> Array<out T>.contentDeepEquals(other: Array<out T>): Boolean
@@ -5645,6 +5648,9 @@ public expect fun <T> Array<out T>.contentDeepToString(): String
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun <T> Array<out T>.contentEquals(other: Array<out T>): Boolean
@@ -5652,6 +5658,9 @@ public expect infix fun <T> Array<out T>.contentEquals(other: Array<out T>): Boo
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun ByteArray.contentEquals(other: ByteArray): Boolean
@@ -5659,6 +5668,9 @@ public expect infix fun ByteArray.contentEquals(other: ByteArray): Boolean
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun ShortArray.contentEquals(other: ShortArray): Boolean
@@ -5666,6 +5678,9 @@ public expect infix fun ShortArray.contentEquals(other: ShortArray): Boolean
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun IntArray.contentEquals(other: IntArray): Boolean
@@ -5673,6 +5688,9 @@ public expect infix fun IntArray.contentEquals(other: IntArray): Boolean
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun LongArray.contentEquals(other: LongArray): Boolean
@@ -5680,6 +5698,9 @@ public expect infix fun LongArray.contentEquals(other: LongArray): Boolean
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun FloatArray.contentEquals(other: FloatArray): Boolean
@@ -5687,6 +5708,9 @@ public expect infix fun FloatArray.contentEquals(other: FloatArray): Boolean
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun DoubleArray.contentEquals(other: DoubleArray): Boolean
@@ -5694,6 +5718,9 @@ public expect infix fun DoubleArray.contentEquals(other: DoubleArray): Boolean
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun BooleanArray.contentEquals(other: BooleanArray): Boolean
@@ -5701,6 +5728,9 @@ public expect infix fun BooleanArray.contentEquals(other: BooleanArray): Boolean
/**
* Returns `true` if the two specified arrays are *structurally* equal to one another,
* i.e. contain the same number of the same elements in the same order.
*
* The elements are compared for equality with the [equals][Any.equals] function.
* For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.
*/
@SinceKotlin("1.1")
public expect infix fun CharArray.contentEquals(other: CharArray): Boolean