You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/23 01:26:00 UTC

[jira] [Resolved] (GROOVY-8590) STC incorrectly infers type of nested method call used in a return stmt

     [ https://issues.apache.org/jira/browse/GROOVY-8590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Sun resolved GROOVY-8590.
--------------------------------
       Resolution: Fixed
         Assignee: John Wagenleitner
    Fix Version/s: 2.5.0
                   3.0.0-alpha-3
                   2.6.0-alpha-4

Fixed by https://github.com/apache/groovy/commit/17067350c4e25a8a97cfcbb86682d904aa7e234e

> STC incorrectly infers type of nested method call used in a return stmt
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-8590
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8590
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.5.0-rc-3
>            Reporter: John Wagenleitner
>            Assignee: John Wagenleitner
>            Priority: Major
>             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0
>
>
> {code:groovy}
> class Source {
>     Object getValue() { '32' }
> }
> @groovy.transform.CompileStatic
> int m(Source src) {
>     return Integer.parseInt((String) src.getValue())
> }
> null
> {code}
> Fails with
> {code}
> [Static type checking] - Inconvertible types: cannot cast int to java.lang.String
> {code}
> Git bisect shows it is related to change for GROOVY-7753 ([commit 9d7c1bf1b07d43c1efd16c9252b|https://github.com/apache/groovy/commit/9d7c1bf1b07d43c1efd16c9252b209d29d739ced#diff-8f6109b9267c3330807df2c0ce2fab92R3237]).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)