diff options
author | chriseth <chris@ethereum.org> | 2018-06-29 00:08:45 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-06-29 06:23:52 +0800 |
commit | eeef82b2d77c6f956039c57b0598e684254ee6dd (patch) | |
tree | 82887915936dbf242d5574c1fe9d61f5ace312d9 /test/libsolidity | |
parent | 4268062985e434b00f07e3f90772b94538933b9c (diff) | |
download | dexon-solidity-eeef82b2d77c6f956039c57b0598e684254ee6dd.tar.gz dexon-solidity-eeef82b2d77c6f956039c57b0598e684254ee6dd.tar.zst dexon-solidity-eeef82b2d77c6f956039c57b0598e684254ee6dd.zip |
Fallback function has to be external: backwards-compatible changes.
Diffstat (limited to 'test/libsolidity')
34 files changed, 106 insertions, 89 deletions
diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index 62711107..b0cd5a93 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -301,7 +301,7 @@ BOOST_AUTO_TEST_CASE(regular_functions_exclude_fallback) char const* sourceCode = R"( contract A { uint public x; - function() { x = 2; } + function() external { x = 2; } } )"; testCreationTimeGas(sourceCode); diff --git a/test/libsolidity/Imports.cpp b/test/libsolidity/Imports.cpp index 1b5dd4a5..4b700ceb 100644 --- a/test/libsolidity/Imports.cpp +++ b/test/libsolidity/Imports.cpp @@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(simple_alias) { CompilerStack c; c.addSource("a", "contract A {} pragma solidity >=0.0;"); - c.addSource("dir/a/b/c", "import \"../../.././a\" as x; contract B is x.A { function() { x.A r = x.A(20); } } pragma solidity >=0.0;"); + c.addSource("dir/a/b/c", "import \"../../.././a\" as x; contract B is x.A { function() external { x.A r = x.A(20); } } pragma solidity >=0.0;"); c.setEVMVersion(dev::test::Options::get().evmVersion()); BOOST_CHECK(c.compile()); } diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index 107abc26..b1c8e567 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -843,7 +843,7 @@ BOOST_AUTO_TEST_CASE(include_fallback_function) { char const* sourceCode = R"( contract test { - function() {} + function() external {} } )"; @@ -897,7 +897,7 @@ BOOST_AUTO_TEST_CASE(payable_fallback_function) { char const* sourceCode = R"( contract test { - function () payable {} + function () external payable {} } )"; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 57204c61..b8c85a63 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1812,7 +1812,7 @@ BOOST_AUTO_TEST_CASE(transfer_ether) } contract C { - function () payable { + function () external payable { throw; } } @@ -2506,7 +2506,7 @@ BOOST_AUTO_TEST_CASE(contracts_as_addresses) { char const* sourceCode = R"( contract helper { - function() payable { } // can receive ether + function() external payable { } // can receive ether } contract test { helper h; @@ -3054,7 +3054,7 @@ BOOST_AUTO_TEST_CASE(fallback_function) char const* sourceCode = R"( contract A { uint data; - function() { data = 1; } + function() external { data = 1; } function getData() returns (uint r) { return data; } } )"; @@ -3069,7 +3069,7 @@ BOOST_AUTO_TEST_CASE(inherited_fallback_function) char const* sourceCode = R"( contract A { uint data; - function() { data = 1; } + function() external { data = 1; } function getData() returns (uint r) { return data; } } contract B is A {} @@ -3100,7 +3100,7 @@ BOOST_AUTO_TEST_CASE(short_data_calls_fallback) uint public x; // Signature is d88e0b00 function fow() { x = 3; } - function () { x = 2; } + function () external { x = 2; } } )"; compileAndRun(sourceCode); @@ -3802,11 +3802,11 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes) contract receiver { uint public received; function receive(uint x) { received += x + 1; } - function() { received = 0x80; } + function() external { received = 0x80; } } contract sender { function sender() { rec = new receiver(); } - function() { savedData = msg.data; } + function() external { savedData = msg.data; } function forward() returns (bool) { !rec.call(savedData); return true; } function clear() returns (bool) { delete savedData; return true; } function val() returns (uint) { return rec.received(); } @@ -3830,7 +3830,7 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes_length) char const* sourceCode = R"( contract receiver { uint public calledLength; - function() { calledLength = msg.data.length; } + function() external { calledLength = msg.data.length; } } contract sender { receiver rec; @@ -3872,11 +3872,11 @@ BOOST_AUTO_TEST_CASE(copying_bytes_multiassign) contract receiver { uint public received; function receive(uint x) { received += x + 1; } - function() { received = 0x80; } + function() external { received = 0x80; } } contract sender { function sender() { rec = new receiver(); } - function() { savedData1 = savedData2 = msg.data; } + function() external { savedData1 = savedData2 = msg.data; } function forward(bool selector) returns (bool) { if (selector) { rec.call(savedData1); delete savedData1; } else { rec.call(savedData2); delete savedData2; } @@ -3903,7 +3903,7 @@ BOOST_AUTO_TEST_CASE(delete_removes_bytes_data) { char const* sourceCode = R"( contract c { - function() { data = msg.data; } + function() external { data = msg.data; } function del() returns (bool) { delete data; return true; } bytes data; } @@ -3920,7 +3920,7 @@ BOOST_AUTO_TEST_CASE(copy_from_calldata_removes_bytes_data) char const* sourceCode = R"( contract c { function set() returns (bool) { data = msg.data; return true; } - function() { data = msg.data; } + function() external { data = msg.data; } bytes data; } )"; @@ -6265,7 +6265,7 @@ BOOST_AUTO_TEST_CASE(failing_send) char const* sourceCode = R"( contract Helper { uint[] data; - function () { + function () external { data[9]; // trigger exception } } @@ -6289,7 +6289,7 @@ BOOST_AUTO_TEST_CASE(send_zero_ether) // (it previously did not because the gas stipend was not provided by the EVM) char const* sourceCode = R"( contract Receiver { - function () payable { + function () external payable { } } contract Main { @@ -7805,7 +7805,7 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library) function f(address x) returns (bool) { return x.send(1); } - function () payable {} + function () external payable {} } )"; compileAndRun(sourceCode, 0, "lib"); @@ -9335,7 +9335,7 @@ BOOST_AUTO_TEST_CASE(mutex) else return fund.withdrawUnprotected(10); } - function() payable { + function() external payable { callDepth++; if (callDepth < 4) attackInternal(); @@ -9461,7 +9461,7 @@ BOOST_AUTO_TEST_CASE(payable_function) function f() payable returns (uint) { return msg.value; } - function() payable { + function() external payable { a = msg.value + 1; } } @@ -9500,7 +9500,7 @@ BOOST_AUTO_TEST_CASE(non_payable_throw) function f() returns (uint) { return msg.value; } - function() { + function() external { a = msg.value + 1; } } @@ -11189,7 +11189,7 @@ BOOST_AUTO_TEST_CASE(bubble_up_error_messages_through_transfer) { char const* sourceCode = R"( contract D { - function() public payable { + function() external payable { revert("message"); } function f() public { @@ -11340,7 +11340,7 @@ BOOST_AUTO_TEST_CASE(interface_contract) interface I { event A(); function f() returns (bool); - function() payable; + function() external payable; } contract A is I { @@ -11352,7 +11352,7 @@ BOOST_AUTO_TEST_CASE(interface_contract) return true; } - function() payable { + function() external payable { } } diff --git a/test/libsolidity/syntaxTests/fallback/default_visibility.sol b/test/libsolidity/syntaxTests/fallback/default_visibility.sol new file mode 100644 index 00000000..2cb0af90 --- /dev/null +++ b/test/libsolidity/syntaxTests/fallback/default_visibility.sol @@ -0,0 +1,6 @@ +contract C { + // Check that visibility is also enforced for the fallback function. + function() {} +} +// ---- +// Warning: (90-103): No visibility specified. Defaulting to "public". diff --git a/test/libsolidity/syntaxTests/fallback/pure_modifier.sol b/test/libsolidity/syntaxTests/fallback/pure_modifier.sol index 20d5b0ac..12d790d1 100644 --- a/test/libsolidity/syntaxTests/fallback/pure_modifier.sol +++ b/test/libsolidity/syntaxTests/fallback/pure_modifier.sol @@ -1,6 +1,6 @@ contract C { uint x; - function() pure { x = 2; } + function() external pure { x = 2; } } // ---- -// TypeError: (29-55): Fallback function must be payable or non-payable, but is "pure". +// TypeError: (29-64): Fallback function must be payable or non-payable, but is "pure". diff --git a/test/libsolidity/syntaxTests/fallback/view_modifier.sol b/test/libsolidity/syntaxTests/fallback/view_modifier.sol index 44c5d204..2497e9fa 100644 --- a/test/libsolidity/syntaxTests/fallback/view_modifier.sol +++ b/test/libsolidity/syntaxTests/fallback/view_modifier.sol @@ -1,6 +1,6 @@ contract C { uint x; - function() view { x = 2; } + function() external view { x = 2; } } // ---- -// TypeError: (29-55): Fallback function must be payable or non-payable, but is "view". +// TypeError: (29-64): Fallback function must be payable or non-payable, but is "view". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/074_fallback_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/074_fallback_function.sol index 7e64bbe2..466e80cb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/074_fallback_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/074_fallback_function.sol @@ -1,4 +1,4 @@ contract C { uint x; - function() public { x = 2; } + function() external { x = 2; } } diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol index 2c1d2a1b..68d40952 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol @@ -1,6 +1,6 @@ contract C { uint x; - function(uint a) public { x = 2; } + function(uint a) external { x = 2; } } // ---- // TypeError: (37-45): Fallback function cannot take parameters. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol index 11fef976..25878a61 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol @@ -1,5 +1,5 @@ library C { - function() public {} + function() external {} } // ---- -// TypeError: (16-36): Libraries cannot have fallback functions. +// TypeError: (16-38): Libraries cannot have fallback functions. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol index 905bcd2d..3ff7a1c4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol @@ -1,5 +1,5 @@ contract C { - function() public returns (uint) { } + function() external returns (uint) { } } // ---- -// TypeError: (43-49): Fallback function cannot return values. +// TypeError: (45-51): Fallback function cannot return values. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol index 8d839da0..e5746c63 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol @@ -1,7 +1,7 @@ contract C { uint x; - function() public { x = 2; } - function() public { x = 3; } + function() external { x = 2; } + function() external { x = 3; } } // ---- -// DeclarationError: (62-90): Only one fallback function is allowed. +// DeclarationError: (64-94): Only one fallback function is allowed. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/079_fallback_function_inheritance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/079_fallback_function_inheritance.sol index a35a8093..c8c06c6e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/079_fallback_function_inheritance.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/079_fallback_function_inheritance.sol @@ -1,7 +1,7 @@ contract A { uint x; - function() public { x = 1; } + function() external { x = 1; } } contract C is A { - function() public { x = 2; } + function() external { x = 2; } } diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol index 1b522c00..db42786d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol @@ -1,3 +1,3 @@ -contract test { function() public { uint x = 1; uint y = 2; x || y; } } +contract test { function() external { uint x = 1; uint y = 2; x || y; } } // ---- -// TypeError: (60-66): Operator || not compatible with types uint256 and uint256 +// TypeError: (62-68): Operator || not compatible with types uint256 and uint256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol index cbc3732f..94d1c691 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol @@ -1,3 +1,3 @@ -contract test { function() public { uint x = 1; uint y = 2; x && y; } } +contract test { function() external { uint x = 1; uint y = 2; x && y; } } // ---- -// TypeError: (60-66): Operator && not compatible with types uint256 and uint256 +// TypeError: (62-68): Operator && not compatible with types uint256 and uint256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol index 1d36b0b3..68fe6e94 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol @@ -1,3 +1,3 @@ -contract test { function() public { uint x = 1; !x; } } +contract test { function() external { uint x = 1; !x; } } // ---- -// TypeError: (48-50): Unary operator ! cannot be applied to type uint256 +// TypeError: (50-52): Unary operator ! cannot be applied to type uint256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol index 5b8b2d3f..fbeadfb6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol @@ -1,3 +1,3 @@ -contract test { function() public { uint x = 3; int y = -4; x ** y; } } +contract test { function() external { uint x = 3; int y = -4; x ** y; } } // ---- -// TypeError: (60-66): Operator ** not compatible with types uint256 and int256 +// TypeError: (62-68): Operator ** not compatible with types uint256 and int256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/200_integer_signed_exp_unsigned.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/200_integer_signed_exp_unsigned.sol index 95c19d17..75e92085 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/200_integer_signed_exp_unsigned.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/200_integer_signed_exp_unsigned.sol @@ -1,3 +1,3 @@ -contract test { function() public { uint x = 3; int y = -4; y ** x; } } +contract test { function() external { uint x = 3; int y = -4; y ** x; } } // ---- -// TypeError: (60-66): Operator ** not compatible with types int256 and uint256 +// TypeError: (62-68): Operator ** not compatible with types int256 and uint256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol index 394dec88..93e5f065 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol @@ -1,3 +1,3 @@ -contract test { function() public { int x = -3; int y = -4; x ** y; } } +contract test { function() external { int x = -3; int y = -4; x ** y; } } // ---- -// TypeError: (60-66): Operator ** not compatible with types int256 and int256 +// TypeError: (62-68): Operator ** not compatible with types int256 and int256 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol index d4c513dd..711b794c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol @@ -1,3 +1,3 @@ -contract test { bytes a; bytes b; function() public { a == b; } } +contract test { bytes a; bytes b; function() external { a == b; } } // ---- -// TypeError: (54-60): Operator == not compatible with types bytes storage ref and bytes storage ref +// TypeError: (56-62): Operator == not compatible with types bytes storage ref and bytes storage ref diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol index de96b798..a74850b3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/203_struct_reference_compare_operators.sol @@ -1,3 +1,10 @@ -contract test { struct s {uint a;} s x; s y; function() public { x == y; } } +contract test { + struct s {uint a;} + s x; + s y; + function() external { + x == y; + } +} // ---- -// TypeError: (65-71): Operator == not compatible with types struct test.s storage ref and struct test.s storage ref +// TypeError: (79-85): Operator == not compatible with types struct test.s storage ref and struct test.s storage ref diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/415_interface_functions.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/415_interface_functions.sol index 1f227b54..a5d6561e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/415_interface_functions.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/415_interface_functions.sol @@ -1,9 +1,5 @@ interface I { - function(); - function f(); + function() external; + function f() external; } // ---- -// Warning: (18-29): Functions in interfaces should be declared external. -// Warning: (34-47): Functions in interfaces should be declared external. -// Warning: (18-29): No visibility specified. Defaulting to "public". In interfaces it defaults to external. -// Warning: (34-47): No visibility specified. Defaulting to "public". In interfaces it defaults to external. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol index a73c29bf..a3dca996 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/424_using_interface_complex.sol @@ -1,17 +1,11 @@ interface I { event A(); - function f(); - function g(); - function(); + function f() external; + function g() external; + function() external; } contract C is I { function f() public { } } // ---- -// Warning: (33-46): Functions in interfaces should be declared external. -// Warning: (51-64): Functions in interfaces should be declared external. -// Warning: (69-80): Functions in interfaces should be declared external. -// Warning: (33-46): No visibility specified. Defaulting to "public". In interfaces it defaults to external. -// Warning: (51-64): No visibility specified. Defaulting to "public". In interfaces it defaults to external. -// Warning: (69-80): No visibility specified. Defaulting to "public". In interfaces it defaults to external. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/463_error_transfer_non_payable_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/463_error_transfer_non_payable_fallback.sol index 3f6b0283..2b2ef39e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/463_error_transfer_non_payable_fallback.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/463_error_transfer_non_payable_fallback.sol @@ -2,16 +2,16 @@ // because A's fallback function is not payable. contract A { - function() public {} + function() external {} } contract B { A a; - function() public { + function() external { a.transfer(100); } } // ---- -// Warning: (209-219): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. -// TypeError: (209-219): Value transfer to a contract without a payable fallback function. +// Warning: (213-223): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. +// TypeError: (213-223): Value transfer to a contract without a payable fallback function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/464_error_transfer_no_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/464_error_transfer_no_fallback.sol index afa86040..67398de7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/464_error_transfer_no_fallback.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/464_error_transfer_no_fallback.sol @@ -6,10 +6,10 @@ contract A {} contract B { A a; - function() public { + function() external { a.transfer(100); } } // ---- -// Warning: (190-200): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. -// TypeError: (190-200): Value transfer to a contract without a payable fallback function. +// Warning: (192-202): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. +// TypeError: (192-202): Value transfer to a contract without a payable fallback function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/465_error_send_non_payable_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/465_error_send_non_payable_fallback.sol index 36f7470b..1a4b2e81 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/465_error_send_non_payable_fallback.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/465_error_send_non_payable_fallback.sol @@ -2,16 +2,16 @@ // because A does not have a payable fallback function. contract A { - function() public {} + function() external {} } contract B { A a; - function() public { + function() external { require(a.send(100)); } } // ---- -// Warning: (220-226): Using contract member "send" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).send" instead. -// TypeError: (220-226): Value transfer to a contract without a payable fallback function. +// Warning: (224-230): Using contract member "send" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).send" instead. +// TypeError: (224-230): Value transfer to a contract without a payable fallback function. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol index 1fa567eb..2b7f8dae 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/466_does_not_error_transfer_payable_fallback.sol @@ -2,15 +2,15 @@ // because A does not have a payable fallback function. contract A { - function() payable public {} + function() payable external {} } contract B { A a; - function() public { + function() external { a.transfer(100); } } // ---- -// Warning: (224-234): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. +// Warning: (228-238): Using contract member "transfer" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).transfer" instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/467_does_not_error_transfer_regular_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/467_does_not_error_transfer_regular_function.sol index bf027e22..65b4a236 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/467_does_not_error_transfer_regular_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/467_does_not_error_transfer_regular_function.sol @@ -5,7 +5,7 @@ contract A { contract B { A a; - function() public { + function() external { a.transfer(); } } diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/526_fallback_marked_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/526_fallback_marked_external.sol new file mode 100644 index 00000000..6ac551e1 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/526_fallback_marked_external.sol @@ -0,0 +1,3 @@ +contract C { + function () external { } +} diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol new file mode 100644 index 00000000..2d425037 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol @@ -0,0 +1,4 @@ +contract C { + function () internal { } +} +// ---- diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol new file mode 100644 index 00000000..2105c815 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol @@ -0,0 +1,4 @@ +contract C { + function () private { } +} +// ---- diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol new file mode 100644 index 00000000..42585137 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol @@ -0,0 +1,4 @@ +contract C { + function () public { } +} +// ---- diff --git a/test/libsolidity/syntaxTests/parsing/fallback_function.sol b/test/libsolidity/syntaxTests/parsing/fallback_function.sol index de32b030..054f57de 100644 --- a/test/libsolidity/syntaxTests/parsing/fallback_function.sol +++ b/test/libsolidity/syntaxTests/parsing/fallback_function.sol @@ -1,5 +1,4 @@ contract c { - function() { } + function() external { } } // ---- -// Warning: (17-31): No visibility specified. Defaulting to "public". diff --git a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol index e4be73c6..51e36a58 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol @@ -14,5 +14,5 @@ contract C { assert(true); x; y; z; } - function() payable public {} + function() payable external {} } |