[m-rev.] for review: --warn-too-private-instances

Julien Fischer jfischer at opturion.com
Fri Jul 18 16:32:45 AEST 2025


On Fri, 18 Jul 2025 at 16:31, Julien Fischer <jfischer at opturion.com> wrote:
>
> On Fri, 18 Jul 2025 at 15:52, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
> > Add --warn-too-private-instances.
> >
> > This implements an idea from 2022 mar 8 on m-rev.
> >
> > compiler/options.m:
> >     Add this option.
> >
> > compiler/check_typeclass.m:
> >     Generate a warning that is conditional on this option if an instance
> >     is local to the module even if both
> >
> >     - the class the instance is for, and
> >     - all the type_ctors that occur in the instance's arg type vector
> >
> >     are visible outside the module.
> >
> >     Add an XXX about the status we record for instances.
> >
> > tests/invalid/Mercury.options:
> > tests/warnings/Mercury.options:
> >     Explicitly enable the new warning for some of the affected tests, and
> >     explicitly disable it for others.
> >
> > tests/invalid/impure_method_impl.err_exp:
> > tests/invalid/inconsistent_instances.err_exp:
> > tests/invalid/method_impl.err_exp:
> > tests/invalid/mpj_3.err_exp:
> > tests/invalid/mpj_4.err_exp:
> > tests/invalid/range_restrict.err_exp:
> > tests/warnings/help_text.err_exp:
> > tests/warnings/unused_interface_import.err_exp:
> >     For the tests for which the new warning is enabled, expect that warning.
>
> That looks fine.

That said, you should announce the new option in the NEWS file.

Julien.


More information about the reviews mailing list