Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
4.0.6
-
None
-
None
Description
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.
Set<String> WORKS = ["a"] Set<String> ALSO_WORKS = (["b"] as Set).asImmutable() Set<String> FAILS = ["c"].asImmutable()