Skip to content

Commit 20e28f0

Browse files
committed
Update test
1 parent 01a12df commit 20e28f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/run/i19224.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
// scalajs: --skip
12

2-
object Test extends App:
3+
object Test extends App {
34
val field = 1
45
def x(): Int => String = (i: Int) => i.toString
56
def y(): () => String = () => field.toString
6-
locally:
7+
8+
locally {
79
assert(x() == x()) // true on Scala 2, was false on Scala 3...
810
assert(y() == y()) // also true if `y` accesses object-local fields
911

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

0 commit comments

Comments
 (0)