Repository: groovy Updated Branches: refs/heads/native-lambda 0165fb276 -> f70975bb7
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/f70975bb Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/f70975bb Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/f70975bb Branch: refs/heads/native-lambda Commit: f70975bb74cd234c1d469ea4510c0da9129e924e Parents: 0165fb2 Author: sunlan <[email protected]> Authored: Tue Jan 16 12:37:33 2018 +0800 Committer: sunlan <[email protected]> Committed: Tue Jan 16 12:37:33 2018 +0800 ---------------------------------------------------------------------- src/test/groovy/transform/stc/LambdaTest.groovy | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/f70975bb/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 f12eeda..28708fc 100644 --- a/src/test/groovy/transform/stc/LambdaTest.groovy +++ b/src/test/groovy/transform/stc/LambdaTest.groovy @@ -236,4 +236,29 @@ TestScript0.groovy: 14: [Static type checking] - Cannot find matching method jav } ''' } + + void testFunctionWithLocalVariables3() { + 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) { + p(); + } + + public static void p() { + String x = "x"; + StringBuilder y = new StringBuilder("y"); + assert ['Hello yx1', 'Hello yx2', 'Hello yx3'] == Stream.of(1, 2, 3).map(e -> hello() + y + x + e).collect(Collectors.toList()); + } + + public static String hello() { + return "Hello "; + } + } + ''' + } }
