Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Rename methods in CanEqual
  • Loading branch information
odersky committed Nov 23, 2020
commit 5ec970fd2c2ef05c313cf699ed4d122135cff9f9
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,9 @@ class Definitions {
@tu lazy val TastyReflectionClass: ClassSymbol = requiredClass("scala.tasty.Reflection")

@tu lazy val EqlClass: ClassSymbol = getClassIfDefined("scala.Eql").orElse(requiredClass("scala.CanEqual")).asClass
def Eql_eqlAny(using Context): TermSymbol = EqlClass.companionModule.requiredMethod(nme.eqlAny)
def Eql_eqlAny(using Context): TermSymbol =
val methodName = if EqlClass.name == tpnme.Eql then nme.eqlAny else nme.canEqualAny
EqlClass.companionModule.requiredMethod(methodName)

@tu lazy val TypeBoxClass: ClassSymbol = requiredClass("scala.runtime.TypeBox")
@tu lazy val TypeBox_CAP: TypeSymbol = TypeBoxClass.requiredType(tpnme.CAP)
Expand Down
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/core/StdNames.scala
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ object StdNames {
val CAP: N = "CAP"
val Constant: N = "Constant"
val ConstantType: N = "ConstantType"
val Eql: N = "Eql"
val EnumValue: N = "EnumValue"
val ExistentialTypeTree: N = "ExistentialTypeTree"
val Flag : N = "Flag"
Expand Down Expand Up @@ -433,6 +434,7 @@ object StdNames {
val bundle: N = "bundle"
val bytes: N = "bytes"
val canEqual_ : N = "canEqual"
val canEqualAny : N = "canEqualAny"
val cbnArg: N = "<cbn-arg>"
val checkInitialized: N = "checkInitialized"
val ClassManifestFactory: N = "ClassManifestFactory"
Expand Down
10 changes: 5 additions & 5 deletions library/src-bootstrapped/scala/Eql.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ object CanEqual {
* synthesize implicit arguments as solutions to `CanEqual[T, U]` queries if
* the rules of multiversal equality require it.
*/
def eqlAny[L, R]: CanEqual[L, R] = derived
def canEqualAny[L, R]: CanEqual[L, R] = derived

// Instances of `CanEqual` for common Java types
given eqlNumber as CanEqual[Number, Number] = derived
given eqlString as CanEqual[String, String] = derived
given canEqualNumber as CanEqual[Number, Number] = derived
given canEqualString as CanEqual[String, String] = derived

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