Skip to content

Commit

Permalink
wip - reflect review
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Feb 16, 2020
1 parent 27a8cc3 commit acf7044
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions src/library/scala/math/Ordering.scala
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,10 @@ object Ordering extends LowPriorityOrderingImplicits {
* `Float.NaN == Float.NaN` all yield `false`, analogous to `None`.
*
* Recognizing the limitation of the IEEE 754 semantics in terms of ordering,
* Scala 2.13.0 created two instances `Ordering.Float.IeeeOrdering` and
* `Ordering.Float.TotalOrdering`, which brings back the `java.lang.Float.compare`
* semantics for all operations. The default extends `TotalOrdering`.
* Scala 2.13.0 created two instances: `Ordering.Float.IeeeOrdering`, which retains
* the IEEE 754 semantics from Scala 2.12.x, and `Ordering.Float.TotalOrdering`,
* which brings back the `java.lang.Float.compare` semantics for all operations.
* The default extends `TotalOrdering`.
*
* {{{
* List(0.0F, 1.0F, 0.0F / 0.0F, -1.0F / 0.0F).sorted // List(-Infinity, 0.0, 1.0, NaN)
Expand Down Expand Up @@ -455,7 +456,7 @@ object Ordering extends LowPriorityOrderingImplicits {
@migration(
" The new ordering does not affect the sorting, placing NaN at the end.\n" +
" However, methods such as `lt`, `min`, and `equiv` now match `compare`\n" +
" instead of giving IEEE 754 behavior for -0.0F and NaN.\n" +
" instead of having IEEE 754 behavior for -0.0F and NaN.\n" +
" Import Ordering.Float.IeeeOrdering to retain the previous behavior.\n" +
" See also https://www.scala-lang.org/api/current/scala/math/Ordering$$Float$.html", "2.13.0")
implicit object DeprecatedFloatOrdering extends Float.TotalOrdering
Expand All @@ -475,9 +476,10 @@ object Ordering extends LowPriorityOrderingImplicits {
* `Double.NaN == Double.NaN` all yield `false`, analogous to `None`.
*
* Recognizing the limitation of the IEEE 754 semantics in terms of ordering,
* Scala 2.13.0 created two instances `Ordering.Double.IeeeOrdering` and
* `Ordering.Double.TotalOrdering`, which brings back the `java.lang.Double.compare`
* semantics for all operations. The default extends `TotalOrdering`.
* Scala 2.13.0 created two instances: `Ordering.Double.IeeeOrdering`, which retains
* the IEEE 754 semantics from Scala 2.12.x, and `Ordering.Double.TotalOrdering`,
* which brings back the `java.lang.Double.compare` semantics for all operations.
* The default extends `TotalOrdering`.
*
* {{{
* List(0.0, 1.0, 0.0 / 0.0, -1.0 / 0.0).sorted // List(-Infinity, 0.0, 1.0, NaN)
Expand Down Expand Up @@ -547,7 +549,7 @@ object Ordering extends LowPriorityOrderingImplicits {
@migration(
" The new ordering does not affect the sorting, placing NaN at the end.\n" +
" However, methods such as `lt`, `min`, and `equiv` now match `compare`\n" +
" instead of giving IEEE 754 behavior for -0.0 and NaN.\n" +
" instead of having IEEE 754 behavior for -0.0 and NaN.\n" +
" Import Ordering.Double.IeeeOrdering to retain the previous behavior.\n" +
" See also https://www.scala-lang.org/api/current/scala/math/Ordering$$Double$.html.", "2.13.0")
implicit object DeprecatedDoubleOrdering extends Double.TotalOrdering
Expand Down
6 changes: 3 additions & 3 deletions test/files/neg/ordering-migration.check
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
ordering-migration.scala:3: warning: object DeprecatedFloatOrdering in object Ordering has changed semantics in version 2.13.0:
The new ordering does not affect the sorting, placing NaN at the end.
However, methods such as `lt`, `min`, and `equiv` now match `compare`
instead of giving IEEE 754 behavior for -0.0F and NaN.
instead of having IEEE 754 behavior for -0.0F and NaN.
Import Ordering.Float.IeeeOrdering to retain the previous behavior.
See also https://www.scala-lang.org/api/current/scala/math/Ordering$$Float$.html
val f = Ordering[Float]
^
ordering-migration.scala:4: warning: object DeprecatedDoubleOrdering in object Ordering has changed semantics in version 2.13.0:
The new ordering does not affect the sorting, placing NaN at the end.
However, methods such as `lt`, `min`, and `equiv` now match `compare`
instead of giving IEEE 754 behavior for -0.0 and NaN.
instead of having IEEE 754 behavior for -0.0 and NaN.
Import Ordering.Double.IeeeOrdering to retain the previous behavior.
See also https://www.scala-lang.org/api/current/scala/math/Ordering$$Double$.html.
val d = Ordering[Double]
^
ordering-migration.scala:7: warning: object DeprecatedDoubleOrdering in object Ordering has changed semantics in version 2.13.0:
The new ordering does not affect the sorting, placing NaN at the end.
However, methods such as `lt`, `min`, and `equiv` now match `compare`
instead of giving IEEE 754 behavior for -0.0 and NaN.
instead of having IEEE 754 behavior for -0.0 and NaN.
Import Ordering.Double.IeeeOrdering to retain the previous behavior.
See also https://www.scala-lang.org/api/current/scala/math/Ordering$$Double$.html.
list.sorted
Expand Down

0 comments on commit acf7044

Please sign in to comment.