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 2022/02/16 19:27:00 UTC
[jira] [Created] (GROOVY-10498) NamedVariant: default value overrides supplied value if it's falsy (positional parameter)
Eric Milles created GROOVY-10498:
------------------------------------
Summary: NamedVariant: default value overrides supplied value if it's falsy (positional parameter)
Key: GROOVY-10498
URL: https://issues.apache.org/jira/browse/GROOVY-10498
Project: Groovy
Issue Type: Bug
Reporter: Eric Milles
Consider the following:
{code:groovy}
import groovy.transform.*
@ToString(includeNames=true)
class Color {
int r, g, b
}
@NamedVariant
String m(@NamedDelegate Color color, Number alpha=4.5) {
return [color, alpha].join(' ')
}
print m(r:1, g:2, b:3, 0.0) // "Color(r:1, g:2, b:3) 4.5"!
{code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)