tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
1. An inst variable from the head of the clause could be bound in the body.
The mode error in the call `P(X)' was not detected because the inst
variable I could be bound to ground.
:- pred p(pred(T), T).
:- mode p(pred(in(I =< ground)) is det, in) is det.
p(P, X) :- P(X).
2. In David Overton's thesis, a get_subst function produces an inst
substitution from the callee's initial insts to the arguments' initial
insts, and the substitution is applied to all insts from the callee.
In the implementation we actually build the substitution while matching
the arguments' insts with the callee's insts, but we lost some precision
by not applying the incremental substitutions built as we match a list
of insts.
3. We rename apart the callee's inst variables from our own, but did not
keep the merged inst varset. When a renamed inst variable appears in a
mode error it would be printed without its original name.
(could this avert more serious problems?)
4. inst_merge_3 was missing a case.
Some of these bugs may not be apparent due to the hack in
inst_matches_final_3 which allows a ground inst to match any bound inst.
A similar hack exists in inst_matches_binding_3.
compiler/inst_util.m:
Handle in inst_merge_3 the case
InstA \= constrained_inst_var(_, _),
InstB = constrained_inst_var(_, _).
Move InstA = not_reached case to inst_merge_2 to maintain
inst_merge(not_reached, InstB @ constrained_inst_var(_, _)) = InstB
compiler/inst_match.m:
Improve precision of inst var substitution computed in
handle_inst_var_subs_2, following dmo's thesis.
compiler/mode_util.m:
compiler/modecheck_call.m:
Keep the merged inst varsets after renaming.
compiler/mode_info.m:
Add "head inst vars" in mode_info structure.
compiler/modecheck_util.m:
Add get_constrained_inst_vars to extract constrained inst vars from a
list of mode.
Make modecheck_var_has_inst_list_* fail if the computed substitution
would change the constraints of any head inst variables.
compiler/modes.m:
Initialise mode_info with head inst variables.
compiler/pd_info.m:
compiler/pd_util.m:
Conform to change in mode_info_init (not specifically tested).
compiler/prog_mode.m:
Export inst_apply_substitution.
Make rename_apart_inst_vars return the merged inst varset.
Fix comments.
tests/invalid/Mmakefile:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/constrained_poly_insts2.m:
tests/valid/Mmakefile:
tests/valid/constrained_poly_multi.m:
Add test cases.
NEWS:
Announce fix.