[jira] [Commented] (GROOVY-8602) Safe index doesn't work with map arguments

2018-09-07 Thread Daniil Ovchinnikov (JIRA)


[ 
https://issues.apache.org/jira/browse/GROOVY-8602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16607400#comment-16607400
 ] 

Daniil Ovchinnikov commented on GROOVY-8602:


Sounds fair to me.

> Safe index doesn't work with map arguments
> --
>
> Key: GROOVY-8602
> URL: https://issues.apache.org/jira/browse/GROOVY-8602
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.0-alpha-2
>Reporter: Daniil Ovchinnikov
>Priority: Minor
>
> {{a[b:2]}} works.
> {{a?[b:2]}} produces {{Unexpected input: ''; Expecting ':' @ ...}}



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


[jira] [Commented] (GROOVY-8602) Safe index doesn't work with map arguments

2018-09-02 Thread Paul King (JIRA)


[ 
https://issues.apache.org/jira/browse/GROOVY-8602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16601736#comment-16601736
 ] 

Paul King commented on GROOVY-8602:
---

Reducing priority. The only place map indexing is allowed is immediately after 
a class constant, e.g.:
{code}
assert Date[year: 118, month: 8, date: 3].day == 1
{code}
I don't see a lot of value in supporting this:
{code}
assert Date?[year: 118, month: 8, date: 3].day == 1
{code}
If we supported using a class variable, I could see the value, e.g.:
{code}
def d = Date
assert d[year: 118, month: 8, date: 3].day == 1 // No map entry allowed at this 
place
{code}
But we don't support this. You could perhaps argue for a slightly better error 
message in this case.

> Safe index doesn't work with map arguments
> --
>
> Key: GROOVY-8602
> URL: https://issues.apache.org/jira/browse/GROOVY-8602
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.0-alpha-2
>Reporter: Daniil Ovchinnikov
>Priority: Minor
>
> {{a[b:2]}} works.
> {{a?[b:2]}} produces {{Unexpected input: ''; Expecting ':' @ ...}}



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