mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
compiler/pred_table.m:
When printing a diagnostic about unresolved overloading, don't print
"predicate" when the overloading involves functions, but do print the
sym_name whose lookup "failed" by having more than one match.
This requires our callers to pass a predicate vs function indication
and the sym_name that were the input to that lookup.
Print the possible matches one per line. Don't specify the pred vs func
for each match, since this is implicit in what we searched for.
compiler/intermod_decide.m:
compiler/resolve_unify_functor.m:
Pass the extra info.
tests/invalid_submodules/unresolved_overloading.m:
Shorten some names in this module to make the diagnostic output
more readable.
tests/invalid_submodules/unresolved_overloading.err_exp:
Expect updated diagnostics.
56 lines
1.4 KiB
Mathematica
56 lines
1.4 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Test that the compiler gives a half decent error message when it is
|
|
% unable to resolve predicate overloading in this module.
|
|
%
|
|
|
|
:- module unresolved_overloading.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module unresolved_overloading.sub.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
main(!IO) :-
|
|
annoying(gibbon, !IO).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- typeclass gibbon(T) where [].
|
|
|
|
:- type gibbon
|
|
---> gibbon.
|
|
:- instance gibbon(gibbon) where [].
|
|
|
|
:- pred annoying(T::in, io::di, io::uo) is det <= gibbon(T).
|
|
|
|
annoying(_, !IO).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module unresolved_overloading.sub.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- typeclass howler_monkey(T) where [].
|
|
|
|
:- pred annoying(T::in, io::di, io::uo) is det <= howler_monkey(T).
|
|
|
|
:- implementation.
|
|
|
|
annoying(_, !IO).
|
|
|
|
:- end_module unresolved_overloading.sub.
|