You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2023/08/31 19:17:14 UTC
[groovy] branch master updated: GROOVY-10974: add test case
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 6dc5b63a09 GROOVY-10974: add test case
6dc5b63a09 is described below
commit 6dc5b63a0976037cf01fa2f3ffe637a467461576
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Thu Aug 31 14:16:13 2023 -0500
GROOVY-10974: add test case
---
src/test/groovy/transform/stc/MethodReferenceTest.groovy | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/test/groovy/transform/stc/MethodReferenceTest.groovy b/src/test/groovy/transform/stc/MethodReferenceTest.groovy
index ea9ad8ba7a..e726079c70 100644
--- a/src/test/groovy/transform/stc/MethodReferenceTest.groovy
+++ b/src/test/groovy/transform/stc/MethodReferenceTest.groovy
@@ -269,6 +269,21 @@ final class MethodReferenceTest {
'''
}
+ @Test // instance::instanceMethod -- GROOVY-10974
+ void testBiConsumerII() {
+ assertScript shell, '''import java.util.stream.*
+ @CompileStatic
+ def test(DoubleStream x, ObjDoubleConsumer<Boolean> y, BiConsumer<Boolean, Boolean> z) {
+ def b = x.collect(() -> true, y::accept, z::accept) // b should infer as Boolean
+ // <R> R collect(Supplier<R>,ObjDoubleConsumer<R>,BiConsumer<R,R>)
+ Spliterator.OfDouble s_of_d = Arrays.spliterator(new double[0])
+ StreamSupport.doubleStream(s_of_d, b)
+ }
+
+ test(DoubleStream.of(0d), (Boolean b, double d) -> {}, (Boolean e, Boolean f) -> {})
+ '''
+ }
+
@Test // class::instanceMethod
void testBinaryOperatorCI() {
assertScript shell, '''