[jira] [Resolved] (GROOVY-8583) Fail to infer auto-return type from ternary operator

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (GROOVY-8583) Fail to infer auto-return type from ternary operator

JIRA jira@apache.org

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

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

Fixed by https://github.com/apache/groovy/commit/ef35cf4998ca8d1eda5f7a05e08641f5cd00a720

> Fail to infer auto-return type from ternary operator
> ----------------------------------------------------
>
>                 Key: GROOVY-8583
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8583
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>            Reporter: Daniel Sun
>            Assignee: John Wagenleitner
>            Priority: Minor
>             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.1
>
>
> {code:java}
> @groovy.transform.Field
> String x = "X"
> @groovy.transform.CompileStatic
> public List<String> getStrings() {
> x ? [x] : Collections.emptyList() // fail
>         // return x ? [x] : Collections.emptyList() // succeed with `return`
> }
> getStrings()
> {code}
> SEE GROOVY-7753



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