[m-rev.] for review: finish the "solution" of Mantis bug #585

Peter Wang novalazy at gmail.com
Mon Sep 14 11:11:48 AEST 2026


On Sun, 13 Sep 2026 18:16:40 +0200 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> For review by Peter.
> 
> Zoltan.

> Fix test for "do branches have different typeclass_infos ...
> 
> ... for the same constraint?"
> 
> This completes the workaround for Mantis bug #585.
> 

> diff --git a/compiler/simplify_proc.m b/compiler/simplify_proc.m
> index 6c6b4068c..f30e311cc 100644
> --- a/compiler/simplify_proc.m
> +++ b/compiler/simplify_proc.m
...
> +
> +:- pred report_typeclass_info_problem(module_info::in,
> +    pred_id::in, proc_id::in, proc_info::in,
> +    list(diag_spec)::in, list(diag_spec)::out) is det.
> +
> +report_typeclass_info_problem(ModuleInfo, PredId, ProcId, ProcInfo, !Specs) :-
> +    ProcPieces = describe_one_proc_name_maybe_argmodes(ModuleInfo,
> +        output_debug, yes(color_subject), should_module_qualify, [],
> +        proc(PredId, ProcId)),
> +    proc_info_get_context(ProcInfo, Context),
> +    % We say "debugging enabled", because this is by far
> +    % the most common way for body_typeinfo_liveness to be set.
> +    % Both alternatives, the use of .agc grades and manual setting
> +    % of the option, are extremely rare.
> +    MainPieces = [words("Sorry: he compiler cannot compile")] ++

s/he/the

> diff --git a/tests/invalid/tci_liveness_abort.err_exp b/tests/invalid/tci_liveness_abort.err_exp
> index 26e131dbb..493a27ff3 100644
> --- a/tests/invalid/tci_liveness_abort.err_exp
> +++ b/tests/invalid/tci_liveness_abort.err_exp
> @@ -1,25 +1,9 @@
> -tci_liveness_abort.m:020: Sorry: due to a known limitation, the compiler cannot
> -tci_liveness_abort.m:020:   compile predicate `tci_liveness_abort.test1'/4 with
> -tci_liveness_abort.m:020:   debugging enabled. The limitation concerns the
> -tci_liveness_abort.m:020:   mapping between typeclass on the one hand, and the
> -tci_liveness_abort.m:020:   hidden, compiler-generated variables storing
> -tci_liveness_abort.m:020:   information about them on the other hand.
> -tci_liveness_abort.m:020:
> -tci_liveness_abort.m:020:   The limitation occurs when the definition of a
> -tci_liveness_abort.m:020:   predicate or function contains both the
> -tci_liveness_abort.m:020:   deconstructions of terms that contain existentially
> -tci_liveness_abort.m:020:   typed arguments, and branched code, such as
> -tci_liveness_abort.m:020:   if-then-elses, disjunctions and/or switches. You
> -tci_liveness_abort.m:020:   can work around the limitation by moving such
> -tci_liveness_abort.m:020:   deconstruction unifications to helper predicates
> -tci_liveness_abort.m:020:   that contain no branching.
> -tci_liveness_abort.m:022: Sorry: due to a known limitation, the compiler cannot
> -tci_liveness_abort.m:022:   compile predicate `tci_liveness_abort.test2'/3 with
> -tci_liveness_abort.m:022:   debugging enabled. The limitation concerns the
> -tci_liveness_abort.m:022:   mapping between typeclass on the one hand, and the
> -tci_liveness_abort.m:022:   hidden, compiler-generated variables storing
> -tci_liveness_abort.m:022:   information about them on the other hand.
> -tci_liveness_abort.m:022:
> +tci_liveness_abort.m:022: Sorry: he compiler cannot compile predicate
> +tci_liveness_abort.m:022:   `tci_liveness_abort.test2'/3 with debugging
> +tci_liveness_abort.m:022:   enabled. This is due to a known limitation that
> +tci_liveness_abort.m:022:   concerns the mapping between typeclass on the one
> +tci_liveness_abort.m:022:   hand, and the hidden, compiler-generated variables
> +tci_liveness_abort.m:022:   storing information about them on the other hand.
>  tci_liveness_abort.m:022:   The limitation occurs when the definition of a
>  tci_liveness_abort.m:022:   predicate or function contains both the
>  tci_liveness_abort.m:022:   deconstructions of terms that contain existentially

Hmm, I didn't see why the diagnostic for test1 would disappear.

The rest looks fine.

Peter


More information about the reviews mailing list