Files
mercury/tests/invalid/dcg_context.err_exp
Zoltan Somogyi 20b77c995e Fix if-then-else contexts in DCG clauses.
compiler/parse_dcg_goal.m:
    The DCG transformation adds unifications to the then-parts and else-parts
    of if-then-elses. Use the contexts of the actual user code in these parts
    for the compiler-generated conjunctions of which they are part.

tests/invalid/dcg_context.{m,err_exp}:
    The test case from m-users which motivated this change. The error message
    generated by the compiler for this code used the same context for
    both the user-written then-part and the compiler-created else part
    of an if-then (no else) goal in a DCG clause. The fix makes it clear,
    in this instance and most others, that when mode analysis complains
    about a mismatch between the two arms of the if-then-else, it is
    talking about two separate pieces of code.

tests/invalid/Mmakefile:
    Enable the new test case.
2023-11-03 23:51:34 +11:00

11 lines
578 B
Plaintext

dcg_context.m:076: In clause for `get_class_super(out, out, in, out)':
dcg_context.m:076: mode mismatch in if-then-else.
dcg_context.m:076: The variable `Class' is ground in some branches but not
dcg_context.m:076: others.
dcg_context.m:076: In this branch, `Class' is free.
dcg_context.m:077: In this branch, `Class' is ground.
dcg_context.m:076: The variable `MaybeSuper' is ground in some branches but
dcg_context.m:076: not others.
dcg_context.m:076: In this branch, `MaybeSuper' is free.
dcg_context.m:077: In this branch, `MaybeSuper' is ground.