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

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16481845#comment-16481845 ] 

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

GitHub user jwagenleitner opened a pull request:

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

    GROOVY-8590: STC incorrectly infers type of nested method call used i…

    …n a return stmt

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy 8590-STC-nested-mc-return

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/713.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #713
    
----
commit 69315c3252a77fa325a14c901b5e8edf01bfe2db
Author: John Wagenleitner <jw...@...>
Date:   2018-05-20T05:32:20Z

    GROOVY-8590: STC incorrectly infers type of nested method call used in a return stmt

----


> 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
>            Priority: Major
>
> {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)