Eric Milles created GROOVY-9910:
-----------------------------------

             Summary: STC: no error for incorrect parameter type if not 
referenced in lambda
                 Key: GROOVY-9910
                 URL: https://issues.apache.org/jira/browse/GROOVY-9910
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles


Follow up to GROOVY-9790.  If a lambda expression does not reference one of its 
parameters, no inferred type metadata is written to the parameter and the 
boostrap error can still occur.

Consider the following:
{code:groovy}
            @groovy.transform.CompileStatic
            void test1() {
                java.util.stream.IntStream.range(0, 2).forEach(
                    (Integer i) -> {  } // no reference to "i"
                )
            }
            @groovy.transform.CompileStatic
            void test2() {
                java.util.stream.IntStream.range(0, 2).forEach(
                    (String s) -> { assert false } // no reference to "s"
                )
            }
{code}

9790 fixes depend of the inferred type of a variable expression being written 
back to accessed variable (the parameter).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to