[m-dev.] preferences for error contexts
Peter Wang
novalazy at gmail.com
Fri May 15 14:55:50 AEST 2009
Hi,
We have some ugly error messages due to the way we use mmc -f, where
the filename and line number context ends up taking up most of the screen
width (don't ask). Something like this:
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: In clause for
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: predicate
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: `propagate3'/7:
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: in argument 3 of
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: call to predicate
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: `map.search'/3:
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: type error:
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: variable `I' has
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: type
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535:
`(set.set((lalr.item)))',
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: expected type was
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535:
`(tree234.tree234((lalr.item),
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535:
(set.set((grammar.terminal)))))'.
I have a change that prints the context only on the first line.
The output ends up like:
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:535: In clause for
predicate `propagate3'/7:
in argument 3 of call to predicate `map.search'/3:
type error:
variable `I' has type `set.set(lalr.item)',
expected type was `tree234.tree234(lalr.item, set.set(grammar.terminal))'.
/home/pwa/Work/gws_shorter_errors/extras/moose/lalr.m:538: In clause for
predicate `propagate3'/7:
in argument 1 of call to predicate `map.init'/1:
type error:
variable `X1' has type `set.set(lalr.item)',
expected type was `tree234.tree234(V_V_1, V_V_2)'.
Currently this change would only kick in when the context is "too long".
However, one unexpected benefit is that in vim the :cn, :cp commands will
skip directly from one error to the next without going through the
intermediate lines, so maybe the new format should be used even for short
contexts? On the other hand, the existing format is probably more readable
when the context is short.
I'd rather not add another option to choose.
Peter
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions: mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the developers
mailing list