New language features: check that var can be used in parameters of lambda expressions.
Change on 2019/03/11 by antoniocortes
@@ -1623,4 +1623,20 @@ public class StatementGeneratorTest extends GenerationTest {
assertTranslation(translation, "JavaUtilArrayList *list = create_JavaUtilArrayList_init();");
assertTranslation(translation, "id<JavaUtilStreamStream> stream = [list stream];");
}
+
+ public void testVarLambdaExpressionParameter() throws IOException {
+ if (!onJava11OrAbove()) {
+ return;
+ }
+ String translation = translateSourceFile(String.join("\n",
+ "import java.util.function.Function;",
+ "class Test {",
+ " int test(String input) {",
+ " Function<String, Integer> f = (var s) -> s.length();",
+ " return f.apply(input);",
+ " }",
+ "}"), "Test", "Test.m");
+ assertTranslation(translation,
+ "@interface Test_$Lambda$1 : NSObject < JavaUtilFunctionFunction >");
+ }
}
