Skip to content

Commit 898d62b

Browse files
authored
Merge pull request #8237 from dotty-staging/remove-old-implicits-from-library
Update old implicits to given/using in the Dotty library
2 parents fe05020 + c1c7860 commit 898d62b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

library/src/scala/Eql.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ object Eql {
2323
def eqlAny[L, R]: Eql[L, R] = derived
2424

2525
// Instances of `Eql` for common Java types
26-
implicit def eqlNumber : Eql[Number, Number] = derived
27-
implicit def eqlString : Eql[String, String] = derived
26+
given eqlNumber as Eql[Number, Number] = derived
27+
given eqlString as Eql[String, String] = derived
2828

2929
// The next three definitions can go into the companion objects of classes
3030
// Seq, Set, and Proxy. For now they are here in order not to have to touch the
3131
// source code of these classes
32-
implicit def eqlSeq[T, U](implicit eq: Eql[T, U]): Eql[GenSeq[T], GenSeq[U]] = derived
33-
implicit def eqlSet[T, U](implicit eq: Eql[T, U]): Eql[Set[T], Set[U]] = derived
32+
given eqlSeq[T, U](using eq: Eql[T, U]) as Eql[GenSeq[T], GenSeq[U]] = derived
33+
given eqlSet[T, U](using eq: Eql[T, U]) as Eql[Set[T], Set[U]] = derived
3434

3535
// true asymmetry, modeling the (somewhat problematic) nature of equals on Proxies
36-
implicit def eqlProxy : Eql[Proxy, AnyRef] = derived
36+
given eqlProxy as Eql[Proxy, AnyRef] = derived
3737
}

library/src/scala/implicits/Not.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ package scala.implicits
77
* value of type `C` is available. If we do not want to prioritize `i1` and `i2` by
88
* putting them in different traits we can instead define the following:
99
*
10-
* implicit def i1: D(implicit ev: C) = ...
11-
* implicit def i2: D(implicit ev: Not[C]) = ...
10+
* given i1: D(using ev: C) = ...
11+
* given i2: D(using ev: Not[C]) = ...
1212
*
1313
* `Not` is treated specially in implicit search, similar to the way logical negation
1414
* is treated in Prolog: The implicit search for `Not[C]` succeeds if and only if the implicit
@@ -27,7 +27,7 @@ final class Not[+T] private ()
2727
trait LowPriorityNot {
2828

2929
/** A fallback method used to emulate negation in Scala 2 */
30-
implicit def default[T]: Not[T] = Not.value
30+
given default[T] as Not[T] = Not.value
3131
}
3232
object Not extends LowPriorityNot {
3333

@@ -38,8 +38,8 @@ object Not extends LowPriorityNot {
3838
def value: Not[Nothing] = new Not[Nothing]()
3939

4040
/** One of two ambiguous methods used to emulate negation in Scala 2 */
41-
implicit def amb1[T](implicit ev: T): Not[T] = ???
41+
given amb1[T](using ev: T) as Not[T] = ???
4242

4343
/** One of two ambiguous methods used to emulate negation in Scala 2 */
44-
implicit def amb2[T](implicit ev: T): Not[T] = ???
44+
given amb2[T](using ev: T) as Not[T] = ???
4545
}

0 commit comments

Comments
 (0)