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

22 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

impure_method_impl.m:025: Warning: the type class `impure_method_impl.c'/1 and
impure_method_impl.m:025: the type constructor in the argument vector of this
impure_method_impl.m:025: instance declaration for it, namely
impure_method_impl.m:025: `impure_method_impl.foo'/0, are all visible outside
impure_method_impl.m:025: this module, which means that this instance can be
impure_method_impl.m:025: relevant outside this module. Keeping it private to
impure_method_impl.m:025: this module is therefore likely to be a mistake.
impure_method_impl.m:026: Error: instance method predicate `m1'/2 is semipure.
impure_method_impl.m:026: It must either be declared semipure, or promised
impure_method_impl.m:026: pure.
impure_method_impl.m:026: In call to semipure predicate
impure_method_impl.m:026: `impure_method_impl.foo_m1'/2:
impure_method_impl.m:026: purity error: call must be preceded by a `semipure'
impure_method_impl.m:026: indicator.
impure_method_impl.m:027: Error: instance method predicate `m2'/2 is impure. It
impure_method_impl.m:027: must either be declared impure, or promised
impure_method_impl.m:027: semipure.
impure_method_impl.m:027: In call to impure predicate
impure_method_impl.m:027: `impure_method_impl.foo_m2'/2:
impure_method_impl.m:027: purity error: call must be preceded by an `impure'
impure_method_impl.m:027: indicator.