[m-rev.] for review: type_spec_constrained_preds
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Feb 7 14:08:01 AEDT 2024
On 2024-02-07 13:58 +11:00 AEDT, "Julien Fischer" <jfischer at opturion.com> wrote:
>> > vim/syntax/mercury.vim:
>> List the new pragma name.
>
> You've already listed this change above.
Duplicate deleted.
>> + % Values of this type represent the set of typeclass constraints
>> + % we want to specialize. Each class_id in here will correspond
>> + % either to a constraint in a type_spec_constrained_preds pragma,
>> + % one its superclasses, or one of *their* superclasses, and so on.
>> + % We may be on the lookout for more than one instance of a class.
>
> may or must?
We *must* be on the lookout for all instances of a class that are also instances
of a constraint in the new pragma (this being the set of constraints we want to specialize),
and this *all* quantifier *may* rerpresent one instance, or more than one.
(For zero instances, the map won't have an entry for that class.)
Can you suggest a wording that makes this clearer?
>> (
>> + Pragma0 = decl_pragma_type_spec_constr(TypeSpecConstrInfo0),
>> + TypeSpecConstrInfo0 = decl_pragma_type_spec_constr_info(ModuleName,
>> + OoMConstraints0, ApplyToSupers, OoMSubsts0, TVarSet, Items,
>> + Context, SeqNum),
>> + % XXX
>
> What's the XXX for?
Just a stray; deleted.
>> + ConstraintErrorContext = mqcec_type_spec_constr(Context, ModuleName),
>> + OoMConstraints0 = one_or_more(HeadConstraint0, TailConstraints0),
>> + qualify_var_or_ground_constraint(InInt, ConstraintErrorContext,
>> + HeadConstraint0, HeadConstraint, !Info, !Specs),
>> + qualify_var_or_ground_constraint_list(InInt, ConstraintErrorContext,
>> + TailConstraints0, TailConstraints, !Info, !Specs),
>> + OoMConstraints = one_or_more(HeadConstraint, TailConstraints),
>> + ErrorContext = mqec_pragma_decl(Context, Pragma0),
>> + OoMSubsts0 = one_or_more(HeadSubst0, TailSubsts0),
>> + qualify_type_subst(InInt, ErrorContext,
>> + HeadSubst0, HeadSubst, !Info, !Specs),
>> + list.map_foldl2(qualify_type_subst(InInt, ErrorContext),
>> + TailSubsts0, TailSubsts, !Info, !Specs),
>> + OoMSubsts = one_or_more(HeadSubst, TailSubsts),
>> + TypeSpecConstrInfo = decl_pragma_type_spec_constr_info(ModuleName,
>> + OoMConstraints, ApplyToSupers, OoMSubsts, TVarSet, Items,
>> + Context, SeqNum),
>> + Pragma = decl_pragma_type_spec_constr(TypeSpecConstrInfo)
>> + ;
>> Pragma0 = decl_pragma_type_spec(TypeSpecInfo0),
>> TypeSpecInfo0 = decl_pragma_type_spec_info(PFUMM0, PredName,
>> SpecPredName, Subst0, TVarSet, Items, Context, SeqNum),
>
> That looks fine otherwise.
Thank you. I followed your other suggestions.
Zoltan.
More information about the reviews
mailing list