Closes #2282 (closed).
The formats changed a bit from what was initially proposed. The formats are now as follows:
No location info:
Error:
<error message here>
File name and line number:
<filename>:<line_number> Error:
<error message here>
File name, line number and column:
<filename>:<line_number>:<column> Error:
<error message here>
This format is applied to Abort, Error, Warning, and to NoteLine. Note and State remain unchanged as the calling code doesn't intend for "Note:" to appear everywhere. NoteLine is an exception to this because it seems to fit well in existing cases.
The first line never explicitly wraps to account for the console size. The message contents, however, are wrapped by the code to fit in the console more nicely. When the message content spans multiple lines, all lines are prefixed with an indent of 2 spaces.
There are three more things I'd like to address before this is merged.
First, I would like to get a test case where the type checker outputs multiple errors before aborting.
The current test case outputs what's displayed below, but to properly test CTIgetErrorMessageVA
and CTIabortOnBottom
, I need an additional error to be thrown before it aborts.
I haven't found a way to produce an error such an error yet, so it'd be great if someone else could try their hand at it.
./errors/test-type_inference_error.sac:9 Error:
All instances of "main" contain type errors
./errors/test-type_inference_error.sac:11 Error:
inferred type int[1]{0} should match declared type int
Compilation failed while Running type inference system, 1 error(s).
Second, if I'm not mistaken we can mark nearly all method arguments as const
, so if no one sees problems with that, I would like to do that as well.
Third, CTIwarnContinued currently sees no use. Do we want to keep it in case anyone ever finds a use for it, or can we remove it?