aboutsummaryrefslogtreecommitdiff
path: root/tests/run/iterator-from.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-08 22:06:22 +0100
committerMartin Odersky <odersky@gmail.com>2017-03-08 22:06:35 +0100
commitaa2f9078d76a21d828a06b8e324d31a502ee505c (patch)
treebf657e58c1a78357349def2309dd41c0cecdd9a1 /tests/run/iterator-from.scala
parent180dfdc7e81d632e599fb0a545025720e8000573 (diff)
downloaddotty-aa2f9078d76a21d828a06b8e324d31a502ee505c.tar.gz
dotty-aa2f9078d76a21d828a06b8e324d31a502ee505c.tar.bz2
dotty-aa2f9078d76a21d828a06b8e324d31a502ee505c.zip
Drop special case around Function1
Now only Scala2 mode treats Function1's as implicit conversions. Instead we introduce a new subclass ImplicitConverter of Function1, instances of which are turned into implicit conversions.
Diffstat (limited to 'tests/run/iterator-from.scala')
-rw-r--r--tests/run/iterator-from.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/run/iterator-from.scala b/tests/run/iterator-from.scala
index 4f403680c..c7c0f9809 100644
--- a/tests/run/iterator-from.scala
+++ b/tests/run/iterator-from.scala
@@ -11,7 +11,9 @@ object Test extends dotty.runtime.LegacyApp {
val maxKey = 50
val maxValue = 50
- def testSet[A <% Ordered[A]](set: SortedSet[A], list: List[A]): Unit = {
+ implicit def convertIfView[A](x: A)(implicit view: A => Ordered[A]): Ordered[A] = view(x)
+
+ def testSet[A: Ordering](set: SortedSet[A], list: List[A]): Unit = {
val distinctSorted = list.distinct.sorted
assertEquals("Set size wasn't the same as list sze", set.size, distinctSorted.size)
@@ -24,7 +26,7 @@ object Test extends dotty.runtime.LegacyApp {
}
}
- def testMap[A <% Ordered[A], B](map: SortedMap[A, B], list: List[(A, B)]): Unit = {
+ def testMap[A: Ordering, B](map: SortedMap[A, B], list: List[(A, B)]): Unit = {
val distinctSorted = distinctByKey(list).sortBy(_._1)
assertEquals("Map size wasn't the same as list sze", map.size, distinctSorted.size)