[m-rev.] for review: use checked type, inst and mode definitions in parse_tree_int[123]
Julien Fischer
jfischer at opturion.com
Fri Oct 1 17:17:32 AEST 2021
Hi Zoltan,
On Thu, 30 Sep 2021, Zoltan Somogyi wrote:
> Use checked type/inst/modes in parse_tree_int[123]s.
>
> With this change, we guarantee that if any type, inst or mode
> has inconsistent definitions in its defining module, those inconsistencies
> will not make it into the the module's .int/.int2/.int3 files, where
> they would confuse any compiler invocation that reads them in.
...
> diff --git a/compiler/comp_unit_interface.m b/compiler/comp_unit_interface.m
> index 24443b29e..1afc82cf9 100644
> --- a/compiler/comp_unit_interface.m
> +++ b/compiler/comp_unit_interface.m
...
> @@ -1448,238 +1611,523 @@ get_base_type(TypeDefnMap, TVarSet, Type, BaseType, SeenTypes0):-
...
> + (
> + DuStatus = std_du_type_mer_ft_exported,
> + % The entirety of this type is in the interface, except any foreign
> + % enum items, and we want all components where they are.
> + map.det_insert(TypeCtor, TypeCtorCheckedDefn0,
> + !TypeCtorCheckedMap)
> + ;
> + DuStatus = std_du_type_mer_exported,
> + ( if set.member(TypeCtor, NeededImpTypeCtors) then
> + % This type has a du Mercury definition in the interface,
> + % and possibly one or more foreign type and/or enum
> + % definitions in the implementation section, and we want
> + % all of those items where they are.
> + list.foldl(record_foreign_lang_in_type_defn,
> + SrcImpDefns0, !ImpImplicitFIMLangs),
> + map.det_insert(TypeCtor, TypeCtorCheckedDefn0,
> + !TypeCtorCheckedMap)
> + else
> + % This type has a du Mercury definition in the interface.
> + % We don't want any of its foreign type definitions in the
> + % implementation section, but (since the Mercury function
> + % symbols are exported) we do want any foreign enum items
> + % in the implementation section to stay where they are.
> + delete_any_foreign_type_defn_from_extras(Extras0, Extras),
> + % Did deleting type definitions make difference?
s/make difference/make a difference/
> + ( if Extras = Extras0 then
> + % No, it did not.
> + map.det_insert(TypeCtor, TypeCtorCheckedDefn0,
> + !TypeCtorCheckedMap)
The diff looks fine otherwise.
Julien.
More information about the reviews
mailing list