You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2019/10/30 19:08:00 UTC
[jira] [Comment Edited] (GROOVY-8223) Multiple Return Values
@CompileStatic Tuple#<> working
[ https://issues.apache.org/jira/browse/GROOVY-8223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16963327#comment-16963327 ]
Eric Milles edited comment on GROOVY-8223 at 10/30/19 7:07 PM:
---------------------------------------------------------------
Tested with this code:
{code:groovy}
@groovy.transform.CompileStatic
static Tuple2<String,Integer> make() {
new Tuple2<>("answer",42)
}
def (String mystr, Integer myint) = make()
println mystr
println myint
{code}
Prints "answer\n42\n".
was (Author: emilles):
Tested with this code:
{code:groovy}
@groovy.transform.CompileStatic
static Tuple2<String,Integer> dostuff() {
new Tuple2<>("answer",42)
}
def (String mystr, Integer myint) = dostuff()
println mystr
println myint
{code}
Prints "answer\n42\n".
> Multiple Return Values @CompileStatic Tuple#<> working
> ------------------------------------------------------
>
> Key: GROOVY-8223
> URL: https://issues.apache.org/jira/browse/GROOVY-8223
> Project: Groovy
> Issue Type: New Feature
> Components: Compiler
> Reporter: Constance Eustace
> Priority: Major
> Fix For: 2.4.x, 2.5.x
>
>
> @COmpileStatic seems to bomb with 2.4 if I have:
> 1) a static util function such as:
> class blah {
> static Tuple2<String,Integer> dostuff() { new Tuple2<>("string",55) }
> }
> 2) invoke via:
> def (String mystr, Integer myint) = dostuff()
> With @CompileStatic, that all bombs.
> Alternatively, tried using getAt overrides, also did not work, but that would lack typing infor necessary for @CompileStatic. But the Tuple2 should have the necessary type info...
> I would think this could be done... I might try to do it, but I'd like to file the issue
--
This message was sent by Atlassian Jira
(v8.3.4#803005)