Files
mercury/tests/invalid/inconsistent_instances.err_exp
Zoltan Somogyi 3540f7431b Improve --warn-too-private-instances.
This implements some improvements to its idea from 2022 mar 19 on m-rev.

compiler/check_typeclass.m:
    Consider an instance justifiably kept private if a constraint
    on the instance refers to a private type class or type constructor.

    Extend the test for what is considered "private" to also include
    classes and type constructs that are defined in private submodules
    of the current module.

    Extend the text of the warning to explain the reasoning behind it.

compiler/options.m:
    Extend the documentation of the option to explain the reasoning
    behind it.

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/unused_interface_import.err_exp:
    Expect the new text for the warning.

tests/warnings/help_text.err_exp:
    Expect the new help text.
2025-07-22 14:57:42 +02:00

1.7 KiB

inconsistent_instances.m:015: Warning: the type class
inconsistent_instances.m:015: `inconsistent_instances.foo'/2 and the type
inconsistent_instances.m:015: constructor in the argument vector of this
inconsistent_instances.m:015: instance declaration for it, namely
inconsistent_instances.m:015: `list.list'/1, are all visible outside this
inconsistent_instances.m:015: module, which means that this instance can be
inconsistent_instances.m:015: relevant outside this module. Keeping it
inconsistent_instances.m:015: private to this module is therefore likely to
inconsistent_instances.m:015: be a mistake.
inconsistent_instances.m:016: Error: inconsistent instance declaration for
inconsistent_instances.m:016: typeclass `inconsistent_instances.foo'/2 with
inconsistent_instances.m:016: functional dependency `(A -> B)'.
inconsistent_instances.m:015: Here is the conflicting instance.
inconsistent_instances.m:016: Warning: the type class
inconsistent_instances.m:016: `inconsistent_instances.foo'/2 and the type
inconsistent_instances.m:016: constructor in the argument vector of this
inconsistent_instances.m:016: instance declaration for it, namely
inconsistent_instances.m:016: `list.list'/1, are all visible outside this
inconsistent_instances.m:016: module, which means that this instance can be
inconsistent_instances.m:016: relevant outside this module. Keeping it
inconsistent_instances.m:016: private to this module is therefore likely to
inconsistent_instances.m:016: be a mistake.