diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-08 22:06:22 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-03-08 22:06:35 +0100 |
commit | aa2f9078d76a21d828a06b8e324d31a502ee505c (patch) | |
tree | bf657e58c1a78357349def2309dd41c0cecdd9a1 /tests/run | |
parent | 180dfdc7e81d632e599fb0a545025720e8000573 (diff) | |
download | dotty-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')
-rw-r--r-- | tests/run/iterator-from.scala | 6 | ||||
-rw-r--r-- | tests/run/t8280.scala | 6 |
2 files changed, 7 insertions, 5 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) diff --git a/tests/run/t8280.scala b/tests/run/t8280.scala index 1d2c56b85..5fcbad0a3 100644 --- a/tests/run/t8280.scala +++ b/tests/run/t8280.scala @@ -74,14 +74,14 @@ object Moop3 { // Dotty deviation. This fails for Dotty with ambiguity error for similar reasons as ob1. } object ob2 { - implicit val f1: Int => String = _ => "Int" + implicit val f1: ImplicitConverter[Int, String] = _ => "Int" implicit def f2(x: Long): String = "Long" println(5: String) } object ob3 { - implicit val f1: Int => String = _ => "Int" - implicit val f2: Long => String = _ => "Long" + implicit val f1: ImplicitConverter[Int, String] = _ => "Int" + implicit val f2: ImplicitConverter[Long, String] = _ => "Long" println(5: String) } |