Repository: groovy Updated Branches: refs/heads/native-lambda f70975bb7 -> b711a68d9
Add more tests Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/b711a68d Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b711a68d Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b711a68d Branch: refs/heads/native-lambda Commit: b711a68d90d7b7e1f08f71455d18a227da09c6f2 Parents: f70975b Author: sunlan <[email protected]> Authored: Tue Jan 16 13:42:00 2018 +0800 Committer: sunlan <[email protected]> Committed: Tue Jan 16 13:42:00 2018 +0800 ---------------------------------------------------------------------- src/test/groovy/transform/stc/LambdaTest.groovy | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/b711a68d/src/test/groovy/transform/stc/LambdaTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/transform/stc/LambdaTest.groovy b/src/test/groovy/transform/stc/LambdaTest.groovy index 28708fc..ad5c9f2 100644 --- a/src/test/groovy/transform/stc/LambdaTest.groovy +++ b/src/test/groovy/transform/stc/LambdaTest.groovy @@ -261,4 +261,25 @@ TestScript0.groovy: 14: [Static type checking] - Cannot find matching method jav } ''' } + + void testFunctionWithLocalVariables4() { + assertScript ''' + import groovy.transform.CompileStatic + import java.util.stream.Collectors + import java.util.stream.Stream + + @CompileStatic + public class Test4 { + public static void main(String[] args) { + new Test4().p(); + } + + public void p() { + String x = "x"; + StringBuilder y = new StringBuilder("y"); + assert ['yx1', 'yx2', 'yx3'] == Stream.of(1, 2, 3).map(e -> y + x + e).collect(Collectors.toList()); + } + } + ''' + } }
