Deprecate mixed Int/FP contains operator for ranges
#KT-22423
This commit is contained in:
@@ -120,6 +120,7 @@ public operator fun ClosedRange<Short>.contains(value: Byte): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("doubleRangeContains")
|
||||
public operator fun ClosedRange<Double>.contains(value: Byte): Boolean {
|
||||
return contains(value.toDouble())
|
||||
@@ -128,6 +129,7 @@ public operator fun ClosedRange<Double>.contains(value: Byte): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("floatRangeContains")
|
||||
public operator fun ClosedRange<Float>.contains(value: Byte): Boolean {
|
||||
return contains(value.toFloat())
|
||||
@@ -136,6 +138,7 @@ public operator fun ClosedRange<Float>.contains(value: Byte): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("intRangeContains")
|
||||
public operator fun ClosedRange<Int>.contains(value: Double): Boolean {
|
||||
return value.toIntExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -144,6 +147,7 @@ public operator fun ClosedRange<Int>.contains(value: Double): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("longRangeContains")
|
||||
public operator fun ClosedRange<Long>.contains(value: Double): Boolean {
|
||||
return value.toLongExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -152,6 +156,7 @@ public operator fun ClosedRange<Long>.contains(value: Double): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("byteRangeContains")
|
||||
public operator fun ClosedRange<Byte>.contains(value: Double): Boolean {
|
||||
return value.toByteExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -160,6 +165,7 @@ public operator fun ClosedRange<Byte>.contains(value: Double): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("shortRangeContains")
|
||||
public operator fun ClosedRange<Short>.contains(value: Double): Boolean {
|
||||
return value.toShortExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -176,6 +182,7 @@ public operator fun ClosedRange<Float>.contains(value: Double): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("intRangeContains")
|
||||
public operator fun ClosedRange<Int>.contains(value: Float): Boolean {
|
||||
return value.toIntExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -184,6 +191,7 @@ public operator fun ClosedRange<Int>.contains(value: Float): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("longRangeContains")
|
||||
public operator fun ClosedRange<Long>.contains(value: Float): Boolean {
|
||||
return value.toLongExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -192,6 +200,7 @@ public operator fun ClosedRange<Long>.contains(value: Float): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("byteRangeContains")
|
||||
public operator fun ClosedRange<Byte>.contains(value: Float): Boolean {
|
||||
return value.toByteExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -200,6 +209,7 @@ public operator fun ClosedRange<Byte>.contains(value: Float): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("shortRangeContains")
|
||||
public operator fun ClosedRange<Short>.contains(value: Float): Boolean {
|
||||
return value.toShortExactOrNull().let { if (it != null) contains(it) else false }
|
||||
@@ -240,6 +250,7 @@ public operator fun ClosedRange<Short>.contains(value: Int): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("doubleRangeContains")
|
||||
public operator fun ClosedRange<Double>.contains(value: Int): Boolean {
|
||||
return contains(value.toDouble())
|
||||
@@ -248,6 +259,7 @@ public operator fun ClosedRange<Double>.contains(value: Int): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("floatRangeContains")
|
||||
public operator fun ClosedRange<Float>.contains(value: Int): Boolean {
|
||||
return contains(value.toFloat())
|
||||
@@ -280,6 +292,7 @@ public operator fun ClosedRange<Short>.contains(value: Long): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("doubleRangeContains")
|
||||
public operator fun ClosedRange<Double>.contains(value: Long): Boolean {
|
||||
return contains(value.toDouble())
|
||||
@@ -288,6 +301,7 @@ public operator fun ClosedRange<Double>.contains(value: Long): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("floatRangeContains")
|
||||
public operator fun ClosedRange<Float>.contains(value: Long): Boolean {
|
||||
return contains(value.toFloat())
|
||||
@@ -320,6 +334,7 @@ public operator fun ClosedRange<Byte>.contains(value: Short): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("doubleRangeContains")
|
||||
public operator fun ClosedRange<Double>.contains(value: Short): Boolean {
|
||||
return contains(value.toDouble())
|
||||
@@ -328,6 +343,7 @@ public operator fun ClosedRange<Double>.contains(value: Short): Boolean {
|
||||
/**
|
||||
* Checks if the specified [value] belongs to this range.
|
||||
*/
|
||||
@Deprecated("This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.")
|
||||
@kotlin.jvm.JvmName("floatRangeContains")
|
||||
public operator fun ClosedRange<Float>.contains(value: Short): Boolean {
|
||||
return contains(value.toFloat())
|
||||
|
||||
Reference in New Issue
Block a user