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 faade41147 GROOVY-11618: add test case
faade41147 is described below

commit faade41147784701e848711a03a3872777163988
Author: Eric Milles <[email protected]>
AuthorDate: Sun Apr 13 13:06:36 2025 -0500

    GROOVY-11618: add test case
---
 .../transform/stc/MethodReferenceTest.groovy       | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/test/groovy/transform/stc/MethodReferenceTest.groovy 
b/src/test/groovy/transform/stc/MethodReferenceTest.groovy
index 921edf719a..74288f1eb4 100644
--- a/src/test/groovy/transform/stc/MethodReferenceTest.groovy
+++ b/src/test/groovy/transform/stc/MethodReferenceTest.groovy
@@ -18,7 +18,7 @@
  */
 package groovy.transform.stc
 
-import org.junit.Test
+import org.junit.jupiter.api.Test
 
 import static groovy.test.GroovyAssert.assertScript
 import static groovy.test.GroovyAssert.shouldFail
@@ -1016,7 +1016,10 @@ final class MethodReferenceTest {
     @Test // class::new
     void testFunctionCN6() {
         assertScript shell, '''
-            class Foo { Foo(String s) { } }
+            class Foo {
+                Foo(String s) {
+                }
+            }
 
             @CompileStatic
             void test() {
@@ -1606,6 +1609,25 @@ final class MethodReferenceTest {
         '''
     }
 
+    // GROOVY-11618
+    @Test
+    void testRecordComponentMethodReference2() {
+        assertScript shell, '''
+            class C {
+                record R(String x) {
+                }
+                @CompileStatic m() {
+                    def list = [new R('x')]
+                    def stream = list.stream().map(R::x)
+                    def string = stream.collect(Collectors.joining())
+
+                    assert string == 'x'
+                }
+            }
+            new C().m()
+        '''
+    }
+
     // GROOVY-11301
     @Test
     void testInnerClassPrivateMethodReference() {

Reply via email to