mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 13:53:54 +00:00
Estimated hours taken: 14
Branches: main
When printing messages about errors involving overloaded types, print each
type only once.
compiler/typecheck.m:
Detect and eliminate duplicate type names in error messages about
overloaded types.
When a variable has more than one type, print each type on a line of
its own, to make the output easier to read. (Since type names currently
have too many parentheses, further improvements are still possible.)
compiler/mercury_to_mercury.m:
Provide a mechanism to turn a type into a string without printing it,
so that it can be checked againt the representations of other types.
This required changing many of the predicates in this module so that
instead of doing I/O directly, they go through a typeclass interface
which has two implementations: one does I/O while the other gathers
output in a string.
The performance impact of this change should be acceptable, since I/O
is slow compared to computation anyway.
compiler/purity.m:
Provide a predicate that returns a purity prefix as a string, to
accompany another that prints it out.
compiler/check_typeclass.m:
compiler/prog_util.m:
Minor changes to conform to the naming scheme now used in
mercury_to_mercury.m, in particular to the fact the operations of the
form x_to_string are now functions, not predicates.
The functionality of prog_util should be unaffected. In check_typeclass
we may now print more detailed error messages than before.
library/string.m:
Declare the outputs append, append_list and join_list to be unique.
Their implementations already return unique strings; declaring them to
be unique help avoid redundant copying in mercury_to_mercury.m.
library/term_io.m:
Add alternative versions of some output predicates that return their
"output" in a string instead.
Factor out some common code.
tests/invalid/overloading.{m,exp}:
A test exercising the error message affected by the change.
tests/invalid/Mmakefile:
Enable the new test.
NEWS:
Announce the changes in the library.
30 lines
2.4 KiB
Plaintext
30 lines
2.4 KiB
Plaintext
overloading.m:050: In clause for predicate `overloading:p/4':
|
|
overloading.m:050: in unification of variable `OptInfo'
|
|
overloading.m:050: and term `opt_info(MustHaveOwnSlot, EverOnStack, CurIntervalId, V_17, Counter1, StartMap0, EndMap0, VarsMap0, SuccMap0)':
|
|
overloading.m:050: type error in argument(s) of functor `opt_info/9'.
|
|
overloading.m:050: variable `OptInfo' has type `(overloading:opt_info)',
|
|
overloading.m:050: functor `opt_info/9' has type
|
|
overloading.m:050: `opt_info((set:set((term:var((term:generic))))), (set:set((term:var((term:generic))))), (tree234:tree234((term:var((term:generic))), (tree234:tree234((overloading:goal_path), string)))), (overloading:interval_id), (counter:counter), (tree234:tree234((overloading:interval_id), (overloading:anchor))), (tree234:tree234((overloading:interval_id), (overloading:anchor))), (tree234:tree234((overloading:interval_id), (set:set((term:var((term:generic))))))), (tree234:tree234((overloading:interval_id), (list:list((overloading:interval_id)))))) :: (overloading:opt_info)',
|
|
overloading.m:050: variable `MustHaveOwnSlot' has type `(set:set((term:var((term:generic)))))',
|
|
overloading.m:050: variable `EverOnStack' has type `(set:set((term:var((term:generic)))))',
|
|
overloading.m:050: variable `CurIntervalId' has type `(overloading:interval_id)',
|
|
overloading.m:050: argument has type `'<any>'',
|
|
overloading.m:050: variable `Counter1' has type `(counter:counter)',
|
|
overloading.m:050: variable `StartMap0' has overloaded type {
|
|
overloading.m:050: (pred (tree234:tree234(V_V_1, V_V_2))),
|
|
overloading.m:050: (tree234:tree234(K, V))
|
|
overloading.m:050: },
|
|
overloading.m:050: variable `EndMap0' has overloaded type {
|
|
overloading.m:050: (pred (tree234:tree234((overloading:interval_id), (overloading:anchor)))),
|
|
overloading.m:050: (tree234:tree234((overloading:interval_id), (overloading:anchor)))
|
|
overloading.m:050: },
|
|
overloading.m:050: variable `VarsMap0' has overloaded type {
|
|
overloading.m:050: (pred (tree234:tree234((overloading:interval_id), (set:set((term:var((term:generic)))))))),
|
|
overloading.m:050: (tree234:tree234((overloading:interval_id), (set:set((term:var((term:generic)))))))
|
|
overloading.m:050: },
|
|
overloading.m:050: variable `SuccMap0' has overloaded type {
|
|
overloading.m:050: (pred (tree234:tree234(V_V_1, V_V_2))),
|
|
overloading.m:050: (tree234:tree234(K, V))
|
|
overloading.m:050: }.
|
|
For more information, try recompiling with `-E'.
|