Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Un-deprecate default floating point Orderings, and change to migration
Fixes scala/bug#11844 Ref scala/bug#10511 Ref #6410 Ref #76 This change the deprecation of `DeprecatedDoubleOrdering` to a migration warning instead to avoid `List(1.0, -1.0).sorted` giving deprecation warning. This also provides some documentation on the ordering instances in Scaladoc.
- Loading branch information
Showing
4 changed files
with
112 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ordering-migration.scala:3: warning: object DeprecatedFloatOrdering in object Ordering has changed semantics in version 2.13.0: | ||
The default implicit ordering for floats now maintains consistency | ||
between its `compare` method and its `lt`, `min`, `equiv`, etc., methods, | ||
which means nonconforming to IEEE 754's behavior for -0.0F and NaN. | ||
The sort order of floats remains the same, however, with NaN at the end. | ||
Import Ordering.Float.IeeeOrdering to recover 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 default implicit ordering for doubles now maintains consistency | ||
between its `compare` method and its `lt`, `min`, `equiv`, etc., methods, | ||
which means nonconforming to IEEE 754's behavior for -0.0 and NaN. | ||
The sort order of doubles remains the same, however, with NaN at the end. | ||
Import Ordering.Double.IeeeOrdering to recover 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 default implicit ordering for doubles now maintains consistency | ||
between its `compare` method and its `lt`, `min`, `equiv`, etc., methods, | ||
which means nonconforming to IEEE 754's behavior for -0.0 and NaN. | ||
The sort order of doubles remains the same, however, with NaN at the end. | ||
Import Ordering.Double.IeeeOrdering to recover the previous behavior. | ||
See also https://www.scala-lang.org/api/current/scala/math/Ordering$$Double$.html. | ||
list.sorted | ||
^ | ||
error: No warnings can be incurred under -Werror. | ||
3 warnings | ||
1 error |
2 changes: 1 addition & 1 deletion
2
test/files/neg/t10511.scala → test/files/neg/ordering-migration.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.