Bug 21132 – Ff two keys in an associative array literal are equal

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-08-07T01:48:37Z
Last change time
2023-01-30T12:36:15Z
Keywords
pull
Assigned to
No Owner
Creator
Victor Porton

Comments

Comment #0 by porton — 2020-08-07T01:48:37Z
https://dlang.org/spec/expression.html#associative_array_literals forgets to say what happens if two keys in an associative array literal are equal. An experiments with D shows that the last value "wins".
Comment #1 by dlang-bot — 2023-01-30T11:08:05Z
@dumitrache-adrian92 created dlang/dlang.org pull request #3505 "Fix Issue 21132 - Duplicate keys in an AA literal" fixing this issue: - Fix Issue 21132 - Duplicate keys in an AA literal I specified the behavior of an associative array literal if pairs with the same key are declared and offered an example. https://github.com/dlang/dlang.org/pull/3505
Comment #2 by dlang-bot — 2023-01-30T12:36:15Z
dlang/dlang.org pull request #3505 "Fix Issue 21132 - Duplicate keys in an AA literal" was merged into master: - ca20a21178c3fd9b4be622f8b7848803dfe461d2 by Dumitrache Adrian-George: Fix Issue 21132 - Duplicate keys in an AA literal I specified the behavior of an associative array literal if pairs with the same key are declared and offered an example. https://github.com/dlang/dlang.org/pull/3505