mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
Estimated hours taken: 6 Change the way mode analysis chooses which mode of a predicate to call. If there are multiple matching modes, choose the best one, rather than just the first one. "Best" is determined by comparing the argument insts and livenesses, and (if that fails) determinism of all the modes which do match. If two modes are equal, or incomparable, in this partial ordering, we choose the first one (according to the order in which they were declared). Still to do (will be committed seperately): delete the hacks in make_hlds.m etc. that assign mode numbers with a priority based on determinism. compiler/modecheck_call.m: For calls to predicates with multiple modes, find all the modes which match and select the best one, rather than just picking the first one that matches. compiler/det_report.m: Export compare_determinism/3, for use by modecheck_call.m. NEWS: LIMITATIONS: We've fixed one of the limitations: unique mode declarations no longer have to precede non-unique mode declarations. tests/hard_coded/Mmakefile: tests/hard_coded/mode_choice.m: tests/hard_coded/mode_choice.exp: Some tests cases for this change.
17 lines
354 B
Plaintext
17 lines
354 B
Plaintext
T0: test1(in, out, out)
|
|
T0b: test1(in, out, out)
|
|
T1: test1(in, in, out)
|
|
T2: test2(di, uo)
|
|
T3: test2(in, out)
|
|
T4: test2(in, out)
|
|
T5: test3(in(any), out)
|
|
T6: test3(out(any), out)
|
|
T7: test4(in, out, out)
|
|
T8:
|
|
T9: test4(in, out, out)
|
|
T10:
|
|
T11: test4(out, in, out)
|
|
T12: test5(in(a), in(ab), out)
|
|
T13: test5(in(a), in(ab), out)
|
|
T14: test5(in(ab), in(b), out)
|