mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 03:43:51 +00:00
We used to have several predicates whose job was to simplify modes for
presentation to users. Their jobs were slightly different, but contained
a shared core: recognizing the exploded (from_inst >> to_inst)
forms of the standard builtin modes. Replace these
compiler/prog_mode.m:
Moves an existing predicate in parse_tree_out_inst.m for recognizing
the standard builtin modes to prog_mode.m, to make it generally available.
Refactor the existing insts_to_mode predicate to use this predicate.
Make insts_to_mode recognize mdi(I) modes as well.
Add utility predicates for stripping all type_inst wrappers from
insts and modes. Base these on the similar utility predicates
for stripping builtin qualifiers from insts and modes. Export
all meaningful variants of both sets of utilities.
Use variables named InstNameX for inst names; the old InstX names
were misleading, since the inst_name type is different from mer_inst.
compiler/parse_tree_out_inst.m:
Delete the code moved to prog_mode.m.
Use the updated functionality in prog_mode to simplify modes.
This means that we can now simplify all in(...) modes, not just
when the ... is a higher order inst.
Strip module qualifiers from modes when printing output for humans
(and *only* for humans), since in 99.9+% of cases they are clutter.
compiler/error_msg_inst.m:
Replace the old code for recognizing standard modes with calls
to the predicates in prog_mode.m. They can do a better job than
the old code did. The recognize arity 1 standard modes, not just
arity 0, and they remove typed_inst wrappers everywhere in insts,
not just at the top level.
compiler/hlds_out_util.m:
Fix an old bug: don't *assume* that any modes being converted to string
are intended only for humans; get our callers to *tell us* whether
that is the case. When intermod.m uses hlds_out_goal.m to write out
the modes on the arguments of lambda goals, this is *not* the case,
since some transformations intended for humans, such as stripping
module qualifications, can actually break things.
Give a field in the hlds_out_info a more meaningful name.
compiler/hlds_out_goal.m:
compiler/hlds_out_module.m:
compiler/intermod.m:
compiler/mode_errors.m:
Conform to the changes in hlds_out_util.m.
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/mode_inf.err_exp:
Expect the updated forms of modes in error messages.
30 lines
1.6 KiB
Plaintext
30 lines
1.6 KiB
Plaintext
ho_any_inst.m:052: In clause for `cond0(in, out)':
|
|
ho_any_inst.m:052: in higher-order predicate call:
|
|
ho_any_inst.m:052: scope error: attempt to bind a non-local variable inside
|
|
ho_any_inst.m:052: the condition of an if-then-else.
|
|
ho_any_inst.m:052: Variable `P' has instantiatedness `(any_pred is semidet)',
|
|
ho_any_inst.m:052: expected instantiatedness was `(pred is semidet)'.
|
|
ho_any_inst.m:060: In clause for `neg0(in)':
|
|
ho_any_inst.m:060: in higher-order predicate call:
|
|
ho_any_inst.m:060: scope error: attempt to bind a non-local variable inside a
|
|
ho_any_inst.m:060: negation.
|
|
ho_any_inst.m:060: Variable `P' has instantiatedness `(any_pred is semidet)',
|
|
ho_any_inst.m:060: expected instantiatedness was `(pred is semidet)'.
|
|
ho_any_inst.m:064: In clause for `cond1(in, out)':
|
|
ho_any_inst.m:064: in higher-order predicate call:
|
|
ho_any_inst.m:064: scope error: attempt to bind a non-local variable inside
|
|
ho_any_inst.m:064: the condition of an if-then-else.
|
|
ho_any_inst.m:064: Variable `P' has instantiatedness
|
|
ho_any_inst.m:064: `(any_pred(in(any)) is semidet)',
|
|
ho_any_inst.m:064: expected instantiatedness was
|
|
ho_any_inst.m:064: `(pred(in(any)) is semidet)'.
|
|
ho_any_inst.m:072: In clause for `neg1(in)':
|
|
ho_any_inst.m:072: in higher-order predicate call:
|
|
ho_any_inst.m:072: scope error: attempt to bind a non-local variable inside a
|
|
ho_any_inst.m:072: negation.
|
|
ho_any_inst.m:072: Variable `P' has instantiatedness
|
|
ho_any_inst.m:072: `(any_pred(in(any)) is semidet)',
|
|
ho_any_inst.m:072: expected instantiatedness was
|
|
ho_any_inst.m:072: `(pred(in(any)) is semidet)'.
|
|
For more information, recompile with `-E'.
|