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

Daniel Sun commented on GROOVY-6668:
------------------------------------


The following test passes.
{code:java}
        @groovy.transform.CompileStatic
        class OtherThing {
            OtherThing() {
                Map<String, String> m = [foo: "bar"] as HashMap<String, String>
                String k = "${'foo'}"   // GString value is assign to String 
variable, succeed
                assert "BAR" == m[k].toUpperCase()
            }
        }
        
        new OtherThing()
{code}


> Static compiler doesn't coerce GString for getAt() call
> -------------------------------------------------------
>
>                 Key: GROOVY-6668
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6668
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.3.0-beta-1, 2.4.0-rc-1
>            Reporter: Luke Daley
>            Priority: Major
>
> This might not be a bug, but it's a behaviour change from 2.2.
> {code}
> @groovy.transform.CompileStatic
> class OtherThing {
>     OtherThing() {
>         Map<String, String> m = [:]
>         def k = "foo"
>         m["$k"].toUpperCase() // fails, no method toUpperCase() on object
>         m[k].toUpperCase() // works
>     }
> }
> {code}



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

Reply via email to