diff: Fix bug in modechecking of non-local lambda vars
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Feb 7 02:24:49 AEDT 1998
On 06-Feb-1998, Andrew Bromage <bromage at cs.mu.OZ.AU> wrote:
> compiler/inst_util.m:
> Export make_shared_inst_list/4.
The log message should say why (e.g. "for use by blah.m").
> +report_mode_error_non_local_lambda_var(ModeInfo, Var, VarInst) -->
> + { mode_info_get_context(ModeInfo, Context) },
> + { mode_info_get_varset(ModeInfo, VarSet) },
> + { mode_info_get_instvarset(ModeInfo, InstVarSet) },
> + mode_info_write_context(ModeInfo),
> + prog_out__write_context(Context),
> + io__write_string(" mode error: variable `"),
> + mercury_output_var(Var, VarSet, no),
> + io__write_string("' has instantiatedness `"),
> + output_inst(VarInst, InstVarSet),
> + io__write_string("',\n"),
> + prog_out__write_context(Context),
> + io__write_string(" expected instantiatedness for non-local variables of lambda goals\n"),
> + io__write_string(" is `ground'.\n").
You need to wrap the long line onto the next line,
and you're missing a call to prog_out__write_context.
> --- modecheck_unify.m 1998/01/30 06:12:52 1.27
> +++ modecheck_unify.m 1998/02/06 00:16:48
> @@ -334,6 +334,7 @@
> % First modecheck the lambda goal itself:
> %
> % initialize the initial insts of the lambda variables,
> + % check that the non-local vars are ground,
> % lock the non-local vars,
> % mark the non-clobbered lambda variables as live,
> % modecheck the goal,
I think
% mark the non-local vars as shared,
should go in that list before "lock the non-local vars".
> + % XXX This test is too conservative.
> + %
> + % We should allow non-local variables to be non-ground
> + % if they are dead after this unification. In addition,
Why only if they are dead after this unification?
Why not always?
> Index: tests/invalid/bind_var_errors.err_exp
> ===================================================================
> bind_var_errors.m:033: In clause for `bind_var_in_negation':
> bind_var_errors.m:033: scope error: attempt to bind a variable inside a negation.
> bind_var_errors.m:033: Variable `X' has instantiatedness `free',
> bind_var_errors.m:033: expected instantiatedness was `unique(42)'.
> bind_var_errors.m:039: In clause for `bind_var_in_ite_cond(in)':
> bind_var_errors.m:039: scope error: attempt to bind a non-local variable inside the
> bind_var_errors.m:039: condition of an if-then-else.
Hmm, it would better to wrap "inside the" onto the next line.
> bind_var_errors.m:048: In clause for `bind_var_in_lambda':
> bind_var_errors.m:048: in argument 1 of call to predicate `call/1':
> bind_var_errors.m:048: mode error: variable `Y' has instantiatedness `free',
> bind_var_errors.m:048: expected instantiatedness for non-local variables of lambda goals
> is `ground'.
Wrap that line from "of lambda goals".
Otherwise, that looks good. But can I please see
another diff before you commit that? Thanks.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list