Skip to content

Commit 1272730

Browse files
authored
Warn on inharmonic conversions [ci: last-only] (scala/scala#8679)
Warn on inharmonic conversions [ci: last-only]
2 parents be7524f + 2806c4a commit 1272730

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

library/src/scala/Function0.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// GENERATED CODE: DO NOT EDIT.
14-
// genprod generated these sources at: 2019-06-18T20:49:11.955Z
14+
// genprod generated these sources at: 2020-02-01T04:13:22.795Z
1515

1616
package scala
1717

library/src/scala/Int.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,9 @@ object Int extends AnyValCompanion {
478478
override def toString = "object scala.Int"
479479
/** Language mandated coercions from Int to "wider" types. */
480480
import scala.language.implicitConversions
481-
implicit def int2long(x: Int): Long = x.toLong
481+
@deprecated("Implicit conversion from Int to Float is dangerous because it loses precision. Write `.toFloat` instead.", "2.13.1")
482482
implicit def int2float(x: Int): Float = x.toFloat
483+
implicit def int2long(x: Int): Long = x.toLong
483484
implicit def int2double(x: Int): Double = x.toDouble
484485
}
485486

library/src/scala/Long.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ object Long extends AnyValCompanion {
475475
override def toString = "object scala.Long"
476476
/** Language mandated coercions from Long to "wider" types. */
477477
import scala.language.implicitConversions
478+
@deprecated("Implicit conversion from Long to Float is dangerous because it loses precision. Write `.toFloat` instead.", "2.13.1")
478479
implicit def long2float(x: Long): Float = x.toFloat
480+
@deprecated("Implicit conversion from Long to Double is dangerous because it loses precision. Write `.toDouble` instead.", "2.13.1")
479481
implicit def long2double(x: Long): Double = x.toDouble
480482
}
481483

0 commit comments

Comments
 (0)