mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23: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.5 KiB
1.5 KiB
mpj_4.m:023: Warning: the type class `mpj_4.coll'/2 and the type constructor in
mpj_4.m:023: the argument vector of this instance declaration for it, namely
mpj_4.m:023: `mpj_4.intlist'/0, are all visible outside this module, which
mpj_4.m:023: means that this instance can be relevant outside this module.
mpj_4.m:023: Keeping it private to this module is therefore likely to be a
mpj_4.m:023: mistake.
mpj_4.m:024: Warning: the type class `mpj_4.coll'/2 and the type constructor in
mpj_4.m:024: the argument vector of this instance declaration for it, namely
mpj_4.m:024: `mpj_4.stringlist'/0, are all visible outside this module, which
mpj_4.m:024: means that this instance can be relevant outside this module.
mpj_4.m:024: Keeping it private to this module is therefore likely to be a
mpj_4.m:024: mistake.
mpj_4.m:028: In clause for function `g'/1:
mpj_4.m:028: in function result term of clause head:
mpj_4.m:028: in argument 2 of functor `f/3':
mpj_4.m:028: type error in unification of argument
mpj_4.m:028: and constant `"foo"'.
mpj_4.m:028: Argument has type
mpj_4.m:028: int,
mpj_4.m:028: constant `"foo"' has type
mpj_4.m:028: string.
mpj_4.m:028: The partial type assignment was:
mpj_4.m:028: HeadVar__2_2: mpj_4.intlist
mpj_4.m:028: L_3: mpj_4.intlist
mpj_4.m:028: V_4: int
mpj_4.m:028: V_5: int
mpj_4.m:023: the argument vector of this instance declaration for it, namely
mpj_4.m:023: `mpj_4.intlist'/0, are all visible outside this module, which
mpj_4.m:023: means that this instance can be relevant outside this module.
mpj_4.m:023: Keeping it private to this module is therefore likely to be a
mpj_4.m:023: mistake.
mpj_4.m:024: Warning: the type class `mpj_4.coll'/2 and the type constructor in
mpj_4.m:024: the argument vector of this instance declaration for it, namely
mpj_4.m:024: `mpj_4.stringlist'/0, are all visible outside this module, which
mpj_4.m:024: means that this instance can be relevant outside this module.
mpj_4.m:024: Keeping it private to this module is therefore likely to be a
mpj_4.m:024: mistake.
mpj_4.m:028: In clause for function `g'/1:
mpj_4.m:028: in function result term of clause head:
mpj_4.m:028: in argument 2 of functor `f/3':
mpj_4.m:028: type error in unification of argument
mpj_4.m:028: and constant `"foo"'.
mpj_4.m:028: Argument has type
mpj_4.m:028: int,
mpj_4.m:028: constant `"foo"' has type
mpj_4.m:028: string.
mpj_4.m:028: The partial type assignment was:
mpj_4.m:028: HeadVar__2_2: mpj_4.intlist
mpj_4.m:028: L_3: mpj_4.intlist
mpj_4.m:028: V_4: int
mpj_4.m:028: V_5: int