Skip to content

Commit

Permalink
Use BoxesRunTime.equalsNumChar instead of `BoxesRunTime.equalsNumOb…
Browse files Browse the repository at this point in the history
…ject` for boxed Char universal equality checks
  • Loading branch information
WojciechMazur committed Oct 27, 2023
1 parent e6242ca commit 733b8bb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
val equalsMethod: Symbol = {
if (l.tpe <:< defn.BoxedNumberClass.info) {
if (r.tpe <:< defn.BoxedNumberClass.info) defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumNum)
else if (r.tpe <:< defn.BoxedCharClass.info) NoSymbol // ctx.requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
else if (r.tpe <:< defn.BoxedCharClass.info) defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumChar)
else defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject)
} else defn.BoxesRunTimeModule_externalEquals
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ class JSCodeGen()(using genCtx: Context) {
private lazy val externalEqualsNumNum: Symbol =
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumNum)
private lazy val externalEqualsNumChar: Symbol =
NoSymbol // requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumChar)
private lazy val externalEqualsNumObject: Symbol =
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject)
private lazy val externalEquals: Symbol =
Expand Down Expand Up @@ -2885,7 +2885,7 @@ class JSCodeGen()(using genCtx: Context) {
val ptfm = ctx.platform
if (lsym.derivesFrom(defn.BoxedNumberClass)) {
if (rsym.derivesFrom(defn.BoxedNumberClass)) externalEqualsNumNum
else if (rsym.derivesFrom(defn.BoxedCharClass)) externalEqualsNumObject // will be externalEqualsNumChar in 2.12, SI-9030
else if (rsym.derivesFrom(defn.BoxedCharClass)) externalEqualsNumChar
else externalEqualsNumObject
} else externalEquals
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
val equalsMethod: Symbol = {
if (l.tpe <:< defn.BoxedNumberClass.info) {
if (r.tpe <:< defn.BoxedNumberClass.info) defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumNum)
else if (r.tpe <:< defn.BoxedCharClass.info) NoSymbol // ctx.requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
else if (r.tpe <:< defn.BoxedCharClass.info) defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumChar)
else defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject)
} else defn.BoxesRunTimeModule_externalEquals
}
Expand Down
4 changes: 2 additions & 2 deletions tests/pos-with-compiler-cc/backend/sjs/JSCodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2846,7 +2846,7 @@ class JSCodeGen()(using genCtx: DetachedContext) {
private lazy val externalEqualsNumNum: Symbol =
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumNum)
private lazy val externalEqualsNumChar: Symbol =
NoSymbol // requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumChar)
private lazy val externalEqualsNumObject: Symbol =
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject)
private lazy val externalEquals: Symbol =
Expand Down Expand Up @@ -2886,7 +2886,7 @@ class JSCodeGen()(using genCtx: DetachedContext) {
val ptfm = ctx.platform
if (lsym.derivesFrom(defn.BoxedNumberClass)) {
if (rsym.derivesFrom(defn.BoxedNumberClass)) externalEqualsNumNum
else if (rsym.derivesFrom(defn.BoxedCharClass)) externalEqualsNumObject // will be externalEqualsNumChar in 2.12, SI-9030
else if (rsym.derivesFrom(defn.BoxedCharClass)) externalEqualsNumChar
else externalEqualsNumObject
} else externalEquals
}
Expand Down

0 comments on commit 733b8bb

Please sign in to comment.