Skip to content

Update old implicits to given/using in the Dotty library #8237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions library/src/scala/Eql.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ object Eql {
def eqlAny[L, R]: Eql[L, R] = derived

// Instances of `Eql` for common Java types
implicit def eqlNumber : Eql[Number, Number] = derived
implicit def eqlString : Eql[String, String] = derived
given eqlNumber as Eql[Number, Number] = derived
given eqlString as Eql[String, String] = derived

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

// true asymmetry, modeling the (somewhat problematic) nature of equals on Proxies
implicit def eqlProxy : Eql[Proxy, AnyRef] = derived
given eqlProxy as Eql[Proxy, AnyRef] = derived
}
10 changes: 5 additions & 5 deletions library/src/scala/implicits/Not.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ package scala.implicits
* value of type `C` is available. If we do not want to prioritize `i1` and `i2` by
* putting them in different traits we can instead define the following:
*
* implicit def i1: D(implicit ev: C) = ...
* implicit def i2: D(implicit ev: Not[C]) = ...
* given i1: D(using ev: C) = ...
* given i2: D(using ev: Not[C]) = ...
*
* `Not` is treated specially in implicit search, similar to the way logical negation
* is treated in Prolog: The implicit search for `Not[C]` succeeds if and only if the implicit
Expand All @@ -27,7 +27,7 @@ final class Not[+T] private ()
trait LowPriorityNot {

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

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

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

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