-
-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(errors): make verrors=context global and update test outputs #17085
Conversation
Thanks for your pull request and interest in making D better, @royalpinto007! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#17085" |
17c012d
to
467933c
Compare
467933c
to
e9d3051
Compare
0081e4e
to
e3d8e37
Compare
Was it decided somewhere that this should become the default? I prefer the current default, and don't like how this makes the test suite harder to maintain. |
61d3006
to
18a28ac
Compare
Don't think so, but we are one of not many languages still not doing the squiggle by default. That debate aside, the last time I think someone (hatf0 I think) tried to turn it a bunch of things blew up so I asked @royalpinto007 to look into just to see how things were going on that front. |
18a28ac
to
f079c7c
Compare
I like this PR With the code example, i know exactly what's wrong without having to decipher a lengthily message I use Zig a lot and this is so much better |
8df6f29
to
ffd4b87
Compare
a3b801e
to
bc982a6
Compare
I need some help with the |
5808d4e
to
222a468
Compare
Signed-off-by: royalpinto007 <[email protected]>
222a468
to
3fa3274
Compare
ping @maxhaton please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's a good idea to switch the default, I'll bring that up tomorrow in the DLF monthly meeting.
However, the test suite doesn't have to use the default. It's interesting to see what all these errors now look like with -verrors=context, but it also makes me notice that often, the column location is wrong. So this is very useful to spot all the places where error locations can be improved, but perhaps we shouldn't promote -verrors=context yet while it's inaccurate so many times.
I also notice the way the tests are updated is that #line
markers are removed and all test output blocks are merged and put at the beginning. This means that now, a small change in the test will cause a large diff in a big output block. The original structure was supposed to prevent that. I have been working on a special test runner directive that allows local, line number-independent error messages: #14515
In any case, I don't think the 5000 new copied lines of code with an error are worth adding to the test suite.
this.index = 0; | ||
this.eolIndex = 0; | ||
this.nextIndex = 0; | ||
} | ||
|
||
public bool empty() { return index == text.length; } | ||
public bool empty() { advance(); return index >= text.length; } | ||
|
||
public void popFront() { advance(); index = nextIndex; } | ||
|
||
public const(char)[] front() { advance(); return text[index .. eolIndex]; } | ||
public const(char)[] front() | ||
{ | ||
advance(); | ||
if (index > eolIndex || index >= text.length) { | ||
return ""; | ||
} | ||
return text[index .. eolIndex]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this change for, does this PR uncover a bug in splitLines
?
--- | ||
*/ | ||
|
||
#line 1 | ||
// Line 1 starts here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it doesn't, this comment makes no sense when there's no #line 1
directive anymore
compilable/b16976.d(73): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach(int i, v; dyn) { } | ||
^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caret is in the wrong position
compilable/compile1.d(232): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead | ||
cdouble c6096; | ||
^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caret is in the wrong position
compilable/sw_transition_complex.d(39): Deprecation: use of imaginary type `idouble*` is deprecated, use `double` instead | ||
compilable/sw_transition_complex.d(40): Deprecation: use of imaginary type `ifloat*` is deprecated, use `float` instead | ||
--- | ||
*/ | ||
creal* c80pointer; | ||
cdouble* c64pointer; | ||
cfloat* c32pointer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The messages are no longer local to the relevant code.
@@ -0,0 +1,33 @@ | |||
Make `verror=context` Usage Global and Update Related Test Files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make `verror=context` Usage Global and Update Related Test Files | |
Enable `-verrors=context` by default |
Test suite changes are irrelevant to users.
@@ -0,0 +1,33 @@ | |||
Make `verror=context` Usage Global and Update Related Test Files | |||
|
|||
The `verror=context` error handling mechanism has been made global, ensuring that error messages now consistently include context information across the entire codebase. Previously, error handling was localized, leading to some errors lacking context in the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a weird description: all -verrors=context does is print the line of code the error applies to under the message. It has nothing to do with 'across the entire codebase' vs 'localized'.
Consensus: enable this for users, disable it in almost all of the test suite for visual noise. @royalpinto007 thank you very much for updating the tests though. We can't enable it without making sure it works acorss the whole test suite without blowing up! Now we can. Can we name the option to turn it off |
Make
verror=context
usage global and update related test files accordingly.