[ 
https://issues.apache.org/jira/browse/GROOVY-10682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609724#comment-17609724
 ] 

ASF GitHub Bot commented on GROOVY-10682:
-----------------------------------------

paulk-asert commented on code in PR #1785:
URL: https://github.com/apache/groovy/pull/1785#discussion_r980582585


##########
src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy:
##########
@@ -37,6 +37,20 @@ class DefaultGroovyMethodsSTCTest extends 
StaticTypeCheckingTestCase {
                 println it // DGM#println(Object,Object)
             }
         '''
+
+        assertScript '''
+            int[] nums = [0, 1]
+            nums.each { it -> // ArrayGroovyMethods#each(int[], Closure)
+                println it.toDouble() // DGM#println(Object,Object)

Review Comment:
   Though we have many legacy tests which use println, we tend to avoid adding 
additional such tests when we can since they slow down the build and don't 
actually get automatically tested (even though the main objective here is for 
compilation to pass).





> Provide eachWithIndex for primitive arrays
> ------------------------------------------
>
>                 Key: GROOVY-10682
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10682
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test(int[] ints) {
>   ints.eachWithIndex { value, index ->
>     println "$index: ${value.doubleValue()}"
>   }
> }
> test(0,1,2,3,4,5)
> {code}
> Compiler reports "[Static type checking] - Cannot find matching method 
> java.lang.Object#doubleValue()"
> {{eachWithIndex}} is only provided for reference types, so "value" is seen as 
> Object by the type checker.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to