From 20e28f02a35c988a630db70dd9fdd4e33dc20ab6 Mon Sep 17 00:00:00 2001 From: odersky Date: Tue, 12 Dec 2023 10:57:18 +0100 Subject: [PATCH] Update test --- tests/run/i19224.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/run/i19224.scala b/tests/run/i19224.scala index e85337b2c43f..dc02e5c19f71 100644 --- a/tests/run/i19224.scala +++ b/tests/run/i19224.scala @@ -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). + } +}