mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
Estimated hours taken: 1.5
Branches: main, release
Change the implementation of map.merge/3 so that it throws an exception if the
sets of keys of the input maps are not disjoint. This is more in keeping with
the documentation for that predicate which says they should be disjoint.
The existing implementation handled duplicate keys by inserting the key and
the smallest of the corresponding values into the output map. Some of the
code in the compiler seems to rely on this behaviour - this is (probably) a
bug but in at least in one instance, to do with merging RTTI varmaps
during higher-order specialisation, it's going to be a bit tricky to fix.
Rather than modify the compiler at the moment the old version of map.merge/3
is available as map.old_merge/3 and the compiler still uses this. (This
predicate is not included in the library reference manual.)
library/map.m:
Make map.merge/3 throw an exception if the sets of keys of the
input maps are not disjoint.
Add the implementor-only predicate map.old_merge/3 for use by the
compiler.
compiler/hlds_rtti.m:
compiler/interval.m:
compiler/prog_io.m:
compiler/tupling.m:
Conform to the above changes.
tests/hard_coded/map_merge_test.{m,exp}:
Test for the new behaviour.
tests/hard_coded/Makefile:
Don't run the above test in deep profiling grades since it
catches exceptions which the deep profiler cannot currently handle.
1 line
7 B
Plaintext
1 line
7 B
Plaintext
SUCCESS |