Repository: groovy Updated Branches: refs/heads/GROOVY_2_4_X ac7672a19 -> 7a685f4e9
GROOVY-8445: Static analysis does not work properly when coercing Closure to FunctionInterface (cherry picked from commit 664ecf2) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7a685f4e Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7a685f4e Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7a685f4e Branch: refs/heads/GROOVY_2_4_X Commit: 7a685f4e96514f706733409b90d6017b18f757b9 Parents: ac7672a Author: sunlan <sun...@apache.org> Authored: Fri Feb 2 17:44:20 2018 +0800 Committer: sunlan <sun...@apache.org> Committed: Fri Feb 2 18:01:51 2018 +0800 ---------------------------------------------------------------------- .../transform/stc/MethodCallsSTCTest.groovy | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/7a685f4e/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy b/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy index da17371..f2a1578 100644 --- a/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy +++ b/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy @@ -1246,6 +1246,28 @@ class MethodCallsSTCTest extends StaticTypeCheckingTestCase { ''' } + // GROOVY-8445 + void testGroovy8445() { + if (IS_PRE_8) return + + assertScript ''' + import groovy.transform.CompileStatic + import java.util.stream.Collectors + import java.util.stream.Stream + + @CompileStatic + public class Test1 { + public static void main(String[] args) { + p(); + } + + public static void p() { + assert 13 == Stream.of(1, 2, 3).reduce(7, {Integer r, Integer e -> r + e}); + } + } + ''' + } + static class MyMethodCallTestClass { static int mul(int... args) { args.toList().inject(1) { x,y -> x*y } }