mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +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.7 KiB
1.7 KiB
method_impl.m:025: Warning: the type class `method_impl.c'/1 and the type
method_impl.m:025: constructor in the argument vector of this instance
method_impl.m:025: declaration for it, namely `method_impl.foo'/0, are all
method_impl.m:025: visible outside this module, which means that this
method_impl.m:025: instance can be relevant outside this module. Keeping it
method_impl.m:025: private to this module is therefore likely to be a
method_impl.m:025: mistake.
method_impl.m:026: In clause for instance method predicate `m1'/2:
method_impl.m:026: in argument 2 of predicate `method_impl.foo_m1'/2:
method_impl.m:026: type error: variable `HeadVar__2' has type
method_impl.m:026: int;
method_impl.m:026: expected type was
method_impl.m:026: string.
method_impl.m:026: The partial type assignment was:
method_impl.m:026: HeadVar__1_1: method_impl.foo
method_impl.m:026: HeadVar__2_2: int
method_impl.m:028: Warning: the type class `method_impl.c'/1 and the type
method_impl.m:028: constructor in the argument vector of this instance
method_impl.m:028: declaration for it, namely `method_impl.bar'/0, are all
method_impl.m:028: visible outside this module, which means that this
method_impl.m:028: instance can be relevant outside this module. Keeping it
method_impl.m:028: private to this module is therefore likely to be a
method_impl.m:028: mistake.
method_impl.m:029: In clause for instance method predicate `m1'/2:
method_impl.m:029: error: call to undefined predicate `bar_m1'/2.
method_impl.m:025: constructor in the argument vector of this instance
method_impl.m:025: declaration for it, namely `method_impl.foo'/0, are all
method_impl.m:025: visible outside this module, which means that this
method_impl.m:025: instance can be relevant outside this module. Keeping it
method_impl.m:025: private to this module is therefore likely to be a
method_impl.m:025: mistake.
method_impl.m:026: In clause for instance method predicate `m1'/2:
method_impl.m:026: in argument 2 of predicate `method_impl.foo_m1'/2:
method_impl.m:026: type error: variable `HeadVar__2' has type
method_impl.m:026: int;
method_impl.m:026: expected type was
method_impl.m:026: string.
method_impl.m:026: The partial type assignment was:
method_impl.m:026: HeadVar__1_1: method_impl.foo
method_impl.m:026: HeadVar__2_2: int
method_impl.m:028: Warning: the type class `method_impl.c'/1 and the type
method_impl.m:028: constructor in the argument vector of this instance
method_impl.m:028: declaration for it, namely `method_impl.bar'/0, are all
method_impl.m:028: visible outside this module, which means that this
method_impl.m:028: instance can be relevant outside this module. Keeping it
method_impl.m:028: private to this module is therefore likely to be a
method_impl.m:028: mistake.
method_impl.m:029: In clause for instance method predicate `m1'/2:
method_impl.m:029: error: call to undefined predicate `bar_m1'/2.