Skip to content

Commit 5ec970f

Browse files
committed
Rename methods in CanEqual
1 parent b80de16 commit 5ec970f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,9 @@ class Definitions {
841841
@tu lazy val TastyReflectionClass: ClassSymbol = requiredClass("scala.tasty.Reflection")
842842

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

846848
@tu lazy val TypeBoxClass: ClassSymbol = requiredClass("scala.runtime.TypeBox")
847849
@tu lazy val TypeBox_CAP: TypeSymbol = TypeBoxClass.requiredType(tpnme.CAP)

compiler/src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ object StdNames {
362362
val CAP: N = "CAP"
363363
val Constant: N = "Constant"
364364
val ConstantType: N = "ConstantType"
365+
val Eql: N = "Eql"
365366
val EnumValue: N = "EnumValue"
366367
val ExistentialTypeTree: N = "ExistentialTypeTree"
367368
val Flag : N = "Flag"
@@ -433,6 +434,7 @@ object StdNames {
433434
val bundle: N = "bundle"
434435
val bytes: N = "bytes"
435436
val canEqual_ : N = "canEqual"
437+
val canEqualAny : N = "canEqualAny"
436438
val cbnArg: N = "<cbn-arg>"
437439
val checkInitialized: N = "checkInitialized"
438440
val ClassManifestFactory: N = "ClassManifestFactory"

library/src-bootstrapped/scala/Eql.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ object CanEqual {
2020
* synthesize implicit arguments as solutions to `CanEqual[T, U]` queries if
2121
* the rules of multiversal equality require it.
2222
*/
23-
def eqlAny[L, R]: CanEqual[L, R] = derived
23+
def canEqualAny[L, R]: CanEqual[L, R] = derived
2424

2525
// Instances of `CanEqual` for common Java types
26-
given eqlNumber as CanEqual[Number, Number] = derived
27-
given eqlString as CanEqual[String, String] = derived
26+
given canEqualNumber as CanEqual[Number, Number] = derived
27+
given canEqualString as CanEqual[String, String] = derived
2828

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

0 commit comments

Comments
 (0)