Page 1 of 2
file.cobra(11): error: twice in error messages.
Posted:
Sun Jul 04, 2010 7:17 am
by nevdelap
Hi Chuck. I searched for "error twice", couldn't think of anything, maybe it's already been touched on...
I wonder why the duplication of filename, line number and "error:" in error messages that want to tell us the column?
test.cobra(11): error: test.cobra(11,1): error: Cannot mix tabs and...
rather than...
test.cobra(11,1): error: Cannot mix tabs and...
Re: file.cobra(11): error: twice in error messages.
Posted:
Sun Jul 04, 2010 9:36 am
by Charles
Looks like a bug. Other errors I tried don't have this problem, so it may only be happening for errors generated by the parser. Another ticket, please.
Re: file.cobra(11): error: twice in error messages.
Posted:
Mon Jul 05, 2010 3:35 pm
by nevdelap
Done. I'd thought it might have something to do with tools reading the compiler output so I wanted to check before ticketing. #212.
Re: file.cobra(11): error: twice in error messages.
Posted:
Thu Jul 08, 2010 4:05 am
by hopscc
patch for this on the ticket (
ticket:212)
Re: file.cobra(11): error: twice in error messages.
Posted:
Thu Jul 08, 2010 2:13 pm
by Charles
This bug is now fixed and ticket is closed.
Re: file.cobra(11): error: twice in error messages.
Posted:
Fri Jul 09, 2010 9:35 am
by hopscc
The fix dropped display of column number an error was detected on (where available) - probably an unintended regression
nevdelap discovered and reported against ticket.
I reopened the ticket and posted a patch that continues to provide the column info if available.
Re: file.cobra(11): error: twice in error messages.
Posted:
Fri Jul 09, 2010 2:02 pm
by Charles
I vaguely recall not reporting column info in Cobra errors early on because Cobra wasn't counting out the tabs, so the column didn't really match what I saw in my editor. Maybe we added that at some point and I've forgotten. Are those column numbers correct in your editor?
Re: file.cobra(11): error: twice in error messages.
Posted:
Sat Jul 10, 2010 3:30 am
by hopscc
Yeah pretty much.
Re: file.cobra(11): error: twice in error messages.
Posted:
Sun Jul 11, 2010 7:44 pm
by Charles
When I try an error from one of the binding phases like "x = badname", I get:
foo.cobra(5): error: Cannot find "badname".
I'm now more certain that column info was left out because it does match editors. When I'm three tabs over, my editors tell me I'm on column 13, not 4 which is what Cobra would tell me.
Re: file.cobra(11): error: twice in error messages.
Posted:
Sun Jul 11, 2010 11:07 pm
by hopscc
Presumably you mean 'does not match editors'.
Cobra cant ever be correct for this (without talking to your editor) because it depends on what your tab expansion is set to in your editor
- at best if you want to try and virtualise this you assume a tab expansion of 4 (which is what cobra seems to equate with spaces ) and accumulate a Tab count and multiply the number of Tabs by that
- fine if it is correct to the editor settings really confusing if not. And I'm sure I'm not the only one who just loves it when a compiler lies to you.....
On the other hand you could do what every compiler has done since the first one was carved from primordial mud and just quote the character count offset from the start of the line (4 in your example)
and assume the user/developer can work it out.
Most serious programming editors have a mode or command that will give you this on a line (char offset vs display offset) -
Its just one of the things you have to know how to handle if you use/allow Tabs in source code...
Its still needed because it gives the user at least an inkling to exactly where on a line the compiler thinks it detected the problem which may or may not be obvious from the rest of the error message....