mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 01:43:35 +00:00
compiler/hlds_goal.m:
Add a new goal feature that marks a goal as having been lifted out of
a disjunction or switch by cse_detection.m.
compiler/cse_detection.m:
Add this feature to the deconstruction unifications lifted out by cse.
compiler/det_report.m:
When expecting the subgoal of a require_complete_switch or
require_switch_arms_detism scope to be a switch, allow the subgoal
to be a conjunction of lifted-out goals followed by the switch.
Improve the wording of an unrelated error message.
compiler/saved_vars.m:
Conform to the change to hlds_goal.m.
tests/valid/bug429.m:
A commented version of the Mantis bug 429 test case.
tests/valid/Mmakefile:
Enable the new test case.
34 lines
775 B
Mathematica
34 lines
775 B
Mathematica
% vim: ft=mercury ts=4 sw=4 et
|
|
|
|
:- module bug429.
|
|
:- interface.
|
|
|
|
:- import_module bool.
|
|
:- import_module pair.
|
|
|
|
:- type index
|
|
---> first
|
|
; second.
|
|
|
|
:- pred clear(index::in, pair(bool)::in, pair(bool)::out) is semidet.
|
|
|
|
:- implementation.
|
|
|
|
clear(I, P0, P) :-
|
|
% The cse_detection pass pulls the unification P0 = V_14 - V_13
|
|
% out of the switch on I before determinism analysis checks that
|
|
% the switch on I is complete. The compiler should allow for the scope
|
|
% to contain such pulled-out deconstructions before the switch itself;
|
|
% this test checks whether it does.
|
|
|
|
require_complete_switch [I]
|
|
(
|
|
I = first,
|
|
P0 = yes - Y,
|
|
P = no - Y
|
|
;
|
|
I = second,
|
|
P0 = X - yes,
|
|
P = X - no
|
|
).
|