[m-rev.] for review: don't put duplicate instance decls into .int0 files

Peter Wang novalazy at gmail.com
Fri Jun 30 14:46:14 AEST 2023


On Fri, 30 Jun 2023 07:32:00 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> Don't generate duplicate instance declarations.
> 
> We used to include in the .int0 file the abstract form of all the instance
> declarations in both the interface and the implementation sections.
> When an instance is declared (in an already-abstract form) in the interface
> section and defined in the implementation section, this resulted in the
> abstract interface declaration being included in the .int0 file twice,
> once in the interface section, and once in the implementation section.
> 
> compiler/comp_unit_interface.m:
>     Fix this by include an abstract instance declaration in the implementation
>     section of a .int0 file only if it does not also appear in the interface
>     section.
> 
...

> @@ -1352,6 +1352,11 @@ replace_in_typeclass_info(ModuleName, MaybeRecord, TypeEqvMap, InstEqvMap,
>          ClassInterface, TVarSet, Context, SeqNum).
>  
>  %---------------------%
> +%
> +% The next two predicates have identical definitions, but one is for
> +% item_instance_infos, while the other is for item_abstract_instance_infos.
> +% XXX Ideally, this should not be necessary.
> +%
>  

I think you could introduce a type item_instance_info(Body), and define
item_instance_info and item_abstract_instance_info as equivalence types.

The change looks fine.

Peter


More information about the reviews mailing list