-
Notifications
You must be signed in to change notification settings - Fork 6.2k
eof: Syntax tests update #15661
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
Merged
+726
−46
Merged
eof: Syntax tests update #15661
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
13 changes: 13 additions & 0 deletions
13
test/libsolidity/semanticTests/array/nested_calldata_storage.sol
This file contains hidden or 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 @@ | ||
pragma abicoder v2; | ||
|
||
contract C { | ||
uint[][2] public tmp_i; | ||
function i(uint[][2] calldata s) external { tmp_i = s; } | ||
} | ||
// ==== | ||
// compileViaYul: true | ||
// ---- | ||
// i(uint256[][2]): 0x20, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 | ||
// gas irOptimized: 223100 | ||
// tmp_i(uint256,uint256): 0, 0 -> 0x0A01 | ||
// tmp_i(uint256,uint256): 1, 0 -> 0x0B01 |
13 changes: 13 additions & 0 deletions
13
test/libsolidity/semanticTests/array/nested_calldata_storage2.sol
This file contains hidden or 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 @@ | ||
pragma abicoder v2; | ||
|
||
contract C { | ||
uint[][] public tmp_i; | ||
function i(uint[][] calldata s) external { tmp_i = s; } | ||
} | ||
// ==== | ||
// compileViaYul: true | ||
// ---- | ||
// i(uint256[][]): 0x20, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 | ||
// gas irOptimized: 245506 | ||
// tmp_i(uint256,uint256): 0, 0 -> 0x0A01 | ||
// tmp_i(uint256,uint256): 1, 0 -> 0x0B01 |
This file contains hidden or 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 |
---|---|---|
|
@@ -13,4 +13,6 @@ contract D { | |
return a + b; | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -19,4 +19,6 @@ contract Test { | |
L.set(item); | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -19,4 +19,6 @@ contract Test { | |
L.get(item); | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -25,4 +25,6 @@ contract C is B { | |
validate() | ||
{} | ||
} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -23,4 +23,6 @@ pragma abicoder v1; | |
import "A"; | ||
|
||
contract C is B {} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -13,4 +13,6 @@ pragma abicoder v1; | |
import "A"; | ||
|
||
contract D is C {} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -19,4 +19,6 @@ pragma abicoder v1; | |
import "A"; | ||
|
||
contract D is C {} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -27,4 +27,6 @@ contract C is B { | |
_; | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
11 changes: 11 additions & 0 deletions
11
test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_delegatecall.sol
This file contains hidden or 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,11 @@ | ||
contract C { | ||
function foo() pure internal { | ||
address(10).delegatecall{value: 7, gas: 3}(""); | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: >=EOFv1 | ||
// ---- | ||
// TypeError 6189: (56-98): Cannot set option "value" for delegatecall. | ||
// TypeError 3765: (56-98): Function call option "gas" cannot be used when compiling to EOF. | ||
// Warning 9302: (56-102): Return value of low-level calls not used. |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_staticcall.sol
This file contains hidden or 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,12 @@ | ||
contract C { | ||
function foo() pure internal { | ||
address(10).staticcall{value: 7, gas: 3}(""); | ||
} | ||
} | ||
// ==== | ||
// EVMVersion: >=prague | ||
// bytecodeFormat: >=EOFv1 | ||
// ---- | ||
// TypeError 2842: (56-96): Cannot set option "value" for staticcall. | ||
// TypeError 3765: (56-96): Function call option "gas" cannot be used when compiling to EOF. | ||
// Warning 9302: (56-100): Return value of low-level calls not used. |
9 changes: 9 additions & 0 deletions
9
test/libsolidity/syntaxTests/functionCalls/eof/lowlevel_call_options.sol
This file contains hidden or 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 @@ | ||
contract C { | ||
function foo() internal { | ||
(bool success, ) = address(10).call{value: 7}(""); | ||
success; | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: >=EOFv1 | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -4,4 +4,6 @@ contract C { | |
success; | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -4,5 +4,6 @@ contract C { | |
x{gas: 2}(1); | ||
} | ||
} | ||
|
||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
12 changes: 12 additions & 0 deletions
12
...yntaxTests/functionTypes/comparison_operator_for_external_functions_with_call_options.sol
This file contains hidden or 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,12 @@ | ||
contract C { | ||
function external_test_function() payable external {} | ||
function comparison_operator_for_external_function_with_extra_slots() external returns (bool) { | ||
return ( | ||
(this.external_test_function{value: 4} == this.external_test_function) && | ||
(this.external_test_function{value: 4} == this.external_test_function{value: 4}) | ||
); | ||
} | ||
} | ||
// ---- | ||
// TypeError 2271: (201-269): Built-in binary operator == cannot be applied to types function () payable external and function () payable external. | ||
// TypeError 2271: (287-365): Built-in binary operator == cannot be applied to types function () payable external and function () payable external. |
12 changes: 0 additions & 12 deletions
12
...axTests/functionTypes/comparison_operator_for_external_functions_with_extra_gas_slots.sol
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
test/libsolidity/syntaxTests/functionTypes/eof/call_gas_on_function.sol
This file contains hidden or 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,10 @@ | ||
contract C { | ||
function (uint) external returns (uint) x; | ||
function f() public { | ||
x{gas: 2}(1); | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: >=EOFv1 | ||
// ---- | ||
// TypeError 3765: (94-103): Function call option "gas" cannot be used when compiling to EOF. |
7 changes: 3 additions & 4 deletions
7
...dity/syntaxTests/functionTypes/external_functions_with_variable_number_of_stack_slots.sol
This file contains hidden or 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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
contract C { | ||
function f (address) external returns (bool) { | ||
this.f{gas: 42}.address; | ||
function f (address) payable external returns (bool) { | ||
this.f{value: 42}.address; | ||
} | ||
} | ||
// ---- | ||
// Warning 6321: (56-60): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. | ||
// Warning 2018: (17-102): Function state mutability can be restricted to view | ||
// Warning 6321: (64-68): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. |
This file contains hidden or 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 |
---|---|---|
|
@@ -7,4 +7,6 @@ contract Test { | |
return type(A).creationCode; | ||
} | ||
} | ||
// ==== | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -8,4 +8,6 @@ contract C { | |
} | ||
} | ||
} | ||
// ==== | ||
// compileViaYul: false | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -6,4 +6,5 @@ contract c { | |
} | ||
// ==== | ||
// EVMVersion: >=constantinople | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -13,4 +13,5 @@ contract C { | |
} | ||
// ==== | ||
// EVMVersion: >=byzantium | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -19,4 +19,5 @@ contract C { | |
} | ||
// ==== | ||
// EVMVersion: >=constantinople | ||
// bytecodeFormat: legacy | ||
// ---- |
This file contains hidden or 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 |
---|---|---|
|
@@ -7,4 +7,5 @@ contract c { | |
} | ||
// ==== | ||
// EVMVersion: >=constantinople | ||
// bytecodeFormat: legacy | ||
// ---- |
3 changes: 1 addition & 2 deletions
3
test/libsolidity/syntaxTests/inlineAssembly/hex_switch_case.sol
This file contains hidden or 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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
contract C { | ||
function f() public pure { | ||
assembly { | ||
switch codesize() | ||
switch calldataload(0) | ||
case hex"00" {} | ||
case hex"1122" {} | ||
} | ||
} | ||
} | ||
// ---- |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.