-
Notifications
You must be signed in to change notification settings - Fork 363
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
strange behavior List#corresponds #695
Comments
Definitely a bug, thanks for reporting @xuwei-k ! |
more simple example object Main {
def main(args: Array[String]): Unit = {
val a = List(1, 2, 3)
// false in scala-native, true in JVM
println(a.corresponds(a)(_ == _))
}
} |
object Main {
def main(args: Array[String]): Unit = {
val a = List(1, 2, 3)
val result = a.corresponds(a){ (x, y) =>
println((x, y))
true
}
println(result)
}
}
😱 |
@xuwei-k Thanks for the minimized example! |
I was able to find the root cause for this one: front-end incorrectly resolves symbols to SSA names for methods that were transformed by tailrec phase. Instead of using the internal loop's version of |
See https://github.com/scala-js/scala-js/blob/f21e7f5ea652fe4a186f1ecd8c0070fbb80edc80/compiler/src/main/scala/org/scalajs/core/compiler/GenJSCode.scala#L1966-L1981, and more generally references to |
Previously, front-end would incorrectly resolve symbols to SSA names for methods that were transformed by tailrec phase. Instead of using the internal loop's version of this variable, it always uses the original this, never advancing to the tail.
Previously, front-end would incorrectly resolve symbols to SSA names for methods that were transformed by tailrec phase. Instead of using the internal loop's version of this variable, it always uses the original this, never advancing to the tail.
…rec (scala-native#826) Previously, front-end would incorrectly resolve symbols to SSA names for methods that were transformed by tailrec phase. Instead of using the internal loop's version of this variable, it always uses the original this, never advancing to the tail.
version 0.2
The text was updated successfully, but these errors were encountered: