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

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

Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/227


> @CompileStatic and the method with(Closure) seem to determine wrong type
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-7702
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7702
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.4, 2.4.5
>            Reporter: Teerapong Suksuwan
>            Priority: Minor
>
> In the code below. When refer to time without the "it" prefix. The compiler 
> get type of "time" wrongly. "time" is Date but it determined as long.
> {code}
> @CompileStatic
> class GMain {
>     static void main(String[] args) {
>         Calendar.instance.with {
>             println time.class//This print java.util.Date which is OK
>             Date d1 = time//This line failed to compile with error Groovyc: 
> [Static type checking] - Cannot assign value of type long to variable of type 
> java.util.Date
>             Date d2 = it.time//This line is OK
>         }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to