[m-rev.] for review: Allow duplicate field names in the same module.

Julien Fischer jfischer at opturion.com
Fri May 7 16:54:21 AEST 2021


Hi Peter,

On Tue, 27 Apr 2021, Peter Wang wrote:

> Allow the same field name to be used in different types in the same
> module. The main motivation is that when defining a subtype it often
> makes sense to use the same field names as in the base/super type,
> rather than trying to invent unique field names.
>
> compiler/add_type.m:
>    Check for duplicate field names within a type only,
>    not across the module.
>
> compiler/check_parse_tree_type_defns.m:
>    Only report duplicate field names within the same type.
>
> compiler/typecheck.m:
>    Make user-supplied declarations for field access functions only
>    override automatically generated declarations for the same type
>    constructor, e.g. a user declaration ':- func foo ^ f1 = int'
>    should not affect 'X ^ f1' for X of type 'bar'.
>
> doc/reference_manual.texi:
>    Allow duplicate field names in a module, but not within a type.
>
>    Describe how user-supplied declarations interact with duplicate
>    field names.
>
> NEWS:
>    Announce change.
>
> tests/invalid/repeated_field_name.err_exp:
>    Update expected error messages.
>
> tests/invalid/Mmakefile:
> tests/invalid/user_field_access_decl_conflict.err_exp:
> tests/invalid/user_field_access_decl_conflict.m:
> tests/invalid/user_field_access_decl_override.err_exp:
> tests/invalid/user_field_access_decl_override.m:
> tests/invalid/user_field_access_decl_override2.err_exp:
> tests/invalid/user_field_access_decl_override2.m:
>    Add test cases.

That looks fine.

Julien.



More information about the reviews mailing list