@@ -4,7 +4,7 @@ Author: Bob Nystrom
4
4
5
5
Status: Accepted
6
6
7
- Version 2.29 (see [ CHANGELOG] ( #CHANGELOG ) at end)
7
+ Version 2.30 (see [ CHANGELOG] ( #CHANGELOG ) at end)
8
8
9
9
Note: This proposal is broken into a couple of separate documents. See also
10
10
[ records] [ ] and [ exhaustiveness] [ ] .
@@ -621,6 +621,15 @@ It is a compile-time error if:
621
621
expressions in a future release without it being a breaking change, similar
622
622
to default values in parameter lists.*
623
623
624
+ * Any two keys in the map are identical. * Duplicate keys are likely to be a
625
+ copy/paste error. If you want to match the value associated with some key
626
+ against multiple patterns, you can always use an ` || ` pattern.* s
627
+
628
+ * Any two record keys which both have primitive equality are equal. * Since
629
+ records don't have defined identity, we can't use the previous rule to
630
+ detect identical records. But records do support an equality test known at
631
+ compile time if all of their fields do, so we use that.*
632
+
624
633
* Note that ` mapPatternEntries ` is not optional, which means it is an error for
625
634
a map pattern to be empty.*
626
635
@@ -3501,6 +3510,10 @@ Here is one way it could be broken down into separate pieces:
3501
3510
3502
3511
## Changelog
3503
3512
3513
+ ### 2.30
3514
+
3515
+ - Re-add error for map patterns to have duplicate keys.
3516
+
3504
3517
### 2.29
3505
3518
3506
3519
- Map patterns no longer check length.
0 commit comments