[m-rev.] for review: record source items in type_ctor_checked_defns

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Sep 8 06:35:45 AEST 2021



On Tue, 7 Sep 2021 15:22:46 +1000, Peter Wang <novalazy at gmail.com> wrote:
> > I want to add code to what is now check_parse_tree_type_defns.m
> > to also check inst and mode definitions for consistency, but this would
> > seem to require a change in the file name. Would anyone object to
> > check_type_inst_mode_defns.m?
> > 
> > Zoltan.
> 
> No objection, but will the file not be too big?

No, for two reasons.

First, the code checking type defn items for consistency is complicated
and extensive because there are many kinds of type definitions
(equivance types, du types which may or may not be enums, foreign types
and foreign enums) as well as type declarations. For insts and modes, there
are declarations and definitions only, so there is no combinatorial explosion
of possible conflicts.

Second, once we switch parse trees to use checked maps of type, inst and
mode definitions, the types representing those maps will have to move
to prog_item.m. Those types currently take more than 200 lines.

> >  build_mercury_foreign_enum_map(TypeCtor, CtorNames, CtorNamesSet,
> > -        ForeignEnum, {CheckedForeignEnum, Specs}) :-
> > +        ForeignEnum, MaybeCheckedForeignEnum) :-
> >      ForeignEnum = item_foreign_enum_info(_Lang, _TypeCtor, MercuryForeignOoM,
> >          Context, _SeqNum),
> >      MercuryForeignAL = one_or_more_to_list(MercuryForeignOoM),
> > -    ContextPieces = [words("In"), pragma_decl("foreign_export_enum"),
> > +    ContextPieces = [words("In"), pragma_decl("foreign_enum"),
> >          words("declaration for type"), unqual_type_ctor(TypeCtor),
> >          suffix(":"), nl],
> 
> Hmm, this mistake doesn't seem easy to trigger.

I don't know what you mean by that.

> The rest looks fine. I noticed that the type_details_du field name
> 'du_supertype' should be changed.

OK, I will do that in a separate change.

> > diff --git a/doc/reference_manual.texi b/doc/reference_manual.texi
> > index 0e2099966..c563b0855 100644
> > --- a/doc/reference_manual.texi
> > +++ b/doc/reference_manual.texi
> 
> That's ok.

Thank you.

Zoltan.





More information about the reviews mailing list