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

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

John Wagenleitner created GROOVY-8590:
-----------------------------------------

             Summary: 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


{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)