[m-rev.] for post commit review: fix unintelligible compiler message

Peter Wang novalazy at gmail.com
Wed Mar 13 16:01:53 AEDT 2019


On Wed, 13 Mar 2019 01:32:56 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> Separate out type_info args and return values in mode error msgs.
> 
> compiler/mode_errors.m:
>     When printing an error message that says "these args have these modes,
>     which do not match any declared mode of the callee", avoid confusing
>     users by not mentioning the extra type_info/typeclass_info args added by
>     polymorphism, except in the very rare case that they could be the *cause*
>     of the mode error.

Looks like a big improvement!

> diff --git a/compiler/mode_errors.m b/compiler/mode_errors.m
> index 377fb28..f21a83e 100644
> --- a/compiler/mode_errors.m
> +++ b/compiler/mode_errors.m
> @@ -1035,39 +1035,146 @@ mode_error_in_callee_to_spec(!.ModeInfo, Vars, Insts,
...
> +    ( if NumExtra > 0 then
> +        % The callee's argument list contains extra typeinfo and/or
> +        % typeclass_info arguments added by polymorphism.m. Usually,
> +        % these extra arguments are all already ground, which means that
> +        % they cannot be insufficiently instantiated. And since users cannot
> +        % require them to have any inst more specific than ground, they
> +        % cannot be the cause of any mode errors. This is why we do not
> +        % report their instantations.

instantiations

Peter


More information about the reviews mailing list