Bugfix
According to the description, the union() function converts the arguments into sets so that duplicates are removed. However, this conversion does not take place if only one argument is passed to the function:
{ list1 = list(1, 2, 3, 1); list2 = list(1, 2, 3); union($list1, $list2); // output [1, 2, 3] union($list1, $list1); // output [1, 2, 3] union($list1); // output [1, 2, 3, 1] }
Test
- union(list(1, 2, 2, 4, 3)) == list(1, 2, 3, 4).toSet() evaluates to true