Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Dec 12, 2023
1 parent 01a12df commit 20e28f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/run/i19224.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// scalajs: --skip

object Test extends App:
object Test extends App {
val field = 1
def x(): Int => String = (i: Int) => i.toString
def y(): () => String = () => field.toString
locally:

locally {
assert(x() == x()) // true on Scala 2, was false on Scala 3...
assert(y() == y()) // also true if `y` accesses object-local fields

def z(): Int => String = (i: Int) => i.toString
assert(z() != z()) // lambdas in constructor are not lifted to static, so no memoization (Scala 2 lifts them, though).
}
}

0 comments on commit 20e28f0

Please sign in to comment.