Files
mercury/tests/invalid/bug415.err_exp
Zoltan Somogyi d64966713c Fix an infinite loop when prettyprinting insts for error messages.
compiler/error_msg_inst.m:
    When prettyprinting insts for use in error messages, we have to be careful
    to generate finite output even for recursive insts. Previously, we did
    the required check when processing user-defined inst names, but not when
    processing compiler-generated inst names, which can also be recursive.
    Fix this bug, which is Mantis bug 415.

    Previously, we passed information about what potentially-recursive inst
    names we have seen so far only downward. With the fix above, this avoids
    infinite loops, but in some cases, it leads us to print the definition
    of a given named inst more than once. Change our approach so that we
    now pass information about the set of potentially-recursive inst names
    we have seen sideways as well. This can make us generate more compact
    and therefore more understandable output when prettyprinting insts that
    contain such non-nested duplication.

    When printing something that says "inst name x, which expands to ...",
    indent the "..." one level deeper than the "inst name x". This visually
    separates the thing being defined and its definition.

    When prettyprinting complex insts, we show their structure using
    indentation levels in the output. Each increase of indentation
    should be balanced by a later matching decrease. Move the code that
    does the increase and the decrease next to each other, to make it easier
    to see the implicit correctness argument.

tests/invalid/bug415.{m,err_exp}:
    A new test case for this bug.

tests/invalid/Mmakefile:
    Enable the new test case.

tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/polymorphic_unification.err_exp:
    Expect the extra level of indentation after "which expands to".

tests/invalid/ho_default_func_4.err_exp:
    Expect the extra level of indentation after "which expands to",
    and expect a repeated inst name NOT to have its definition repeated.
2016-08-30 18:37:19 +10:00

43 lines
1.5 KiB
Plaintext

bug415.m:046: In clause for `ip_chunk_2(in(list.list((I =< ground))), in,
bug415.m:046: in(list.list((I =< ground))), in, out(list.list((I =<
bug415.m:046: ground))))':
bug415.m:046: mode error: argument 6 became too instantiated.
bug415.m:046: Final instantiatedness of `HeadVar__5' was
bug415.m:046: bound(
bug415.m:046: []
bug415.m:046: ;
bug415.m:046: '[|]'(
bug415.m:046: ground,
bug415.m:046: bound(
bug415.m:046: []
bug415.m:046: ;
bug415.m:046: '[|]'(
bug415.m:046: ( I =< ground ),
bug415.m:046: internal $merge_inst #1,
bug415.m:046: which expands to
bug415.m:046: bound([] ; '[|]'(( I =< ground ),
bug415.m:046: internal $merge_inst #1))
bug415.m:046: )
bug415.m:046: )
bug415.m:046: )
bug415.m:046: ),
bug415.m:046: expected final instantiatedness was
bug415.m:046: named inst list.list(
bug415.m:046: ( I =< ground )
bug415.m:046: ),
bug415.m:046: which expands to
bug415.m:046: named inst list.list_skel(
bug415.m:046: ( I =< ground )
bug415.m:046: ),
bug415.m:046: which expands to
bug415.m:046: bound(
bug415.m:046: []
bug415.m:046: ;
bug415.m:046: '[|]'(
bug415.m:046: ( I =< ground ),
bug415.m:046: named inst list.list_skel(
bug415.m:046: ( I =< ground )
bug415.m:046: )
bug415.m:046: )
bug415.m:046: ).