Commit Graph

3 Commits

Author SHA1 Message Date
Zoltan Somogyi
c03b11ca48 Update the style of more test cases.
And updated expected outputs for changed line numbers.
2021-07-27 19:29:21 +10:00
Zoltan Somogyi
83dc913329 Update the style of the warnings test cases.
tests/warnings/*.m:
    Bring the programming style of these modules up to date,
    except where the problem being tested for seems to be related
    to the old programming style

    In the infinite_recursion test case, add code that we *should*
    warn about, but currently don't.

tests/warnings/*.m:
    Update the expected outputs to account for the changes in line
    numbers, and the fact that the compiler computes the contexts
    of (if C then T else E) if-then-elses differently from (C -> T; E)
    if-then-else (it takes the context of the "then" vs the context
    of the ";").

    Delete arg_order_rearrangment.exp2. It was long unused, but
    deleting it in CVS would not have allowed us to put it back later.
2019-04-20 09:37:37 +10:00
Zoltan Somogyi
4b44c29c2e Fix mantis bug 311.
compiler/simplify_goal_disj.m:
    Look for the conditions that lead to the bug (a disjunction that
    further instantiates an already partially instantiated variable).
    Generate an error message when found, PROVIDED that this happens
    in a context in which the surrounding procedure can succeed
    more than once. (If it cannot, then you cannot invoke an all-solutions
    predicate on it, and the bug cannot happen.)

    This condition (a model_non surrounding procedure) was motivated
    by mdbcomp/feedback.m, which does not compile without it.

compiler/simplify_info.m:
    The simplify_info type used to contain four different kinds of fields:

    1 static fields; set and then never changed, such as the id of the
      containing procedure
    2 global information, such as the varset and vartypes, which are updated
      as new variable are added, and whose updates need to be kept regardless
      of what part of the procedure is analyzed next
    3 information about the context surrounding the goal currently being
      analyzed, such as the number of lambda expressions we are inside
    4 information about the point in the code before the goal currently being
      analyzed, such as the set of equivalences that currently hold between
      variables (part of common_info).

    The code of the simplify_goal*.m modules used to have jump through hoops
    to handle 3 and 4 properly, given that the simplify_info was being
    threaded through code in a way that was suitable only for 1 and 2.

    This change takes categories 3 and 4 out of the simplify_info.
    It creates a new type, simplify_nested_context, for category 3,
    and adds information about the ability of the procedure surrounding
    the current point to succeed more than once (needed for the bug311 fix)
    to this new type.

compiler/simplify_tasks.m:
    Rename the do_once task to mark_code_model_changes, since this
    expresses what the task is much less ambiguously.

compiler/simplify_goal*.m:
compiler/simplify_proc.m:
compiler/common.m:
compiler/mercury_compile_front_end.m:
compiler/mercury_compile_llds_back_end.m:
    Conform to the changes to simplify_info (and simplify_tasks).
    Pass the current instmap and common_info (the two category 4 fields)
    separately.

    Mark some places that could be improved.

compiler/hlds_out_mode.m:
    Generate easier-to-understand debugging output. I needed this to track
    down a bug in my initial fix.

compiler/inst_match.m:
    Remove a redundant unification that couldn't fail (since it was invoked
    only if the exact same unification succeeded a few lines earlier).
    Apply another minor optimizations.

compiler/instmap.m:
    Remove references to the alias branch. It won't be coming back.

compiler/error_util.m:
    Fix some documentation.

mdbcomp/feedback.m:
    Put related stuff together.

tests/warnings/bug311.{m,err_exp}:
    New test case for the bug.

tests/warnings/Mmakefile:
    Enable the new test case.
2014-07-30 12:10:39 +02:00