Skip to content
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

Use dedicated equals method for univerval equality of chars #18770

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
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
Loading