-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Error and ICE reporting tweaks #15907
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
Changes from all commits
3286c9e
78854ec
887ec85
e899fb9
688bd0d
36ec42d
c422fa5
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 |
---|---|---|
|
@@ -197,15 +197,15 @@ void CommonSyntaxTest::printErrorList( | |
for (auto const& error: _errorList) | ||
{ | ||
{ | ||
util::AnsiColorized scope( | ||
util::AnsiColorized formattedStream( | ||
_stream, | ||
_formatted, | ||
{BOLD, SourceReferenceFormatter::errorTextColor(Error::errorSeverity(error.type))} | ||
); | ||
_stream << _linePrefix << Error::formatErrorType(error.type); | ||
formattedStream << _linePrefix << Error::formatErrorType(error.type); | ||
if (error.errorId.has_value()) | ||
_stream << ' ' << error.errorId->error; | ||
_stream << ": "; | ||
formattedStream << ' ' << error.errorId->error; | ||
formattedStream << ": "; | ||
} | ||
Comment on lines
-200
to
209
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 one does not actually fix anything but I decided to change it to be less of a head-scratcher. We usually output to the ANSI stream using |
||
if (!error.sourceName.empty() || error.locationStart >= 0 || error.locationEnd >= 0) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--via-ir --bin |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Error: Cannot swap Variable value23 with Slot 0x20: too deep in the stack by 9 slots in [ RET value23 value22 value21 value20 value19 value18 value17 value16 value15 value14 value13 value12 value11 value10 value9 value8 value7 value6 value5 value4 value3 value2 value1 value0 pos 0x20 ] | ||
memoryguard was present. | ||
--> stack_too_deep_from_code_transform/input.sol:1:1: | ||
| | ||
1 | contract C { | ||
| ^ (Relevant source part starts here and spans across multiple lines). | ||
Comment on lines
+1
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. This is what it looked like before the change:
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
contract C { | ||
function f() public { | ||
uint b; | ||
abi.encodePacked( | ||
b, b, b, b, b, b, b, b, | ||
b, b, b, b, b, b, b, b, | ||
b, b, b, b, b, b, b, b | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
"component": "general", | ||
"errorCode": "2904", | ||
"formattedMessage": "DeclarationError: Declaration \"A\" not found in \"\" (referenced as \".\"). | ||
--> :2:24: | ||
| | ||
2 | pragma solidity >=0.0; import {A} from \".\"; | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
Comment on lines
6
to
+10
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. Note that this affects also the errors reported by the assert in Instead of this:
we'll now see this:
Another thing it affects are Yul test case variants that use the empty name for the source they parse and don't allow errors in expectations. The formatted errors are instead included in the exception they throw. |
||
|
||
", | ||
"message": "Declaration \"A\" not found in \"\" (referenced as \".\").", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
contract C { | ||
function f() public { | ||
uint b; | ||
abi.encodePacked( | ||
b, b, b, b, b, b, b, b, | ||
b, b, b, b, b, b, b, b, | ||
b, b, b, b, b, b, b, b | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"in.sol": {"urls": ["standard_stack_too_deep_from_code_transform/in.sol"]} | ||
}, | ||
"settings": { | ||
"viaIR": true, | ||
"outputSelection": { | ||
"*": {"*": ["evm.bytecode"]} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"component": "general", | ||
"formattedMessage": "YulException: Cannot swap Variable value23 with Slot 0x20: too deep in the stack by 9 slots in [ RET value23 value22 value21 value20 value19 value18 value17 value16 value15 value14 value13 value12 value11 value10 value9 value8 value7 value6 value5 value4 value3 value2 value1 value0 pos 0x20 ] | ||
memoryguard was present. | ||
--> in.sol:1:1: | ||
| | ||
1 | contract C { | ||
| ^ (Relevant source part starts here and spans across multiple lines). | ||
|
||
", | ||
"message": "Cannot swap Variable value23 with Slot 0x20: too deep in the stack by 9 slots in [ RET value23 value22 value21 value20 value19 value18 value17 value16 value15 value14 value13 value12 value11 value10 value9 value8 value7 value6 value5 value4 value3 value2 value1 value0 pos 0x20 ] | ||
memoryguard was present.", | ||
"severity": "error", | ||
"sourceLocation": { | ||
"end": 206, | ||
"file": "in.sol", | ||
"start": 0 | ||
}, | ||
"type": "YulException" | ||
} | ||
], | ||
"sources": { | ||
"in.sol": { | ||
"id": 0 | ||
} | ||
} | ||
} |
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.
We should simplify this one day and make all assert macros throw
InternalCompilerError
. Having different types and even documenting them in Error types just unnecessarily exposes implementation details to the user. We should only have compilation errors there. It's especially confusing when things likeSMTLogicError
are actually failed assertions.