diff --git a/test/libsolidity/semanticTests/array/nested_calldata_storage.sol b/test/libsolidity/semanticTests/array/nested_calldata_storage.sol new file mode 100644 index 000000000000..fdb44de6cc6f --- /dev/null +++ b/test/libsolidity/semanticTests/array/nested_calldata_storage.sol @@ -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 diff --git a/test/libsolidity/semanticTests/array/nested_calldata_storage2.sol b/test/libsolidity/semanticTests/array/nested_calldata_storage2.sol new file mode 100644 index 000000000000..4431136a8f97 --- /dev/null +++ b/test/libsolidity/semanticTests/array/nested_calldata_storage2.sol @@ -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 diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_accessing_public_state_variable_via_v1_type.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_accessing_public_state_variable_via_v1_type.sol index f324d2c33e30..036a2597616c 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_accessing_public_state_variable_via_v1_type.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_accessing_public_state_variable_via_v1_type.sol @@ -13,4 +13,6 @@ contract D { return a + b; } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v1_library_function_accepting_storage_struct.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v1_library_function_accepting_storage_struct.sol index b21b7cfaff5e..03fb9bae673b 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v1_library_function_accepting_storage_struct.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v1_library_function_accepting_storage_struct.sol @@ -19,4 +19,6 @@ contract Test { L.set(item); } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_library_function_accepting_storage_struct.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_library_function_accepting_storage_struct.sol index 41bc072a5949..01d9658ce2cf 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_library_function_accepting_storage_struct.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_library_function_accepting_storage_struct.sol @@ -19,4 +19,6 @@ contract Test { L.get(item); } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_modifier.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_modifier.sol index 78d7b0512414..ef066593c4bc 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_modifier.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_call_to_v2_modifier.sol @@ -25,4 +25,6 @@ contract C is B { validate() {} } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_constructor_with_v2_modifier.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_constructor_with_v2_modifier.sol index 1ac5d713b104..b937d1e2d1a2 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_constructor_with_v2_modifier.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_constructor_with_v2_modifier.sol @@ -32,4 +32,6 @@ import "B"; contract D is C { constructor() validate B() validate C() validate {} } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_calling_v2_function.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_calling_v2_function.sol index 073a125be984..9743d5318ca0 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_calling_v2_function.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_calling_v2_function.sol @@ -23,4 +23,6 @@ pragma abicoder v1; import "A"; contract C is B {} +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_defining_v2_event.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_defining_v2_event.sol index 963ed33c70e6..e4492a4ef742 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_defining_v2_event.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_defining_v2_event.sol @@ -13,4 +13,6 @@ pragma abicoder v1; import "A"; contract D is C {} +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_emitting_v2_event.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_emitting_v2_event.sol index 8aa2f8552c2b..5ae4cb0ed836 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_emitting_v2_event.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_inheritance_from_contract_emitting_v2_event.sol @@ -19,4 +19,6 @@ pragma abicoder v1; import "A"; contract D is C {} +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_modifier_overriding_v2_modifier.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_modifier_overriding_v2_modifier.sol index dd102cf51378..9a809b50a2fe 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_modifier_overriding_v2_modifier.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_modifier_overriding_v2_modifier.sol @@ -27,4 +27,6 @@ contract C is B { _; } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/abiEncoder/v1_v2_v1_modifier_mix.sol b/test/libsolidity/syntaxTests/abiEncoder/v1_v2_v1_modifier_mix.sol index e5df9cc82237..6665c42efd49 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/v1_v2_v1_modifier_mix.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/v1_v2_v1_modifier_mix.sol @@ -52,4 +52,6 @@ struct Data { contract X { function get() public view returns (Data memory) {} } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/array/nested_calldata_storage.sol b/test/libsolidity/syntaxTests/array/nested_calldata_storage.sol index 9aa5fce1211a..581aa8482203 100644 --- a/test/libsolidity/syntaxTests/array/nested_calldata_storage.sol +++ b/test/libsolidity/syntaxTests/array/nested_calldata_storage.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol b/test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol index f1125b4d232b..98c2ccac0f1c 100644 --- a/test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol +++ b/test/libsolidity/syntaxTests/array/nested_calldata_storage2.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/bytecodeReferences/library_non_called.sol b/test/libsolidity/syntaxTests/bytecodeReferences/library_non_called.sol index b7392ff3ee74..1374c3110d35 100644 --- a/test/libsolidity/syntaxTests/bytecodeReferences/library_non_called.sol +++ b/test/libsolidity/syntaxTests/bytecodeReferences/library_non_called.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/constants/mod_div_rational.sol b/test/libsolidity/syntaxTests/constants/mod_div_rational.sol index 68d3bfc7ae03..b7a4b4518473 100644 --- a/test/libsolidity/syntaxTests/constants/mod_div_rational.sol +++ b/test/libsolidity/syntaxTests/constants/mod_div_rational.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol b/test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol index 2ca22790c128..ca52859ff928 100644 --- a/test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol +++ b/test/libsolidity/syntaxTests/constructor/nonabiv2_type_abstract.sol @@ -2,4 +2,6 @@ pragma abicoder v1; abstract contract C { constructor(uint[][][] memory t) {} } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition.sol b/test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition.sol index 858b9132dd32..74a659cd8b83 100644 --- a/test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition.sol +++ b/test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition.sol @@ -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 diff --git a/test/libsolidity/syntaxTests/experimental/inference/import_and_call_stdlib_function.sol b/test/libsolidity/syntaxTests/experimental/inference/import_and_call_stdlib_function.sol index fc75e85947eb..72af2133f206 100644 --- a/test/libsolidity/syntaxTests/experimental/inference/import_and_call_stdlib_function.sol +++ b/test/libsolidity/syntaxTests/experimental/inference/import_and_call_stdlib_function.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol index 3b162a7f220a..417eea14d609 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_duplicated.sol @@ -8,6 +8,8 @@ contract C { } } // ==== +// bytecodeFormat: legacy +// ==== // EVMVersion: >=constantinople // ---- // TypeError 9886: (78-101): Duplicate option "gas". diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol index d719fdcd9bb7..858b9a1d2e89 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_delegatecall.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol index e128f03f1f21..c525542c7e0b 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_on_staticcall.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol index 4356efcf95d5..0961881a1257 100644 --- a/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol +++ b/test/libsolidity/syntaxTests/functionCalls/calloptions_repeated.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_delegatecall.sol b/test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_delegatecall.sol new file mode 100644 index 000000000000..fdbb79b96970 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_delegatecall.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_staticcall.sol b/test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_staticcall.sol new file mode 100644 index 000000000000..f63837dcf26a --- /dev/null +++ b/test/libsolidity/syntaxTests/functionCalls/eof/calloptions_on_staticcall.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionCalls/eof/lowlevel_call_options.sol b/test/libsolidity/syntaxTests/functionCalls/eof/lowlevel_call_options.sol new file mode 100644 index 000000000000..4bc515d7c54c --- /dev/null +++ b/test/libsolidity/syntaxTests/functionCalls/eof/lowlevel_call_options.sol @@ -0,0 +1,9 @@ +contract C { + function foo() internal { + (bool success, ) = address(10).call{value: 7}(""); + success; + } +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- diff --git a/test/libsolidity/syntaxTests/functionCalls/lowlevel_call_options.sol b/test/libsolidity/syntaxTests/functionCalls/lowlevel_call_options.sol index da5c17a20ac0..c5ec6de71380 100644 --- a/test/libsolidity/syntaxTests/functionCalls/lowlevel_call_options.sol +++ b/test/libsolidity/syntaxTests/functionCalls/lowlevel_call_options.sol @@ -4,4 +4,6 @@ contract C { success; } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/functionTypes/call_gas_on_function.sol b/test/libsolidity/syntaxTests/functionTypes/call_gas_on_function.sol index 6b926e2ddecb..e92d1cfb0489 100644 --- a/test/libsolidity/syntaxTests/functionTypes/call_gas_on_function.sol +++ b/test/libsolidity/syntaxTests/functionTypes/call_gas_on_function.sol @@ -4,5 +4,6 @@ contract C { x{gas: 2}(1); } } - +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/functionTypes/comparison_operator_for_external_functions_with_call_options.sol b/test/libsolidity/syntaxTests/functionTypes/comparison_operator_for_external_functions_with_call_options.sol new file mode 100644 index 000000000000..da84e6ada8f1 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/comparison_operator_for_external_functions_with_call_options.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionTypes/comparison_operator_for_external_functions_with_extra_gas_slots.sol b/test/libsolidity/syntaxTests/functionTypes/comparison_operator_for_external_functions_with_extra_gas_slots.sol deleted file mode 100644 index 12cbe2939bc3..000000000000 --- a/test/libsolidity/syntaxTests/functionTypes/comparison_operator_for_external_functions_with_extra_gas_slots.sol +++ /dev/null @@ -1,12 +0,0 @@ -contract C { - function external_test_function() external {} - function comparison_operator_for_external_function_with_extra_slots() external returns (bool) { - return ( - (this.external_test_function{gas: 4} == this.external_test_function) && - (this.external_test_function{gas: 4} == this.external_test_function{gas: 4}) - ); - } -} -// ---- -// TypeError 2271: (193-259): Built-in binary operator == cannot be applied to types function () external and function () external. -// TypeError 2271: (277-351): Built-in binary operator == cannot be applied to types function () external and function () external. diff --git a/test/libsolidity/syntaxTests/functionTypes/eof/call_gas_on_function.sol b/test/libsolidity/syntaxTests/functionTypes/eof/call_gas_on_function.sol new file mode 100644 index 000000000000..c4f00843d597 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/eof/call_gas_on_function.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/functionTypes/external_functions_with_variable_number_of_stack_slots.sol b/test/libsolidity/syntaxTests/functionTypes/external_functions_with_variable_number_of_stack_slots.sol index 8593bdbf4fed..e995d7889f4a 100644 --- a/test/libsolidity/syntaxTests/functionTypes/external_functions_with_variable_number_of_stack_slots.sol +++ b/test/libsolidity/syntaxTests/functionTypes/external_functions_with_variable_number_of_stack_slots.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/immutable/creationCode.sol b/test/libsolidity/syntaxTests/immutable/creationCode.sol index 0a2282695cda..32fb4edea8bb 100644 --- a/test/libsolidity/syntaxTests/immutable/creationCode.sol +++ b/test/libsolidity/syntaxTests/immutable/creationCode.sol @@ -7,4 +7,6 @@ contract Test { return type(A).creationCode; } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/immutable/no_assignments.sol b/test/libsolidity/syntaxTests/immutable/no_assignments.sol index 7d7948671419..92bcac8cfb7d 100644 --- a/test/libsolidity/syntaxTests/immutable/no_assignments.sol +++ b/test/libsolidity/syntaxTests/immutable/no_assignments.sol @@ -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() { @@ -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. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_library.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_library.sol index 522ca801d975..801bdd7eea18 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_library.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_from_library.sol @@ -8,4 +8,6 @@ contract C { } } } +// ==== +// compileViaYul: false // ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/create2_as_variable_post_istanbul.sol b/test/libsolidity/syntaxTests/inlineAssembly/create2_as_variable_post_istanbul.sol index 96a384c54d20..0468ef093f52 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/create2_as_variable_post_istanbul.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/create2_as_variable_post_istanbul.sol @@ -6,4 +6,5 @@ contract c { } // ==== // EVMVersion: >=constantinople +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol index b08172ebe469..e019026f633b 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_byzantium.sol @@ -13,4 +13,5 @@ contract C { } // ==== // EVMVersion: >=byzantium +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol index 2aff4351ae8b..ddfa80d7fc7e 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/evm_constantinople.sol @@ -19,4 +19,5 @@ contract C { } // ==== // EVMVersion: >=constantinople +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/extcodehash_as_variable_post_constantinople.sol b/test/libsolidity/syntaxTests/inlineAssembly/extcodehash_as_variable_post_constantinople.sol index 8b34ab906d4a..8ee7f644be0e 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/extcodehash_as_variable_post_constantinople.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/extcodehash_as_variable_post_constantinople.sol @@ -7,4 +7,5 @@ contract c { } // ==== // EVMVersion: >=constantinople +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/hex_switch_case.sol b/test/libsolidity/syntaxTests/inlineAssembly/hex_switch_case.sol index 038e8c4ff99e..915048905dbc 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/hex_switch_case.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/hex_switch_case.sol @@ -1,10 +1,9 @@ contract C { function f() public pure { assembly { - switch codesize() + switch calldataload(0) case hex"00" {} case hex"1122" {} } } } -// ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/invalid/pc_disallowed.sol b/test/libsolidity/syntaxTests/inlineAssembly/invalid/pc_disallowed.sol index 816bb1c0d5f4..1178e9a2b907 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/invalid/pc_disallowed.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/invalid/pc_disallowed.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/string_literal_switch_case.sol b/test/libsolidity/syntaxTests/inlineAssembly/string_literal_switch_case.sol index 0a63987e143e..6b45d24215c8 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/string_literal_switch_case.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/string_literal_switch_case.sol @@ -1,10 +1,12 @@ contract C { function f() public pure { assembly { - switch codesize() + switch calldataload(0) case "1" {} case "2" {} } } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/use_msize_without_optimizer.sol b/test/libsolidity/syntaxTests/inlineAssembly/use_msize_without_optimizer.sol index 8cdf96641ada..d356fe299ae9 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/use_msize_without_optimizer.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/use_msize_without_optimizer.sol @@ -7,4 +7,5 @@ contract C { } // ==== // optimize-yul: false +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol index 8e51bd1886c1..7c67a647a3e2 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_fixed_types.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol index 0382672fe38e..20e9de7649ca 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/inline_array_rationals.sol @@ -3,7 +3,9 @@ contract test { ufixed128x3[4] memory a = [ufixed128x3(3.5), 4.125, 2.5, 4.0]; } } +// ==== +// compileViaYul: true // ---- // Warning 2072: (50-73): Unused local variable. // Warning 2018: (20-118): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-120): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (77-93): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccess.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccess.sol index e90443e14ef5..6136665e34bd 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccess.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccess.sol @@ -9,4 +9,6 @@ contract Test { contract Other { function f(uint) public pure returns (uint) {} } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol index 2f5c356c08d0..22f81cfb0241 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol @@ -6,5 +6,7 @@ contract Test { abstract contract Other { function f(uint) public returns (uint); } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 9582: (97-121): Member "creationCode" not found or not visible after argument-dependent lookup in type(contract Other). diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol index 538a26e78941..8019dabb2176 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol @@ -6,5 +6,7 @@ contract Test { abstract contract Other { function f(uint) public returns (uint); } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 9582: (91-114): Member "runtimeCode" not found or not visible after argument-dependent lookup in type(contract Other). diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol index c202046cc4d0..c4b3efedd77d 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol @@ -21,6 +21,8 @@ contract Test4 is Base { return type(Base).runtimeCode; } } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 7813: (166-190): Circular reference to contract bytecode either via "new" or "type(...).creationCode" / "type(...).runtimeCode". // TypeError 7813: (300-323): Circular reference to contract bytecode either via "new" or "type(...).creationCode" / "type(...).runtimeCode". diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol index 57e3263e3249..4a5a760f792b 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol @@ -8,6 +8,8 @@ contract B { type(A).runtimeCode; } } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 7813: (52-71): Circular reference to contract bytecode either via "new" or "type(...).creationCode" / "type(...).runtimeCode". // TypeError 7813: (133-152): Circular reference to contract bytecode either via "new" or "type(...).creationCode" / "type(...).runtimeCode". diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol index cda5d5c349f7..96303396e032 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol @@ -4,4 +4,6 @@ contract Test { } contract B { function f() public pure {} } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol index f746dc35d1de..8c707006891b 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol @@ -9,4 +9,6 @@ contract Test { contract Library { function f(uint) public pure returns (uint) {} } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccess_super.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccess_super.sol index 7d057e132b17..a8fef765eea1 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeAccess_super.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeAccess_super.sol @@ -9,5 +9,7 @@ contract SuperTest is Other { return type(super).runtimeCode; } } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 4259: (177-182): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(contract super SuperTest) provided. diff --git a/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol b/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol index c9cade179f55..2a51276414d9 100644 --- a/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol +++ b/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol @@ -5,6 +5,8 @@ contract Test { } } contract C {} +// ==== +// bytecodeFormat: legacy // ---- // TypeError 4247: (55-75): Expression has to be an lvalue. // TypeError 4247: (100-119): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol b/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol index 40eaee040cbe..8e6fcf64e34a 100644 --- a/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol +++ b/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol @@ -12,6 +12,8 @@ contract C { contract D is C { constructor() {} } +// ==== +// bytecodeFormat: legacy // ---- // Warning 6417: (77-96): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode. // Warning 6417: (118-137): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode. diff --git a/test/libsolidity/syntaxTests/metaTypes/type_runtimecode.sol b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode.sol index 6b054b4dacfb..d110b2c8ec37 100644 --- a/test/libsolidity/syntaxTests/metaTypes/type_runtimecode.sol +++ b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode.sol @@ -6,4 +6,6 @@ contract C { return type(A).runtimeCode; } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/metaTypes/type_runtimecode_from_ternary_expression_.sol b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode_from_ternary_expression_.sol index 8fcf65480e12..f802b9a00508 100644 --- a/test/libsolidity/syntaxTests/metaTypes/type_runtimecode_from_ternary_expression_.sol +++ b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode_from_ternary_expression_.sol @@ -9,6 +9,8 @@ contract C { return (getA ? type(A) : type(B)).runtimeCode; } } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 9717: (126-133): Invalid mobile type in true expression. // TypeError 3703: (136-143): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol index 88a407fef98d..41bb9e046ce0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/303_fixed_type_int_conversion.sol @@ -7,6 +7,8 @@ contract test { c; d; } } +// ==== +// compileViaYul: true // ---- // Warning 2018: (20-147): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-149): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (93-104): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol index 0e3cb3b6cb47..2809575b6c44 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/304_fixed_type_rational_int_conversion.sol @@ -5,6 +5,8 @@ contract test { c; d; } } +// ==== +// compileViaYul: true // ---- // Warning 2018: (20-104): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-106): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (50-61): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol index ada627037e49..0a13eedcc372 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/305_fixed_type_rational_fraction_conversion.sol @@ -5,6 +5,8 @@ contract test { a; d; } } +// ==== +// compileViaYul: true // ---- // Warning 2018: (20-108): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-110): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (50-63): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol index adb9fbe699ce..d0d11105bd1c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol @@ -5,5 +5,7 @@ contract test { a; b; } } +// ==== +// compileViaYul: true // ---- -// UnimplementedFeatureError 1834: (0-126): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (55-74): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol index e763fa18be20..c1586595b154 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/312_leading_zero_rationals_convert.sol @@ -7,5 +7,7 @@ contract A { a; b; c; d; } } +// ==== +// compileViaYul: true // ---- -// UnimplementedFeatureError 1834: (0-289): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (52-70): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol index b9205f01b1d9..07c4017e0d5f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/314_fixed_type_zero_handling.sol @@ -4,6 +4,8 @@ contract test { ufixed32x1 b = 0; b; } } +// ==== +// compileViaYul: true // ---- // Warning 2018: (20-104): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-106): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (50-65): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol index 1282c24daf89..84e5b764027c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/317_fixed_type_valid_explicit_conversions.sol @@ -5,6 +5,8 @@ contract test { ufixed8x1 c = ufixed8x1(1/3); c; } } +// ==== +// compileViaYul: true // ---- // Warning 2018: (20-182): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-184): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (67-84): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol index 3ee670cd585c..9a714f6b9d6d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol @@ -4,5 +4,7 @@ contract test { fixedString[0.5] = "Half"; } } +// ==== +// compileViaYul: true // ---- -// UnimplementedFeatureError 1834: (0-130): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (96-112): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol index ba467a67b131..f0ec56875d7c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol @@ -5,5 +5,7 @@ contract test { } myStruct a = myStruct(3.125, 3); } +// ==== +// compileViaYul: true // ---- -// UnimplementedFeatureError 1834: (0-115): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (94-112): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol index b5162bcd9720..7293e0f42528 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/328_rational_to_fixed_literal_expression.sol @@ -10,7 +10,9 @@ contract test { a; b; c; d; e; f; g; } } +// ==== +// compileViaYul: true // ---- // Warning 2519: (238-252): This declaration shadows an existing declaration. // Warning 2018: (20-339): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-341): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (50-72): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol index 3ebd54d4541a..27133cf1d923 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/343_integer_and_fixed_interaction.sol @@ -3,7 +3,9 @@ contract test { ufixed a = uint64(1) + ufixed(2); } } +// ==== +// compileViaYul: true // ---- // Warning 2072: (50-58): Unused local variable. // Warning 2018: (20-89): Function state mutability can be restricted to pure -// UnimplementedFeatureError 1834: (0-91): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (73-82): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/497_gasleft.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/497_gasleft.sol index 3d5acac99be3..7a5254a1a127 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/497_gasleft.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/497_gasleft.sol @@ -1,4 +1,6 @@ contract C { function f() public view returns (uint256 val) { return gasleft(); } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol index 9346264edbcd..2e1c746baf4e 100644 --- a/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol +++ b/test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol @@ -6,5 +6,7 @@ contract C { f1; f2; } } +// ==== +// compileViaYul: true // ---- -// UnimplementedFeatureError 1834: (0-109): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (46-64): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large.sol b/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large.sol index f22b9755d652..5ac74bba7cb7 100644 --- a/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large.sol +++ b/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large.sol @@ -8,5 +8,6 @@ contract test { } // ==== // EVMVersion: >=cancun +// bytecodeFormat: legacy // ---- // Warning 5574: (21-27154): Contract code size is 27164 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. diff --git a/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large_abiencoder_v1.sol b/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large_abiencoder_v1.sol index a0c7267d0d20..f3091ebf5351 100644 --- a/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large_abiencoder_v1.sol +++ b/test/libsolidity/syntaxTests/sizeLimits/bytecode_too_large_abiencoder_v1.sol @@ -8,5 +8,6 @@ contract test { } // ==== // EVMVersion: >=shanghai +// bytecodeFormat: legacy // ---- // Warning 5574: (21-27154): Contract code size is 27205 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries. diff --git a/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol b/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol index 071859e53fb7..8e5ebcdeb97a 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/functionCallOptions_err.sol @@ -5,6 +5,8 @@ contract C { abi.encode(this.f{value: 2, gas: 1}); } } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 2056: (60-76): This type cannot be encoded. // TypeError 2056: (92-106): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol index 6ecb4e4ff869..e4e13b7ef570 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol @@ -1,11 +1,13 @@ contract C { - function f() public pure { - bytes32 h = keccak256(abi.encodePacked(keccak256, f, this.f{gas: 2}, blockhash)); + function f() payable public { + bytes32 h = keccak256(abi.encodePacked(keccak256, f, this.f{value: 2}, blockhash)); h; } } +// ==== +// bytecodeFormat: legacy // ---- -// TypeError 2056: (91-100): This type cannot be encoded. -// TypeError 2056: (102-103): This type cannot be encoded. -// TypeError 2056: (105-119): This type cannot be encoded. -// TypeError 2056: (121-130): This type cannot be encoded. +// TypeError 2056: (94-103): This type cannot be encoded. +// TypeError 2056: (105-106): This type cannot be encoded. +// TypeError 2056: (108-124): This type cannot be encoded. +// TypeError 2056: (126-135): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/types/address/address_members.sol b/test/libsolidity/syntaxTests/types/address/address_members.sol index 144361b9409a..9299b65d523c 100644 --- a/test/libsolidity/syntaxTests/types/address/address_members.sol +++ b/test/libsolidity/syntaxTests/types/address/address_members.sol @@ -5,4 +5,6 @@ contract C { function i() public view returns (uint) { return f().code.length; } function j() public view returns (uint) { return h().length; } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/types/address/address_payable_selfdestruct.sol b/test/libsolidity/syntaxTests/types/address/address_payable_selfdestruct.sol index 754ff2c67488..449b628d4491 100644 --- a/test/libsolidity/syntaxTests/types/address/address_payable_selfdestruct.sol +++ b/test/libsolidity/syntaxTests/types/address/address_payable_selfdestruct.sol @@ -3,5 +3,7 @@ contract C { selfdestruct(a); } } +// ==== +// bytecodeFormat: legacy // ---- // Warning 5159: (64-76): "selfdestruct" has been deprecated. Note that, starting from the Cancun hard fork, the underlying opcode no longer deletes the code and data associated with an account and only transfers its Ether to the beneficiary, unless executed in the same transaction in which the contract was created (see EIP-6780). Any use in newly deployed contracts is strongly discouraged even if the new behavior is taken into account. Future changes to the EVM might further reduce the functionality of the opcode. diff --git a/test/libsolidity/syntaxTests/types/address/codehash.sol b/test/libsolidity/syntaxTests/types/address/codehash.sol index cf7eaabec976..00956d97e848 100644 --- a/test/libsolidity/syntaxTests/types/address/codehash.sol +++ b/test/libsolidity/syntaxTests/types/address/codehash.sol @@ -5,4 +5,5 @@ contract C { } // ==== // EVMVersion: >=constantinople +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/types/address/eof/address_members.sol b/test/libsolidity/syntaxTests/types/address/eof/address_members.sol new file mode 100644 index 000000000000..a1b21de2cea0 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/address/eof/address_members.sol @@ -0,0 +1,9 @@ +contract C { + function f() public view returns (address) { return address(this); } + function g() public view returns (uint) { return f().balance; } + function h() public pure returns (bytes memory) { return msg.data; } + function j() public pure returns (uint) { return h().length; } +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- diff --git a/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol b/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol index e62728770d90..f76fa84308a9 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_literal_to_fixed_implicit.sol @@ -12,5 +12,7 @@ contract C { a; b; c; } } +// ==== +// compileViaYul: true // ---- -// UnimplementedFeatureError 1834: (0-317): Not yet implemented - FixedPointType. +// UnimplementedFeatureError 1834: (66-84): Fixed point types not implemented. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/address_constantinople.sol b/test/libsolidity/syntaxTests/viewPureChecker/address_constantinople.sol index 4387ca60a75b..e8ee980bf5ac 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/address_constantinople.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/address_constantinople.sol @@ -8,4 +8,5 @@ contract C { } // ==== // EVMVersion: >=constantinople +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol b/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol index cc8ac5e8341b..9097a166c118 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/assembly.sol @@ -27,4 +27,6 @@ contract C { assembly { pop(extcodesize(0)) } } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/viewPureChecker/assembly_constantinople.sol b/test/libsolidity/syntaxTests/viewPureChecker/assembly_constantinople.sol index ed0b20d53793..16f57b2e8091 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/assembly_constantinople.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/assembly_constantinople.sol @@ -5,4 +5,5 @@ contract C { } // ==== // EVMVersion: >=constantinople +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol index 4d1710a3a160..8f275321382a 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol @@ -18,5 +18,7 @@ contract C { } receive() payable external {} } +// ==== +// bytecodeFormat: legacy // ---- // Warning 5159: (122-134): "selfdestruct" has been deprecated. Note that, starting from the Cancun hard fork, the underlying opcode no longer deletes the code and data associated with an account and only transfers its Ether to the beneficiary, unless executed in the same transaction in which the contract was created (see EIP-6780). Any use in newly deployed contracts is strongly discouraged even if the new behavior is taken into account. Future changes to the EVM might further reduce the functionality of the opcode. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/assembly.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/assembly.sol new file mode 100644 index 000000000000..fad9b7c1fa27 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/assembly.sol @@ -0,0 +1,29 @@ +contract C { + struct S { uint x; } + S s; + function e() pure public { + assembly { mstore(keccak256(0, 20), mul(s.slot, 2)) } + } + function f() pure public { + uint x; + assembly { x := 7 } + } + function g() view public { + assembly { for {} 1 { pop(sload(0)) } { } pop(calldataload(0)) } + } + function h() view public { + assembly { function g() { pop(blockhash(20)) } } + } + function i() public { + assembly { pop(extcall(0, 1, 2, 3)) } + } + function k() public view { + assembly { pop(balance(0)) } + } + function l() public pure { + assembly { pop(calldataload(0)) } + } +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/builtin_functions.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/builtin_functions.sol new file mode 100644 index 000000000000..91ea709fe2a6 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/builtin_functions.sol @@ -0,0 +1,22 @@ +contract C { + function f() public { + payable(this).transfer(1); + require(payable(this).send(2)); + (bool success,) = address(this).delegatecall(""); + require(success); + (success,) = address(this).call(""); + require(success); + } + function g() pure public { + bytes32 x = keccak256("abc"); + bytes32 y = sha256("abc"); + address z = ecrecover(bytes32(uint256(1)), uint8(2), bytes32(uint256(3)), bytes32(uint256(4))); + require(true); + assert(true); + x; y; z; + } + receive() payable external {} +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/gas_value_without_call.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/gas_value_without_call.sol new file mode 100644 index 000000000000..78b563bf157a --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/gas_value_without_call.sol @@ -0,0 +1,15 @@ +contract C { + function f() external payable {} + function g(address a) external pure { + a.call{value: 42}; + a.call; + a.staticcall; + a.delegatecall; + } + function h() external view { + this.f{value: 42}; + } +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/gas_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/gas_with_call_nonpayable.sol new file mode 100644 index 000000000000..c91b19ea1a98 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/gas_with_call_nonpayable.sol @@ -0,0 +1,14 @@ +contract C { + function f(address a) external view returns (bool success) { + (success,) = a.call(""); + } + function h() external payable {} + function i() external view { + this.h(); + } +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- +// TypeError 8961: (90-100): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (171-179): Function cannot be declared as view because this expression (potentially) modifies the state. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed.sol new file mode 100644 index 000000000000..980bc8fcedc6 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed.sol @@ -0,0 +1,81 @@ +contract C { + function f() public { + assembly { + stop() + pop(add(0, 1)) + pop(sub(0, 1)) + pop(mul(0, 1)) + pop(div(0, 1)) + pop(sdiv(0, 1)) + pop(mod(0, 1)) + pop(smod(0, 1)) + pop(exp(0, 1)) + pop(not(0)) + pop(lt(0, 1)) + pop(gt(0, 1)) + pop(slt(0, 1)) + pop(sgt(0, 1)) + pop(eq(0, 1)) + pop(iszero(0)) + pop(and(0, 1)) + pop(or(0, 1)) + pop(xor(0, 1)) + pop(byte(0, 1)) + pop(shl(0, 1)) + pop(shr(0, 1)) + pop(sar(0, 1)) + pop(addmod(0, 1, 2)) + pop(mulmod(0, 1, 2)) + pop(signextend(0, 1)) + pop(keccak256(0, 1)) + pop(0) + pop(mload(0)) + mstore(0, 1) + mstore8(0, 1) + pop(sload(0)) + sstore(0, 1) + pop(address()) + pop(balance(0)) + pop(selfbalance()) + pop(caller()) + pop(callvalue()) + pop(calldataload(0)) + pop(calldatasize()) + calldatacopy(0, 1, 2) + pop(returndatasize()) + returndatacopy(0, 1, 2) + pop(extcall(0, 1, 2, 3)) + pop(extdelegatecall(0, 1, 2)) + pop(extstaticcall(0, 1, 2)) + return(0, 1) + revert(0, 1) + invalid() + log0(0, 1) + log1(0, 1, 2) + log2(0, 1, 2, 3) + log3(0, 1, 2, 3, 4) + log4(0, 1, 2, 3, 4, 5) + pop(chainid()) + pop(basefee()) + pop(origin()) + pop(gasprice()) + pop(blockhash(0)) + pop(coinbase()) + pop(timestamp()) + pop(number()) + pop(prevrandao()) + pop(gaslimit()) + + // NOTE: msize() is allowed only with optimizer disabled + //pop(msize()) + } + } +} +// ==== +// EVMVersion: >=paris +// bytecodeFormat: >=EOFv1 +// ---- +// Warning 5740: (89-1400): Unreachable code. +// Warning 5740: (1413-1425): Unreachable code. +// Warning 5740: (1438-1447): Unreachable code. +// Warning 5740: (1460-1871): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed_pure.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed_pure.sol new file mode 100644 index 000000000000..0ce17aa1e726 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed_pure.sol @@ -0,0 +1,80 @@ +contract C { + function f() public pure { + assembly { + stop() + pop(add(0, 1)) + pop(sub(0, 1)) + pop(mul(0, 1)) + pop(div(0, 1)) + pop(sdiv(0, 1)) + pop(mod(0, 1)) + pop(smod(0, 1)) + pop(exp(0, 1)) + pop(not(0)) + pop(lt(0, 1)) + pop(gt(0, 1)) + pop(slt(0, 1)) + pop(sgt(0, 1)) + pop(eq(0, 1)) + pop(iszero(0)) + pop(and(0, 1)) + pop(or(0, 1)) + pop(xor(0, 1)) + pop(byte(0, 1)) + pop(shl(0, 1)) + pop(shr(0, 1)) + pop(sar(0, 1)) + pop(addmod(0, 1, 2)) + pop(mulmod(0, 1, 2)) + pop(signextend(0, 1)) + pop(keccak256(0, 1)) + pop(0) + pop(mload(0)) + mstore(0, 1) + mstore8(0, 1) + //pop(sload(0)) + //sstore(0, 1) + //pop(address()) + //pop(balance(0)) + //pop(selfbalance()) + //pop(caller()) + //pop(callvalue()) + pop(calldataload(0)) + pop(calldatasize()) + calldatacopy(0, 1, 2) + pop(returndatasize()) + returndatacopy(0, 1, 2) + //pop(extcall(0, 1, 2, 3)) + //pop(extdelegatecall(0, 1, 2)) + //pop(extstaticcall(0, 1, 2)) + return(0, 1) + revert(0, 1) + invalid() + //log0(0, 1) + //log1(0, 1, 2) + //log2(0, 1, 2, 3) + //log3(0, 1, 2, 3, 4) + //log4(0, 1, 2, 3, 4, 5) + //pop(chainid()) + //pop(basefee()) + //pop(origin()) + //pop(gasprice()) + //pop(blockhash(0)) + //pop(coinbase()) + //pop(timestamp()) + //pop(number()) + //pop(prevrandao()) + //pop(gaslimit()) + + // NOTE: msize() is allowed only with optimizer disabled + //pop(msize()) + } + } +} +// ==== +// EVMVersion: >=london +// bytecodeFormat: >=EOFv1 +// ---- +// Warning 5740: (94-1425): Unreachable code. +// Warning 5740: (1438-1450): Unreachable code. +// Warning 5740: (1463-1472): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed_view.sol new file mode 100644 index 000000000000..327d9566ab89 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_allowed_view.sol @@ -0,0 +1,81 @@ +contract C { + function f() public view { + assembly { + stop() + pop(add(0, 1)) + pop(sub(0, 1)) + pop(mul(0, 1)) + pop(div(0, 1)) + pop(sdiv(0, 1)) + pop(mod(0, 1)) + pop(smod(0, 1)) + pop(exp(0, 1)) + pop(not(0)) + pop(lt(0, 1)) + pop(gt(0, 1)) + pop(slt(0, 1)) + pop(sgt(0, 1)) + pop(eq(0, 1)) + pop(iszero(0)) + pop(and(0, 1)) + pop(or(0, 1)) + pop(xor(0, 1)) + pop(byte(0, 1)) + pop(shl(0, 1)) + pop(shr(0, 1)) + pop(sar(0, 1)) + pop(addmod(0, 1, 2)) + pop(mulmod(0, 1, 2)) + pop(signextend(0, 1)) + pop(keccak256(0, 1)) + pop(0) + pop(mload(0)) + mstore(0, 1) + mstore8(0, 1) + pop(sload(0)) + //sstore(0, 1) + pop(address()) + pop(balance(0)) + pop(selfbalance()) + pop(caller()) + pop(callvalue()) + pop(calldataload(0)) + pop(calldatasize()) + calldatacopy(0, 1, 2) + pop(returndatasize()) + returndatacopy(0, 1, 2) + //pop(extcall(0, 1, 2, 3)) + //pop(extdelegatecall(0, 1, 2)) + pop(extstaticcall(0, 1, 2)) + return(0, 1) + revert(0, 1) + invalid() + //log0(0, 1) + //log1(0, 1, 2) + //log2(0, 1, 2, 3) + //log3(0, 1, 2, 3, 4) + //log4(0, 1, 2, 3, 4, 5) + pop(chainid()) + pop(basefee()) + pop(origin()) + pop(gasprice()) + pop(blockhash(0)) + pop(coinbase()) + pop(timestamp()) + pop(number()) + pop(prevrandao()) + pop(gaslimit()) + + // NOTE: msize() is allowed only with optimizer disabled + //pop(msize()) + } + } +} +// ==== +// EVMVersion: >=paris +// bytecodeFormat: >=EOFv1 +// ---- +// Warning 5740: (94-1411): Unreachable code. +// Warning 5740: (1424-1436): Unreachable code. +// Warning 5740: (1449-1458): Unreachable code. +// Warning 5740: (1626-1892): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed.sol new file mode 100644 index 000000000000..58b000520f0d --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed.sol @@ -0,0 +1,19 @@ +// TODO: Decide on eofcreate, returncontract and auxdataloadn availability in assembly and extend this test case. +contract C { + function f() public { + assembly { + linkersymbol("x") + memoryguard(0) + verbatim_1i_1o(hex"600202", 0) + + pop(msize()) + } + } +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- +// SyntaxError 6553: (161-307): The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. +// DeclarationError 4619: (184-196): Function "linkersymbol" not found. +// DeclarationError 4619: (214-225): Function "memoryguard" not found. +// DeclarationError 4619: (241-255): Function "verbatim_1i_1o" not found. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_pure.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_pure.sol new file mode 100644 index 000000000000..6e87aa97d3dd --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_pure.sol @@ -0,0 +1,52 @@ +contract C { + function f() public pure { + assembly { + pop(sload(0)) + sstore(0, 1) + pop(address()) + pop(balance(0)) + pop(caller()) + pop(callvalue()) + pop(extcall(0, 1, 2, 3)) + pop(extdelegatecall(0, 1, 2)) + log0(0, 1) + log1(0, 1, 2) + log2(0, 1, 2, 3) + log3(0, 1, 2, 3, 4) + log4(0, 1, 2, 3, 4, 5) + pop(origin()) + pop(gasprice()) + pop(blockhash(0)) + pop(coinbase()) + pop(timestamp()) + pop(number()) + pop(gaslimit()) + + // These two are disallowed too but the error suppresses other errors. + //pop(msize()) + } + } +} +// ==== +// bytecodeFormat: >=EOFv1 +// ---- +// TypeError 2527: (79-87): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (101-113): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 2527: (130-139): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (157-167): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (185-193): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (211-222): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 8961: (240-259): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 8961: (277-301): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 8961: (315-325): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 8961: (338-351): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 8961: (364-380): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 8961: (393-412): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 8961: (425-447): Function cannot be declared as pure because this expression (potentially) modifies the state. +// TypeError 2527: (464-472): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (490-500): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (518-530): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (548-558): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (576-587): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (605-613): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". +// TypeError 2527: (631-641): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_pure_byzantium.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_pure_byzantium.sol new file mode 100644 index 000000000000..a2250d80dc93 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_pure_byzantium.sol @@ -0,0 +1,12 @@ +contract C { + function f() public pure { + assembly { + pop(extstaticcall(0, 1, 2)) + } + } +} +// ==== +// EVMVersion: >=byzantium +// bytecodeFormat: >=EOFv1 +// ---- +// TypeError 2527: (79-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_view.sol new file mode 100644 index 000000000000..c92d349f6ac5 --- /dev/null +++ b/test/libsolidity/syntaxTests/viewPureChecker/eof/inline_assembly_instructions_disallowed_view.sol @@ -0,0 +1,30 @@ +contract C { + function f() public view { + assembly { + sstore(0, 1) + pop(extcall(0, 1, 2, 3)) + pop(extdelegatecall(0, 1, 2)) + log0(0, 1) + log1(0, 1, 2) + log2(0, 1, 2, 3) + log3(0, 1, 2, 3, 4) + log4(0, 1, 2, 3, 4, 5) + + // These two are disallowed too but the error suppresses other errors. + //pop(msize()) + //pop(pc()) + } + } +} +// ==== +// EVMVersion: >=london +// bytecodeFormat: >=EOFv1 +// ---- +// TypeError 8961: (75-87): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (104-123): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (141-165): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (179-189): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (202-215): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (228-244): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (257-276): Function cannot be declared as view because this expression (potentially) modifies the state. +// TypeError 8961: (289-311): Function cannot be declared as view because this expression (potentially) modifies the state. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol b/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol index 41120bf08111..f0bfba70ce31 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/gas_value_without_call.sol @@ -11,4 +11,6 @@ contract C { this.f{gas: 42}; } } +// ==== +// bytecodeFormat: legacy // ---- diff --git a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol index 65030cb30729..77956ffac02a 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/gas_with_call_nonpayable.sol @@ -7,6 +7,8 @@ contract C { this.h{gas: 42}(); } } +// ==== +// bytecodeFormat: legacy // ---- // TypeError 8961: (90-109): Function cannot be declared as view because this expression (potentially) modifies the state. // TypeError 8961: (180-197): Function cannot be declared as view because this expression (potentially) modifies the state. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed.sol index 886d6de0ce2f..680a8f85f2f7 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed.sol @@ -84,6 +84,7 @@ contract C { } // ==== // EVMVersion: >=paris +// bytecodeFormat: legacy // ---- // Warning 1699: (1754-1766): "selfdestruct" has been deprecated. Note that, starting from the Cancun hard fork, the underlying opcode no longer deletes the code and data associated with an account and only transfers its Ether to the beneficiary, unless executed in the same transaction in which the contract was created (see EIP-6780). Any use in newly deployed contracts is strongly discouraged even if the new behavior is taken into account. Future changes to the EVM might further reduce the functionality of the opcode. // Warning 5740: (89-1716): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_pure.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_pure.sol index 16c75d6f7291..5268f7a98e0b 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_pure.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_pure.sol @@ -83,6 +83,7 @@ contract C { } // ==== // EVMVersion: >=london +// bytecodeFormat: legacy // ---- // Warning 5740: (94-1755): Unreachable code. // Warning 5740: (1768-1780): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_view.sol index 0bb92c1fd2fa..e2fa70102dfa 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_allowed_view.sol @@ -84,6 +84,7 @@ contract C { } // ==== // EVMVersion: >=paris +// bytecodeFormat: legacy // ---- // Warning 5740: (94-1733): Unreachable code. // Warning 5740: (1746-1758): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed.sol index 992a51ad2a28..ff557e6865f7 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed.sol @@ -15,6 +15,8 @@ contract C { } } } +// ==== +// bytecodeFormat: legacy // ---- // SyntaxError 6553: (47-362): The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. // DeclarationError 4619: (70-78): Function "datasize" not found. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure.sol index 665a17eebf63..91be09f58f22 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure.sol @@ -34,6 +34,8 @@ contract C { } } } +// ==== +// bytecodeFormat: legacy // ---- // Warning 1699: (498-510): "selfdestruct" has been deprecated. Note that, starting from the Cancun hard fork, the underlying opcode no longer deletes the code and data associated with an account and only transfers its Ether to the beneficiary, unless executed in the same transaction in which the contract was created (see EIP-6780). Any use in newly deployed contracts is strongly discouraged even if the new behavior is taken into account. Future changes to the EVM might further reduce the functionality of the opcode. // Warning 5740: (526-853): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_byzantium.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_byzantium.sol index f0320d8b0835..ded86c88a9a3 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_byzantium.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_byzantium.sol @@ -7,5 +7,6 @@ contract C { } // ==== // EVMVersion: >=byzantium +// bytecodeFormat: legacy // ---- // TypeError 2527: (79-107): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_constantinople.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_constantinople.sol index 30210efc32fa..47826724e8e6 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_constantinople.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_pure_constantinople.sol @@ -8,6 +8,7 @@ contract C { } // ==== // EVMVersion: >=constantinople +// bytecodeFormat: legacy // ---- // TypeError 2527: (79-93): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view". // TypeError 8961: (111-130): Function cannot be declared as pure because this expression (potentially) modifies the state. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_view.sol index b2f241ff08c5..e2bf4c5d1f4b 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/inline_assembly_instructions_disallowed_view.sol @@ -22,6 +22,7 @@ contract C { } // ==== // EVMVersion: >=london +// bytecodeFormat: legacy // ---- // Warning 1699: (308-320): "selfdestruct" has been deprecated. Note that, starting from the Cancun hard fork, the underlying opcode no longer deletes the code and data associated with an account and only transfers its Ether to the beneficiary, unless executed in the same transaction in which the contract was created (see EIP-6780). Any use in newly deployed contracts is strongly discouraged even if the new behavior is taken into account. Future changes to the EVM might further reduce the functionality of the opcode. // Warning 5740: (336-468): Unreachable code. diff --git a/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol b/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol index f49327a92114..832f60f97b56 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/staticcall_gas_view.sol @@ -8,4 +8,5 @@ contract C { } // ==== // EVMVersion: >=byzantium +// bytecodeFormat: legacy // ----