From d299b608799b3b722e97ba0b3f41edb122dc4786 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 30 Mar 2016 14:27:25 +0100 Subject: Remove duplicates when finding captured variables --- src/test/java/org/zwobble/couscous/tests/CompilerTests.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/test/java') diff --git a/src/test/java/org/zwobble/couscous/tests/CompilerTests.java b/src/test/java/org/zwobble/couscous/tests/CompilerTests.java index 7df7582..0099d26 100644 --- a/src/test/java/org/zwobble/couscous/tests/CompilerTests.java +++ b/src/test/java/org/zwobble/couscous/tests/CompilerTests.java @@ -180,6 +180,18 @@ public abstract class CompilerTests { Types.INT)); } + @Test + public void lambdasWithSameVariableCapturedMultipleTimes() throws Exception { + assertEquals( + value(84), + execTestProgram( + "lambda-multiple-capture", + ScalarType.of("com.example.Lambda"), + "value", + list(value(2)), + Types.INT)); + } + @Test public void lambdasWithThisCapture() throws Exception { assertEquals( -- cgit v1.2.3