Skip to content

Commit

Permalink
[JS IR] De-optimize equality operator as workaround for KT-57509
Browse files Browse the repository at this point in the history
(cherry picked from commit 32d1fba)
  • Loading branch information
anton-bannykh committed Aug 14, 2023
1 parent 79d3dda commit 5801279
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ class EqualityAndComparisonCallsTransformer(context: JsIrBackendContext) : Calls
val equalsMethod = lhs.type.findEqualsMethod()

return when {
lhs.type is IrDynamicType ->
irCall(call, intrinsics.jsEqeq)
// Temporarily de-optimize dynamic equality due to KT-57509
// lhs.type is IrDynamicType ->
// irCall(call, intrinsics.jsEqeq)

// Special optimization for "<expression> == null"
lhs.isNullConst() || rhs.isNullConst() ->
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions js/js.translator/testData/box/dynamic/lambdaParameterInlining.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// WITH_STDLIB

fun demo(x: dynamic, a: Array<out dynamic>): Boolean? {
return a.any { y: Any ->
val newX: Any = x.unsafeCast<Any>()
y == newX
}
}

data class X(val x: Int)

fun box(): String {

if (demo(X(1), arrayOf(X(1))) != true) return "fail"

return "OK"
}

0 comments on commit 5801279

Please sign in to comment.