[m-rev.] for review: Fix aborts when checking coercions.
Zoltan Somogyi
zoltan.somogyi at runbox.com
Thu Jul 10 17:46:12 AEST 2025
On Thu, 10 Jul 2025 15:54:37 +1000, Peter Wang <novalazy at gmail.com> wrote:
> diff --git a/compiler/typecheck_coerce.m b/compiler/typecheck_coerce.m
> index 6ecfd6e34..e47e0c382 100644
> --- a/compiler/typecheck_coerce.m
> +++ b/compiler/typecheck_coerce.m
> @@ -313,8 +313,12 @@ build_type_param_variance_restrictions_in_ctor_arg_type(TypeTable, CurTypeCtor,
> type_vars_in_types(ArgTypes, TypeVars),
> set.insert_list(TypeVars, !InvariantSet)
> ;
> - TypeBody = hlds_eqv_type(_),
> - unexpected($pred, "hlds_eqv_type")
> + TypeBody = hlds_eqv_type(EqvType0),
> + hlds_data.get_type_defn_tparams(TypeDefn, TypeParams),
> + map.from_corresponding_lists(TypeParams, TypeArgs, TSubst),
> + apply_subst_to_type(TSubst, EqvType0, EqvType),
> + build_type_param_variance_restrictions_in_ctor_arg_type(TypeTable,
> + CurTypeCtor, CurTypeParams, EqvType, !InvariantSet)
> )
> else
> unexpected($pred, "undefined type")
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.
The diff is fine. The first test case in particular is impressively
comprehensive. Thank you.
Zoltan.
More information about the reviews
mailing list