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/14 11:12:00 UTC

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

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

Daniel Sun updated GROOVY-8583:
-------------------------------
    Description: 
{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


  was:
{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}


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