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/06/03 02:50:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16499273#comment-16499273 ]
ASF GitHub Bot commented on GROOVY-8583:
----------------------------------------
GitHub user jwagenleitner opened a pull request:
https://github.com/apache/groovy/pull/747
GROOVY-8583: Fail to infer auto-return type from ternary operator
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jwagenleitner/groovy 8583-stc-ternary
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/747.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 #747
----
commit 884ddeb4d9aca6c4a68f22f7fbd7ce2ab77f51f1
Author: John Wagenleitner <jw...@...>
Date: 2018-06-03T02:17:08Z
GROOVY-8583: Fail to infer auto-return type from ternary operator
----
> 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: Minor
>
> {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)