diff --git a/Content.Tests/DMProject/Tests/List/ListOr.dm b/Content.Tests/DMProject/Tests/List/ListOr.dm new file mode 100644 index 0000000000..4983c4be3c --- /dev/null +++ b/Content.Tests/DMProject/Tests/List/ListOr.dm @@ -0,0 +1,6 @@ +/proc/RunTest() + var/list/L1 = list("a" = 1, "b" = 2) + var/list/L2 = list("c" = 3, "d" = 4) + var/list/result = L1 | L2 + + ASSERT(result ~= list("a" = 1, "b" = 2, "c" = 3, "d" = 4)) \ No newline at end of file diff --git a/OpenDreamRuntime/Objects/Types/DreamList.cs b/OpenDreamRuntime/Objects/Types/DreamList.cs index 8611f126a2..0c9a653b1f 100644 --- a/OpenDreamRuntime/Objects/Types/DreamList.cs +++ b/OpenDreamRuntime/Objects/Types/DreamList.cs @@ -323,7 +323,7 @@ public virtual int GetLength() { } public DreamList Union(DreamList other) { - DreamList newList = new DreamList(ObjectDefinition, _values.Union(other.GetValues()).ToList(), null); + DreamList newList = new DreamList(ObjectDefinition, _values.Union(other.EnumerateValues()).ToList(), IsAssociative ? new(_associativeValues!) : null); foreach ((DreamValue key, DreamValue value) in other.GetAssociativeValues()) { newList.SetValue(key, value); }