[m-rev.] for review: Fix aborts when checking coercions.

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Jul 11 20:43:17 AEST 2025



On Fri, 11 Jul 2025 11:18:16 +1000, Peter Wang <novalazy at gmail.com> wrote:
> On Thu, 10 Jul 2025 09:46:12 +0200 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > Can you please add a comment explaining the purpose of the
> > build_type_param_variance_restrictions_in_ctor_arg_type predicate?
> > The reason why I didn't tackle this bug myself was mostly the absence
> > of info what this predicate was meant to do.
> 
> How about this?
> 
> +    % Return the set of type parameters of the given TypeCtor that must
> +    % remain invariant during type conversion.
> +    %
> +    % If T (a type parameter in the common base type of a type conversion)
> +    % is in the invariant set, then T must be bound to the same type on
> +    % both sides of the conversion.
> +    %
>  :- pred build_type_param_variance_restrictions(type_table::in,
>      type_ctor::in, invariant_set::out) is det.

That helps a lot, but not quite enough. It would also be nice to see an argument
for why the code treats tuples differently from du types. However, I think I can see
that argument, so go ahead and commit that, and I will propose documentation
of that argument.

Zoltan.




More information about the reviews mailing list