From 65551d19b5d928f231426c016e561051d68d9c97 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 13 Sep 2016 12:24:42 +0200 Subject: Don't drop inline closure bindings that are referred in the body The body might still refer to an inline closure argument without fully applying it. In that case the binding may not be dropped. --- tests/run/inlinedAssign.scala | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/run') diff --git a/tests/run/inlinedAssign.scala b/tests/run/inlinedAssign.scala index f405f5073..5b73a6f0c 100644 --- a/tests/run/inlinedAssign.scala +++ b/tests/run/inlinedAssign.scala @@ -6,6 +6,8 @@ object Test { y_=(t) } + inline def f(x: Int => Unit) = x + def main(args: Array[String]) = { var x = 1 var y = 2 @@ -13,5 +15,7 @@ object Test { inline def setY(z: Int) = y = z swap(x, setX, y, setY) assert(x == 2 && y == 1) + + val z = f(setX) // tests case where inline arg is not applied } } -- cgit v1.2.3