forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#14328 from ethereum/fix-incomplete-ast-in…
…-standard-json-on-analysis-fail Fix incomplete AST in standard json on analysis fail
- Loading branch information
Showing
23 changed files
with
512 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,5 @@ | |
"type": "DeclarationError" | ||
} | ||
], | ||
"sources": | ||
{ | ||
"": | ||
{ | ||
"id": 0 | ||
} | ||
} | ||
"sources": {} | ||
} |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/standard_outputs_on_analysis_error_fatal/args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--allow-paths . |
8 changes: 8 additions & 0 deletions
8
test/cmdlineTests/standard_outputs_on_analysis_error_fatal/in.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity *; | ||
|
||
contract C { | ||
// This will trigger a fatal error at the analysis stage, of the kind that terminates analysis | ||
// immediately without letting the current step finish. | ||
constructor(uint[] storage) {} | ||
} |
14 changes: 14 additions & 0 deletions
14
test/cmdlineTests/standard_outputs_on_analysis_error_fatal/input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"C": {"urls": ["standard_outputs_on_analysis_error_fatal/in.sol"]} | ||
}, | ||
"settings": { | ||
"outputSelection": { | ||
"*": { | ||
"*": ["*"], | ||
"": ["*"] | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
test/cmdlineTests/standard_outputs_on_analysis_error_fatal/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"errors": | ||
[ | ||
{ | ||
"component": "general", | ||
"errorCode": "3644", | ||
"formattedMessage": "TypeError: This parameter has a type that can only be used internally. You can make the contract abstract to avoid this problem. | ||
--> C:7:17: | ||
| | ||
7 | constructor(uint[] storage) {} | ||
| ^^^^^^^^^^^^^^ | ||
|
||
", | ||
"message": "This parameter has a type that can only be used internally. You can make the contract abstract to avoid this problem.", | ||
"severity": "error", | ||
"sourceLocation": | ||
{ | ||
"end": 258, | ||
"file": "C", | ||
"start": 244 | ||
}, | ||
"type": "TypeError" | ||
} | ||
], | ||
"sources": {} | ||
} |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--allow-paths . |
6 changes: 6 additions & 0 deletions
6
test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/in.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity *; | ||
|
||
// This will trigger a fatal error at the analysis stage, of the kind that lets the current | ||
// analysis steps finish but terminates analysis after immediately after that step. | ||
function f(uint immutable x) {} |
14 changes: 14 additions & 0 deletions
14
test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"C": {"urls": ["standard_outputs_on_analysis_error_fatal_after_current_step/in.sol"]} | ||
}, | ||
"settings": { | ||
"outputSelection": { | ||
"*": { | ||
"*": ["*"], | ||
"": ["*"] | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"errors": | ||
[ | ||
{ | ||
"component": "general", | ||
"errorCode": "8297", | ||
"formattedMessage": "DeclarationError: The \"immutable\" keyword can only be used for state variables. | ||
--> C:6:12: | ||
| | ||
6 | function f(uint immutable x) {} | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
", | ||
"message": "The \"immutable\" keyword can only be used for state variables.", | ||
"severity": "error", | ||
"sourceLocation": | ||
{ | ||
"end": 259, | ||
"file": "C", | ||
"start": 243 | ||
}, | ||
"type": "DeclarationError" | ||
} | ||
], | ||
"sources": {} | ||
} |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--allow-paths . |
9 changes: 9 additions & 0 deletions
9
test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/in.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity *; | ||
|
||
contract C { | ||
// This will trigger a non-fatal error at the analysis stage. | ||
// With this kind of error we still run subsequent analysis stages. | ||
uint x; | ||
string y = x; | ||
} |
14 changes: 14 additions & 0 deletions
14
test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"C": {"urls": ["standard_outputs_on_analysis_error_non_fatal/in.sol"]} | ||
}, | ||
"settings": { | ||
"outputSelection": { | ||
"*": { | ||
"*": ["*"], | ||
"": ["*"] | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"errors": | ||
[ | ||
{ | ||
"component": "general", | ||
"errorCode": "7407", | ||
"formattedMessage": "TypeError: Type uint256 is not implicitly convertible to expected type string storage ref. | ||
--> C:8:16: | ||
| | ||
8 | string y = x; | ||
| ^ | ||
|
||
", | ||
"message": "Type uint256 is not implicitly convertible to expected type string storage ref.", | ||
"severity": "error", | ||
"sourceLocation": | ||
{ | ||
"end": 235, | ||
"file": "C", | ||
"start": 234 | ||
}, | ||
"type": "TypeError" | ||
} | ||
], | ||
"sources": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--allow-paths . |
13 changes: 13 additions & 0 deletions
13
test/cmdlineTests/standard_outputs_on_compilation_error/in.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity *; | ||
|
||
contract C { | ||
// This will trigger an error at the compilation stage. | ||
// CodeGenerationError due to immutable initialization in constructor being optimized out. | ||
uint immutable public x; | ||
|
||
constructor() { | ||
x = 0; | ||
while (true) {} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
test/cmdlineTests/standard_outputs_on_compilation_error/input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"C": {"urls": ["standard_outputs_on_compilation_error/in.sol"]} | ||
}, | ||
"settings": { | ||
"optimizer": {"enabled": true}, | ||
"outputSelection": { | ||
"*": { | ||
"*": ["*"], | ||
"": ["*"] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.