Christopher Smith created GROOVY-10809:
------------------------------------------

             Summary: Set coercion doesn't "pull through" method resolution
                 Key: GROOVY-10809
                 URL: https://issues.apache.org/jira/browse/GROOVY-10809
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 4.0.6
            Reporter: Christopher Smith


In the usual case, the brackets syntax for an inline collection is implemented 
as an {{ArrayList}} but can become {{LinkedHashSet}} if the expression type is 
determined to be {{Set}}. However, this doesn't work if {{.asImmutable()}} is 
applied, because the expression is definitively identified as {{List}} first.

{code:groovy}
Set<String> WORKS = ["a"]
Set<String> ALSO_WORKS = (["b"] as Set).asImmutable()
Set<String> FAILS = ["c"].asImmutable()
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to