Skip to content

Commit

Permalink
eof: Update syntax tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Jan 8, 2025
1 parent b3d11f5 commit 9c41121
Show file tree
Hide file tree
Showing 105 changed files with 701 additions and 43 deletions.
14 changes: 14 additions & 0 deletions test/libsolidity/semanticTests/array/nested_calldata_storage.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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
14 changes: 14 additions & 0 deletions test/libsolidity/semanticTests/array/nested_calldata_storage2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ contract D {
return a + b;
}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ contract Test {
L.set(item);
}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ contract Test {
L.get(item);
}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ contract C is B {
validate()
{}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ import "B";
contract D is C {
constructor() validate B() validate C() validate {}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ pragma abicoder v1;
import "A";

contract C is B {}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ pragma abicoder v1;
import "A";

contract D is C {}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ pragma abicoder v1;
import "A";

contract D is C {}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ contract C is B {
_;
}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ struct Data {
contract X {
function get() public view returns (Data memory) {}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ contract C {
function i(uint[][2] calldata s) external { tmp_i = s; }
}

// ====
// bytecodeFormat: legacy
// ----
// UnimplementedFeatureError 1834: (35-127): Copying nested calldata dynamic arrays to storage is not implemented in the old code generator.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ contract C {
function i(uint[][] calldata s) external { tmp_i = s; }
}

// ====
// bytecodeFormat: legacy
// ----
// UnimplementedFeatureError 1834: (35-125): Copying nested calldata dynamic arrays to storage is not implemented in the old code generator.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ library L2 {
contract A {
function f() public pure { type(L2).creationCode; }
}
// ====
// bytecodeFormat: legacy
// ----
// Warning 6133: (157-178): Statement has no effect.
4 changes: 3 additions & 1 deletion test/libsolidity/syntaxTests/constants/mod_div_rational.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ contract C {
fixed a3 = 0 / 0.123;
fixed a4 = 0 / -0.123;
}
// ====
// compileViaYul: true
// ----
// UnimplementedFeatureError 1834: (0-150): Not yet implemented - FixedPointType.
// UnimplementedFeatureError 1834: (28-53): Fixed point types not implemented.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ pragma abicoder v1;
abstract contract C {
constructor(uint[][][] memory t) {}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ contract C {
// ====
// EVMVersion: >=constantinople
// compileViaYul: true
// bytecodeFormat: legacy
// ----
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
// Info 4164: (31-61): Inferred type: void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ contract C
// ====
// EVMVersion: >=constantinople
// compileViaYul: true
// bytecodeFormat: legacy
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ contract C {
}
}
// ====
// bytecodeFormat: legacy
// ====
// EVMVersion: >=constantinople
// ----
// TypeError 9886: (78-101): Duplicate option "gas".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ contract C {
address(10).delegatecall{value: 7, gas: 3}("");
}
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 6189: (56-98): Cannot set option "value" for delegatecall.
// Warning 9302: (56-102): Return value of low-level calls not used.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ contract C {
}
// ====
// EVMVersion: >=byzantium
// bytecodeFormat: legacy
// ----
// TypeError 2842: (56-96): Cannot set option "value" for staticcall.
// Warning 9302: (56-100): Return value of low-level calls not used.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ contract C {
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// TypeError 1645: (78-110): Function call options have already been set, you have to combine them into a single {...}-option.
// TypeError 1645: (120-154): Function call options have already been set, you have to combine them into a single {...}-option.
Expand Down
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.
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.
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
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ contract C {
success;
}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ contract C {
x{gas: 2}(1);
}
}

// ====
// bytecodeFormat: legacy
// ----
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.

This file was deleted.

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.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
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;
}
}
// ====
// bytecodeFormat: legacy
// ----
// 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.
2 changes: 2 additions & 0 deletions test/libsolidity/syntaxTests/immutable/creationCode.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ contract Test {
return type(A).creationCode;
}
}
// ====
// bytecodeFormat: legacy
// ----
4 changes: 3 additions & 1 deletion test/libsolidity/syntaxTests/immutable/no_assignments.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: This test case should work the same way for EOF but EOF immutables support is not in its final state yet.
contract C {
uint immutable x;
constructor() {
Expand All @@ -8,6 +9,7 @@ contract C {
function f() external view returns(uint) { return x; }
}
// ====
// bytecodeFormat: legacy
// optimize-yul: true
// ----
// CodeGenerationError 1284: (0-168): Some immutables were read from but never assigned, possibly because of optimization.
// CodeGenerationError 1284: (115-283): Some immutables were read from but never assigned, possibly because of optimization.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ contract C {
}
}
}
// ====
// compileViaYul: false
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ contract c {
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ contract C {
}
// ====
// EVMVersion: >=byzantium
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ contract C {
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ contract c {
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
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" {}
}
}
}
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ contract C {
}
}
}
// ====
// bytecodeFormat: legacy
// ----
// SyntaxError 2450: (61-63): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
contract C {
function f() public pure {
assembly {
switch codesize()
switch calldataload(0)
case "1" {}
case "2" {}
}
}
}
// ====
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ contract C {
}
// ====
// optimize-yul: false
// bytecodeFormat: legacy
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ contract test {
fixed[3] memory a = [fixed(3.5), fixed(-4.25), fixed(967.125)];
}
}
// ====
// compileViaYul: true
// ----
// Warning 2072: (50-67): Unused local variable.
// Warning 2018: (20-119): Function state mutability can be restricted to pure
// UnimplementedFeatureError 1834: (0-121): Not yet implemented - FixedPointType.
// UnimplementedFeatureError 1834: (71-81): Fixed point types not implemented.
Loading

0 comments on commit 9c41121

Please sign in to comment.