mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7368 from ethereum/errorReporter
Switch to new error reporter.
This commit is contained in:
commit
9c72f25cce
@ -6,6 +6,7 @@ Breaking changes:
|
||||
* Commandline interface: remove the text-based ast printer (``--ast``).
|
||||
* General: Disallow explicit conversions from external function types to ``address`` and add a member called ``address`` to them as replacement.
|
||||
* Type checker: Resulting type of exponentiation is equal to the type of the base. Also allow signed types for the base.
|
||||
* Command line interface: Switch to the new error reporter by default. ``--old-reporter`` falls back to the deprecated old error reporter.
|
||||
|
||||
|
||||
Language Features:
|
||||
|
@ -149,7 +149,7 @@ static string const g_strVersion = "version";
|
||||
static string const g_strIgnoreMissingFiles = "ignore-missing";
|
||||
static string const g_strColor = "color";
|
||||
static string const g_strNoColor = "no-color";
|
||||
static string const g_strNewReporter = "new-reporter";
|
||||
static string const g_strOldReporter = "old-reporter";
|
||||
|
||||
static string const g_argAbi = g_strAbi;
|
||||
static string const g_argPrettyJson = g_strPrettyJson;
|
||||
@ -189,7 +189,7 @@ static string const g_stdinFileName = g_stdinFileNameStr;
|
||||
static string const g_argIgnoreMissingFiles = g_strIgnoreMissingFiles;
|
||||
static string const g_argColor = g_strColor;
|
||||
static string const g_argNoColor = g_strNoColor;
|
||||
static string const g_argNewReporter = g_strNewReporter;
|
||||
static string const g_argOldReporter = g_strOldReporter;
|
||||
|
||||
/// Possible arguments to for --combined-json
|
||||
static set<string> const g_combinedJsonArgs
|
||||
@ -704,7 +704,7 @@ Allowed options)",
|
||||
)
|
||||
(g_argColor.c_str(), "Force colored output.")
|
||||
(g_argNoColor.c_str(), "Explicitly disable colored output, disabling terminal auto-detection.")
|
||||
(g_argNewReporter.c_str(), "Enables new diagnostics reporter.")
|
||||
(g_argOldReporter.c_str(), "Enables old diagnostics reporter.")
|
||||
(g_argErrorRecovery.c_str(), "Enables additional parser error recovery.")
|
||||
(g_argIgnoreMissingFiles.c_str(), "Ignore missing files.");
|
||||
po::options_description outputComponents("Output Components");
|
||||
@ -926,10 +926,10 @@ bool CommandLineInterface::processInput()
|
||||
m_compiler.reset(new CompilerStack(fileReader));
|
||||
|
||||
unique_ptr<SourceReferenceFormatter> formatter;
|
||||
if (m_args.count(g_argNewReporter))
|
||||
formatter = make_unique<SourceReferenceFormatterHuman>(serr(false), m_coloredOutput);
|
||||
else
|
||||
if (m_args.count(g_argOldReporter))
|
||||
formatter = make_unique<SourceReferenceFormatter>(serr(false));
|
||||
else
|
||||
formatter = make_unique<SourceReferenceFormatterHuman>(serr(false), m_coloredOutput);
|
||||
|
||||
try
|
||||
{
|
||||
@ -1302,10 +1302,10 @@ bool CommandLineInterface::assemble(
|
||||
{
|
||||
auto const& stack = sourceAndStack.second;
|
||||
unique_ptr<SourceReferenceFormatter> formatter;
|
||||
if (m_args.count(g_argNewReporter))
|
||||
formatter = make_unique<SourceReferenceFormatterHuman>(serr(false), m_coloredOutput);
|
||||
else
|
||||
if (m_args.count(g_argOldReporter))
|
||||
formatter = make_unique<SourceReferenceFormatter>(serr(false));
|
||||
else
|
||||
formatter = make_unique<SourceReferenceFormatterHuman>(serr(false), m_coloredOutput);
|
||||
|
||||
for (auto const& error: stack.errors())
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ function compileFull()
|
||||
set +e
|
||||
"$SOLC" $FULLARGS $files >/dev/null 2>"$stderr_path"
|
||||
local exit_code=$?
|
||||
local errors=$(grep -v -E 'Warning: This is a pre-release compiler version|Warning: Experimental features are turned on|pragma experimental ABIEncoderV2|\^-------------------------------\^' < "$stderr_path")
|
||||
local errors=$(grep -v -E 'Warning: This is a pre-release compiler version|Warning: Experimental features are turned on|pragma experimental ABIEncoderV2|^ +--> |^ +\||^[0-9]+ +\|' < "$stderr_path")
|
||||
set -e
|
||||
rm "$stderr_path"
|
||||
|
||||
@ -143,9 +143,9 @@ function test_solc_behaviour()
|
||||
|
||||
if [[ "$solc_args" == *"--standard-json"* ]]
|
||||
then
|
||||
sed -i -e 's/{[^{]*Warning: This is a pre-release compiler version[^}]*},\{0,1\}//' "$stdout_path"
|
||||
sed -i.bak -e 's/{[^{]*Warning: This is a pre-release compiler version[^}]*},\{0,1\}//' "$stdout_path"
|
||||
sed -i.bak -E -e 's/ Consider adding \\"pragma solidity \^[0-9.]*;\\"//g' "$stdout_path"
|
||||
sed -i -e 's/"errors":\[\],\{0,1\}//' "$stdout_path"
|
||||
sed -i.bak -e 's/"errors":\[\],\{0,1\}//' "$stdout_path"
|
||||
# Remove explicit bytecode and references to bytecode offsets
|
||||
sed -i.bak -E -e 's/\"object\":\"[a-f0-9]+\"/\"object\":\"bytecode removed\"/g' "$stdout_path"
|
||||
sed -i.bak -E -e 's/\"opcodes\":\"[^"]+\"/\"opcodes\":\"opcodes removed\"/g' "$stdout_path"
|
||||
@ -154,13 +154,18 @@ function test_solc_behaviour()
|
||||
sed -i.bak -E -e 's/\\n/\'$'\n/g' "$stdout_path"
|
||||
rm "$stdout_path.bak"
|
||||
else
|
||||
sed -i -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
|
||||
sed -i -e 's/ Consider adding "pragma .*$//' "$stderr_path"
|
||||
sed -i.bak -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
|
||||
sed -i.bak -e 's/ Consider adding "pragma .*$//' "$stderr_path"
|
||||
# Remove trailing empty lines. Needs a line break to make OSX sed happy.
|
||||
sed -i.bak -e '1{/^$/d
|
||||
}' "$stderr_path"
|
||||
rm "$stderr_path.bak"
|
||||
fi
|
||||
# Remove path to cpp file
|
||||
sed -i -e 's/^\(Exception while assembling:\).*/\1/' "$stderr_path"
|
||||
sed -i.bak -e 's/^\(Exception while assembling:\).*/\1/' "$stderr_path"
|
||||
# Remove exception class name.
|
||||
sed -i -e 's/^\(Dynamic exception type:\).*/\1/' "$stderr_path"
|
||||
sed -i.bak -e 's/^\(Dynamic exception type:\).*/\1/' "$stderr_path"
|
||||
rm "$stderr_path.bak"
|
||||
|
||||
if [[ $exitCode -ne "$exit_code_expected" ]]
|
||||
then
|
||||
|
@ -1,8 +1,14 @@
|
||||
recovery_ast_constructor/input.sol:5:27: Error: Expected primary expression.
|
||||
balances[tx.origin] = ; // missing RHS.
|
||||
^
|
||||
recovery_ast_constructor/input.sol:5:27: Warning: Recovered in Statement at ';'.
|
||||
balances[tx.origin] = ; // missing RHS.
|
||||
^
|
||||
Error: Expected primary expression.
|
||||
--> recovery_ast_constructor/input.sol:5:27:
|
||||
|
|
||||
5 | balances[tx.origin] = ; // missing RHS.
|
||||
| ^
|
||||
|
||||
Warning: Recovered in Statement at ';'.
|
||||
--> recovery_ast_constructor/input.sol:5:27:
|
||||
|
|
||||
5 | balances[tx.origin] = ; // missing RHS.
|
||||
| ^
|
||||
|
||||
|
||||
Compilation halted after AST generation due to errors.
|
||||
|
@ -1,4 +1,6 @@
|
||||
Warning: Yul and its optimizer are still experimental. Please use the output with care.
|
||||
strict_asm_jump/input.sol:1:3: Error: Function not found.
|
||||
{ jump(1) }
|
||||
^--^
|
||||
Error: Function not found.
|
||||
--> strict_asm_jump/input.sol:1:3:
|
||||
|
|
||||
1 | { jump(1) }
|
||||
| ^^^^
|
||||
|
@ -1,6 +1,11 @@
|
||||
too_long_line/input.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract C {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
too_long_line/input.sol:2:164: Error: Identifier not found or not unique.
|
||||
... ffffffffffffffffffffffffffffffffff(announcementType Type, string Announcement, string ...
|
||||
^--------------^
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> too_long_line/input.sol:1:1:
|
||||
|
|
||||
1 | contract C {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
||||
Error: Identifier not found or not unique.
|
||||
--> too_long_line/input.sol:2:164:
|
||||
|
|
||||
2 | ... ffffffffffffffffffffffffffffffffff(announcementType Type, string Announcement, string ...
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,11 @@
|
||||
too_long_line_both_sides_short/input.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract C {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
too_long_line_both_sides_short/input.sol:2:15: Error: Identifier not found or not unique.
|
||||
function f(announcementTypeXXXXXXXXXXXXXXXXXXX ... XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Type,
|
||||
^-------------------------------------------------------------------------^
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> too_long_line_both_sides_short/input.sol:1:1:
|
||||
|
|
||||
1 | contract C {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
||||
Error: Identifier not found or not unique.
|
||||
--> too_long_line_both_sides_short/input.sol:2:15:
|
||||
|
|
||||
2 | function f(announcementTypeXXXXXXXXXXXXXXXXXXX ... XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Type,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,11 @@
|
||||
too_long_line_edge_in/input.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract C {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
too_long_line_edge_in/input.sol:2:36: Error: Identifier not found or not unique.
|
||||
function ffffffffffffffffffffff(announcementTypeTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT Ty, string A) onlyOwner external {
|
||||
^----------------------------------------------------------------------------------------------^
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> too_long_line_edge_in/input.sol:1:1:
|
||||
|
|
||||
1 | contract C {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
||||
Error: Identifier not found or not unique.
|
||||
--> too_long_line_edge_in/input.sol:2:36:
|
||||
|
|
||||
2 | function ffffffffffffffffffffff(announcementTypeTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT Ty, string A) onlyOwner external {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,11 @@
|
||||
too_long_line_edge_out/input.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract C {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
too_long_line_edge_out/input.sol:2:37: Error: Identifier not found or not unique.
|
||||
... function fffffffffffffffffffffff(announcementTypeTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT Typ, string A) onlyOwner external ...
|
||||
^----------------------------------------------------------------------------------------------^
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> too_long_line_edge_out/input.sol:1:1:
|
||||
|
|
||||
1 | contract C {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
||||
Error: Identifier not found or not unique.
|
||||
--> too_long_line_edge_out/input.sol:2:37:
|
||||
|
|
||||
2 | ... function fffffffffffffffffffffff(announcementTypeTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT Typ, string A) onlyOwner external ...
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,11 @@
|
||||
too_long_line_left_short/input.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract C {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
too_long_line_left_short/input.sol:2:15: Error: Identifier not found or not unique.
|
||||
function f(announcementType Type, string Announcement, string ...
|
||||
^--------------^
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> too_long_line_left_short/input.sol:1:1:
|
||||
|
|
||||
1 | contract C {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
||||
Error: Identifier not found or not unique.
|
||||
--> too_long_line_left_short/input.sol:2:15:
|
||||
|
|
||||
2 | function f(announcementType Type, string Announcement, string ...
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -1,6 +1,11 @@
|
||||
too_long_line_multiline/input.sol:2:5: Error: No visibility specified. Did you intend to add "public"?
|
||||
function f() returns (byte _b, byte ... _b7, bytes22 _b22, bytes32 _b32) {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
too_long_line_multiline/input.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract C {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
Error: No visibility specified. Did you intend to add "public"?
|
||||
--> too_long_line_multiline/input.sol:2:5:
|
||||
|
|
||||
2 | function f() returns (byte _b, byte ... _b7, bytes22 _b22, bytes32 _b32) {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> too_long_line_multiline/input.sol:1:1:
|
||||
|
|
||||
1 | contract C {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
@ -1,6 +1,11 @@
|
||||
too_long_line_right_short/input.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract C {
|
||||
^ (Relevant source part starts here and spans across multiple lines).
|
||||
too_long_line_right_short/input.sol:2:164: Error: Identifier not found or not unique.
|
||||
... ffffffffffffffffffffffffffffffffff(announcementType Type,
|
||||
^--------------^
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> too_long_line_right_short/input.sol:1:1:
|
||||
|
|
||||
1 | contract C {
|
||||
| ^ (Relevant source part starts here and spans across multiple lines).
|
||||
|
||||
Error: Identifier not found or not unique.
|
||||
--> too_long_line_right_short/input.sol:2:164:
|
||||
|
|
||||
2 | ... ffffffffffffffffffffffffffffffffff(announcementType Type,
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user