[m-rev.] for review: simplify subtype checking code

Peter Wang novalazy at gmail.com
Mon Jul 12 10:54:58 AEST 2021


On Fri, 09 Jul 2021 13:35:01 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> For review by Peter. The ATn files are intermediate versions,
> and may, or may not, be useful in the review.
> 
> Zoltan.

> Simplify the code checking subtypes.
> 
> compiler/add_type.m:
>     Make the code that looks up supertypes also check whether they are
>     du types without a foreign definition, since all its uses need that check.
> 
>     Add each supertype to the "list of previous supertypes" when it actually
>     becomes "previous".
> 
>     Factor out code that was repeated in (a) checking the immediate supertype,
>     and (b) checking more distant ancestor supertypes.
> 
>     Put the code that constructs error_specs next to the code that constructs
>     their main components, the pieces.
> 
>     The above changes make it possible to replace check_subtype_defn,
>     check_subtype_defn_2 and check_subtype_defn_3 into one predicate.
> 
>     Inline some other predicates/functions into their only call sites as well.
> 
>     Give some predicates and variable more meaningful names.

That's fine.

Peter


More information about the reviews mailing list