-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 commentThe 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'. |
||
|
||
Example: | ||
``` | ||
void main() | ||
{ | ||
int[int] a = []; | ||
int[int] b = [2:3, 4]; | ||
a = []; | ||
} | ||
``` | ||
|
||
**Before Global `verror=context`:** | ||
``` | ||
fail_compilation/aa_init.d(13,18): Error: invalid associative array initializer `[]`, use `null` instead | ||
fail_compilation/aa_init.d(14,24): Error: missing key for value `4` in initializer | ||
fail_compilation/aa_init.d(15,9): Error: cannot implicitly convert expression `[]` of type `void[]` to `int[int]` | ||
``` | ||
|
||
**After Global `verror=context`:** | ||
``` | ||
fail_compilation/aa_init.d(19,18): Error: invalid associative array initializer `[]`, use `null` instead | ||
int[int] a = []; | ||
^ | ||
fail_compilation/aa_init.d(20,24): Error: missing key for value `4` in initializer | ||
int[int] b = [2:3, 4]; | ||
^ | ||
fail_compilation/aa_init.d(21,9): Error: cannot implicitly convert expression `[]` of type `void[]` to `int[int]` | ||
a = []; | ||
^ | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -365,13 +365,23 @@ | |
public this(const char[] text) | ||
{ | ||
this.text = text; | ||
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]; | ||
} | ||
Comment on lines
+368
to
+384
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this change for, does this PR uncover a bug in |
||
|
||
private void advance() | ||
{ | ||
|
@@ -418,7 +428,7 @@ | |
if (i + 2 < text.length && | ||
text[i + 1] == 0x80 && | ||
(text[i + 2] == 0xA8 || text[i + 2] == 0xA9) | ||
) | ||
) | ||
{ | ||
eolIndex = i; | ||
nextIndex = i + 3; | ||
|
@@ -430,6 +440,10 @@ | |
break; | ||
} | ||
} | ||
|
||
// No newline found; set indices to the end of the text | ||
eolIndex = text.length; | ||
nextIndex = text.length; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,66 @@ | ||
/* REQUIRED_ARGS: -m64 | ||
TEST_OUTPUT: | ||
--- | ||
compilable/b16976.d(33): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(34): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(35): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(36): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(41): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(42): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(43): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(44): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(50): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(51): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(52): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(53): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(58): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(59): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(60): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(61): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(62): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(63): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
compilable/b16976.d(64): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(65): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
compilable/b16976.d(73): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach(int i, v; dyn) { } | ||
^ | ||
Comment on lines
+4
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Caret is in the wrong position |
||
compilable/b16976.d(74): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach_reverse(int i, v; dyn) { } | ||
^ | ||
compilable/b16976.d(75): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach(char i, v; dyn) { } | ||
^ | ||
compilable/b16976.d(76): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach_reverse(char i, v; dyn) { } | ||
^ | ||
compilable/b16976.d(81): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach(int i, v; str) { } | ||
^ | ||
compilable/b16976.d(82): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach_reverse(int i, v; str) { } | ||
^ | ||
compilable/b16976.d(83): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach(char i, v; str) { } | ||
^ | ||
compilable/b16976.d(84): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach_reverse(char i, v; str) { } | ||
^ | ||
compilable/b16976.d(90): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach(int i, dchar v; dyn) { } | ||
^ | ||
compilable/b16976.d(91): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach_reverse(int i, dchar v; dyn) { } | ||
^ | ||
compilable/b16976.d(92): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach(char i, dchar v; dyn) { } | ||
^ | ||
compilable/b16976.d(93): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach_reverse(char i, dchar v; dyn) { } | ||
^ | ||
compilable/b16976.d(98): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach(int i, dchar v; str) { } | ||
^ | ||
compilable/b16976.d(99): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach_reverse(int i, dchar v; str) { } | ||
^ | ||
compilable/b16976.d(100): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach(char i, dchar v; str) { } | ||
^ | ||
compilable/b16976.d(101): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach_reverse(char i, dchar v; str) { } | ||
^ | ||
compilable/b16976.d(102): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach(int i, dchar v; chr) { } | ||
^ | ||
compilable/b16976.d(103): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` | ||
foreach_reverse(int i, dchar v; chr) { } | ||
^ | ||
compilable/b16976.d(104): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach(char i, dchar v; chr) { } | ||
^ | ||
compilable/b16976.d(105): Deprecation: foreach: loop index implicitly converted from `size_t` to `char` | ||
foreach_reverse(char i, dchar v; chr) { } | ||
^ | ||
--- | ||
*/ | ||
void main() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ | |
// EXTRA_FILES: imports/a12506.d | ||
/* TEST_OUTPUT: | ||
--- | ||
compilable/compile1.d(230): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead | ||
compilable/compile1.d(232): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead | ||
cdouble c6096; | ||
^ | ||
Comment on lines
+6
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Caret is in the wrong position |
||
--- | ||
*/ | ||
|
||
|
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.
Test suite changes are irrelevant to users.