mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
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.
1.6 KiB
1.6 KiB
mpj_3.m:025: Warning: the type class `mpj_3.coll'/2 and the type constructor in
mpj_3.m:025: the argument vector of this instance declaration for it, namely
mpj_3.m:025: `mpj_3.intlist'/0, are all visible outside this module, which
mpj_3.m:025: means that this instance can be relevant outside this module.
mpj_3.m:025: Keeping it private to this module is therefore likely to be a
mpj_3.m:025: mistake.
mpj_3.m:026: Warning: the type class `mpj_3.coll'/2 and the type constructor in
mpj_3.m:026: the argument vector of this instance declaration for it, namely
mpj_3.m:026: `mpj_3.stringlist'/0, are all visible outside this module, which
mpj_3.m:026: means that this instance can be relevant outside this module.
mpj_3.m:026: Keeping it private to this module is therefore likely to be a
mpj_3.m:026: mistake.
mpj_3.m:027: Error: inconsistent instance declaration for typeclass
mpj_3.m:027: `mpj_3.coll'/2 with functional dependency `(C -> E)'.
mpj_3.m:025: Here is the conflicting instance.
mpj_3.m:027: Warning: the type class `mpj_3.coll'/2 and the type constructor in
mpj_3.m:027: the argument vector of this instance declaration for it, namely
mpj_3.m:027: `mpj_3.intlist'/0, are all visible outside this module, which
mpj_3.m:027: means that this instance can be relevant outside this module.
mpj_3.m:027: Keeping it private to this module is therefore likely to be a
mpj_3.m:027: mistake.
mpj_3.m:025: the argument vector of this instance declaration for it, namely
mpj_3.m:025: `mpj_3.intlist'/0, are all visible outside this module, which
mpj_3.m:025: means that this instance can be relevant outside this module.
mpj_3.m:025: Keeping it private to this module is therefore likely to be a
mpj_3.m:025: mistake.
mpj_3.m:026: Warning: the type class `mpj_3.coll'/2 and the type constructor in
mpj_3.m:026: the argument vector of this instance declaration for it, namely
mpj_3.m:026: `mpj_3.stringlist'/0, are all visible outside this module, which
mpj_3.m:026: means that this instance can be relevant outside this module.
mpj_3.m:026: Keeping it private to this module is therefore likely to be a
mpj_3.m:026: mistake.
mpj_3.m:027: Error: inconsistent instance declaration for typeclass
mpj_3.m:027: `mpj_3.coll'/2 with functional dependency `(C -> E)'.
mpj_3.m:025: Here is the conflicting instance.
mpj_3.m:027: Warning: the type class `mpj_3.coll'/2 and the type constructor in
mpj_3.m:027: the argument vector of this instance declaration for it, namely
mpj_3.m:027: `mpj_3.intlist'/0, are all visible outside this module, which
mpj_3.m:027: means that this instance can be relevant outside this module.
mpj_3.m:027: Keeping it private to this module is therefore likely to be a
mpj_3.m:027: mistake.