Files
mercury/tests/invalid/range_restrict.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

953 B

range_restrict.m:015: In instance for typeclass `foo'/2:
range_restrict.m:015: error: functional dependency not satisfied: type
range_restrict.m:015: variables `Y' and `Z' occur in the range of the
range_restrict.m:015: functional dependency, but are not determined by the
range_restrict.m:015: domain.
range_restrict.m:015: Warning: the type class `range_restrict.foo'/2 and the
range_restrict.m:015: type constructor in the argument vector of this
range_restrict.m:015: instance declaration for it, namely `map.map'/2, are
range_restrict.m:015: all visible outside this module, which means that this
range_restrict.m:015: instance can be relevant outside this module. Keeping
range_restrict.m:015: it private to this module is therefore likely to be a
range_restrict.m:015: mistake.