diff options
Diffstat (limited to 'test/libsolidity')
34 files changed, 115 insertions, 130 deletions
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index 3046372f..a9ce6e49 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -461,7 +461,7 @@ BOOST_AUTO_TEST_CASE(recursion_depth) BOOST_AUTO_TEST_CASE(multiple_assignment) { CHECK_PARSE_ERROR("{ let x function f() -> a, b {} 123, x := f() }", ParserError, "Label name / variable name must precede \",\" (multiple assignment)."); - CHECK_PARSE_ERROR("{ let x function f() -> a, b {} x, 123 := f() }", ParserError, "Variable name expected in multiple assignemnt."); + CHECK_PARSE_ERROR("{ let x function f() -> a, b {} x, 123 := f() }", ParserError, "Variable name expected in multiple assignment."); /// NOTE: Travis hiccups if not having a variable char const* text = R"( diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index c366e866..736b0b33 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(multiple_params) BOOST_AUTO_TEST_CASE(multiple_methods_order) { - // methods are expected to be in alpabetical order + // methods are expected to be in alphabetical order char const* sourceCode = R"( contract test { function f(uint a) public returns (uint d) { return a * 7; } diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index fbc6a9c6..3cd3b9b7 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2082,7 +2082,7 @@ BOOST_AUTO_TEST_CASE(packed_keccak256) function a(bytes32 input) public returns (bytes32 hash) { uint24 b = 65536; uint c = 256; - return keccak256(abi.encodePacked(8, input, b, input, c)); + return keccak256(abi.encodePacked(uint8(8), input, b, input, c)); } } )"; @@ -2134,7 +2134,7 @@ BOOST_AUTO_TEST_CASE(packed_sha256) function a(bytes32 input) public returns (bytes32 hash) { uint24 b = 65536; uint c = 256; - return sha256(abi.encodePacked(8, input, b, input, c)); + return sha256(abi.encodePacked(uint8(8), input, b, input, c)); } } )"; @@ -2161,7 +2161,7 @@ BOOST_AUTO_TEST_CASE(packed_ripemd160) function a(bytes32 input) public returns (bytes32 hash) { uint24 b = 65536; uint c = 256; - return ripemd160(abi.encodePacked(8, input, b, input, c)); + return ripemd160(abi.encodePacked(uint8(8), input, b, input, c)); } } )"; @@ -3560,7 +3560,7 @@ BOOST_AUTO_TEST_CASE(keccak256_multiple_arguments_with_numeric_literals) contract c { function foo(uint a, uint16 b) public returns (bytes32 d) { - d = keccak256(abi.encodePacked(a, b, 145)); + d = keccak256(abi.encodePacked(a, b, uint8(145))); } } )"; @@ -3585,7 +3585,7 @@ BOOST_AUTO_TEST_CASE(keccak256_multiple_arguments_with_string_literals) } function bar(uint a, uint16 b) public returns (bytes32 d) { - d = keccak256(abi.encodePacked(a, b, 145, "foo")); + d = keccak256(abi.encodePacked(a, b, uint8(145), "foo")); } } )"; @@ -6387,9 +6387,9 @@ BOOST_AUTO_TEST_CASE(return_multiple_strings_of_various_sizes) "ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ" "ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ" ); - vector<size_t> lengthes{0, 30, 32, 63, 64, 65, 210, 300}; - for (auto l1: lengthes) - for (auto l2: lengthes) + vector<size_t> lengths{0, 30, 32, 63, 64, 65, 210, 300}; + for (auto l1: lengths) + for (auto l2: lengths) { bytes dyn1 = encodeArgs(u256(l1), s1.substr(0, l1)); bytes dyn2 = encodeArgs(u256(l2), s2.substr(0, l2)); @@ -6456,9 +6456,9 @@ BOOST_AUTO_TEST_CASE(bytes_in_function_calls) compileAndRun(sourceCode, 0, "Main"); string s1("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); string s2("ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ"); - vector<size_t> lengthes{0, 31, 64, 65}; - for (auto l1: lengthes) - for (auto l2: lengthes) + vector<size_t> lengths{0, 31, 64, 65}; + for (auto l1: lengths) + for (auto l2: lengths) { bytes dyn1 = encodeArgs(u256(l1), s1.substr(0, l1)); bytes dyn2 = encodeArgs(u256(l2), s2.substr(0, l2)); @@ -6497,8 +6497,8 @@ BOOST_AUTO_TEST_CASE(return_bytes_internal) )"; compileAndRun(sourceCode, 0, "Main"); string s1("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); - vector<size_t> lengthes{0, 31, 64, 65}; - for (auto l1: lengthes) + vector<size_t> lengths{0, 31, 64, 65}; + for (auto l1: lengths) { bytes dyn1 = encodeArgs(u256(l1), s1.substr(0, l1)); bytes args1 = encodeArgs(u256(0x20)) + dyn1; @@ -7916,7 +7916,7 @@ BOOST_AUTO_TEST_CASE(string_tuples) return (h(), "def"); } function h() public returns (string) { - return ("abc",); + return ("abc"); } } )"; diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 949045ea..26b7914f 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -77,7 +77,7 @@ Declaration const& resolveDeclaration( ) { ASTNode const* scope = &_sourceUnit; - // bracers are required, cause msvc couldnt handle this macro in for statement + // bracers are required, cause msvc couldn't handle this macro in for statement for (string const& namePart: _namespacedName) { auto declarations = _resolver.resolveName(namePart, scope); @@ -319,7 +319,7 @@ BOOST_AUTO_TEST_CASE(short_circuiting) BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end()); } -BOOST_AUTO_TEST_CASE(arithmetics) +BOOST_AUTO_TEST_CASE(arithmetic) { char const* sourceCode = R"( contract test { diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index d375beff..a144068d 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -104,7 +104,7 @@ public: "\nOptimized: " + toHex(optimizedOutput)); } - /// @returns the number of intructions in the given bytecode, not taking the metadata hash + /// @returns the number of instructions in the given bytecode, not taking the metadata hash /// into account. size_t numInstructions(bytes const& _bytecode, boost::optional<Instruction> _which = boost::optional<Instruction>{}) { diff --git a/test/libsolidity/ViewPureChecker.cpp b/test/libsolidity/ViewPureChecker.cpp index bb5480b2..299cd084 100644 --- a/test/libsolidity/ViewPureChecker.cpp +++ b/test/libsolidity/ViewPureChecker.cpp @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(environment_access) "this", "address(1).balance" }; - // ``block.blockhash`` and ``blockhash`` are tested seperately below because their usage will + // ``block.blockhash`` and ``blockhash`` are tested separately below because their usage will // produce warnings that can't be handled in a generic way. vector<string> pure{ "msg.data", diff --git a/test/libsolidity/syntaxTests/fallback/default_visibility.sol b/test/libsolidity/syntaxTests/fallback/default_visibility.sol index f45bbd3c..31123d59 100644 --- a/test/libsolidity/syntaxTests/fallback/default_visibility.sol +++ b/test/libsolidity/syntaxTests/fallback/default_visibility.sol @@ -3,4 +3,4 @@ contract C { function() {} } // ---- -// Warning: (90-103): No visibility specified. Defaulting to "public". +// TypeError: (90-103): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/functionCalls/named_arguments_for_functions_that_take_arbitrary_parameters.sol b/test/libsolidity/syntaxTests/functionCalls/named_arguments_for_functions_that_take_arbitrary_parameters.sol new file mode 100644 index 00000000..089e1dbf --- /dev/null +++ b/test/libsolidity/syntaxTests/functionCalls/named_arguments_for_functions_that_take_arbitrary_parameters.sol @@ -0,0 +1,7 @@ +contract C { + function f() pure public { + abi.encodeWithSelector({selector:"abc"}); + } +} +// ---- +// TypeError: (52-92): Named arguments cannot be used for functions that take arbitrary parameters. diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol index 0b18b995..692b1827 100644 --- a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol +++ b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses.sol @@ -4,4 +4,4 @@ contract Base { contract Derived is Base(2) { } contract Derived2 is Base(), Derived() { } // ---- -// Warning: (101-107): Wrong argument count for constructor call: 0 arguments given but expected 1. +// TypeError: (101-107): Wrong argument count for constructor call: 0 arguments given but expected 1. Remove parentheses if you do not want to provide arguments here. diff --git a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol b/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol deleted file mode 100644 index db04ab8c..00000000 --- a/test/libsolidity/syntaxTests/inheritance/base_arguments_empty_parentheses_V050.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma experimental "v0.5.0"; - -contract Base { - constructor(uint) public {} -} -contract Derived is Base(2) { } -contract Derived2 is Base(), Derived() { } -// ---- -// TypeError: (132-138): Wrong argument count for constructor call: 0 arguments given but expected 1. diff --git a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol index c55c41f2..1ce48200 100644 --- a/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol +++ b/test/libsolidity/syntaxTests/inheritance/too_few_base_arguments.sol @@ -6,5 +6,5 @@ contract Derived2 is Base { constructor() Base(2) public { } } // ---- -// TypeError: (74-81): Wrong argument count for constructor call: 1 arguments given but expected 2. +// TypeError: (74-81): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. // TypeError: (130-137): Wrong argument count for modifier invocation: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol index 55c83674..b6dd12b8 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol @@ -1,6 +1,6 @@ contract C { uint[] x; - function() public { + function() external { uint[] storage y = x; assembly { pop(y) @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (117-118): You have to use the _slot or _offset suffix to access storage reference variables. +// TypeError: (119-120): You have to use the _slot or _offset suffix to access storage reference variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol index 3ae24b34..84f98ed9 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol @@ -1,6 +1,6 @@ contract C { uint[] x; - function() public { + function() external { uint[] storage y = x; assembly { pop(y_slot) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol index 3112f67a..95e8cf37 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol @@ -1,13 +1,13 @@ contract C { function f() public { uint a = (1); - (uint b,) = (uint8(1),); + (uint b,) = uint8(1); (uint c, uint d) = (uint32(1), 2 + a); (uint e,) = (uint64(1), 2, b); a;b;c;d;e; } } // ---- -// Warning: (69-92): Different number of components on the left hand side (2) than on the right hand side (1). -// Warning: (149-178): Different number of components on the left hand side (2) than on the right hand side (3). -// Warning: (17-204): Function state mutability can be restricted to pure +// Warning: (69-89): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (146-175): Different number of components on the left hand side (2) than on the right hand side (3). +// Warning: (17-201): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol index 8e5d81e2..56fc4051 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol @@ -1,4 +1,4 @@ -// This tests a crash that occured because we did not stop for fatal errors. +// This tests a crash that occurred because we did not stop for fatal errors. contract C { struct S { ftring a; @@ -8,4 +8,4 @@ contract C { } } // ---- -// DeclarationError: (113-119): Identifier not found or not unique. +// DeclarationError: (114-120): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol index d65c639f..ad08eca6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/525_reject_interface_constructors.sol @@ -1,4 +1,4 @@ interface I {} contract C is I(2) {} // ---- -// TypeError: (29-33): Wrong argument count for constructor call: 1 arguments given but expected 0. +// TypeError: (29-33): Wrong argument count for constructor call: 1 arguments given but expected 0. Remove parentheses if you do not want to provide arguments here. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/526_fallback_marked_external_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/526_fallback_marked_external_v050.sol deleted file mode 100644 index f13a87ec..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/526_fallback_marked_external_v050.sol +++ /dev/null @@ -1,4 +0,0 @@ -pragma experimental "v0.5.0"; -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 index 2d425037..b8e1c654 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol @@ -2,3 +2,4 @@ contract C { function () internal { } } // ---- +// TypeError: (17-41): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal_v050.sol deleted file mode 100644 index 6c8b23c8..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal_v050.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function () internal { } -} -// ---- -// TypeError: (47-71): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol index 2105c815..6038a99f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol @@ -2,3 +2,4 @@ contract C { function () private { } } // ---- +// TypeError: (17-40): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private_v050.sol deleted file mode 100644 index be381909..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private_v050.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function () private { } -} -// ---- -// TypeError: (47-70): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol index 42585137..d9c1580f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol @@ -2,3 +2,4 @@ contract C { function () public { } } // ---- +// TypeError: (17-39): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public_v050.sol deleted file mode 100644 index d0beffda..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public_v050.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function () public { } -} -// ---- -// TypeError: (47-69): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/parsing/tuples.sol b/test/libsolidity/syntaxTests/parsing/tuples.sol index 8266c94f..ca2f9d6b 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples.sol @@ -1,16 +1,16 @@ contract C { function f() public { uint a = (1); - (uint b,) = (1,); + (uint b,) = 1; (uint c, uint d) = (1, 2 + a); (uint e,) = (1, 2, b); (a) = 3; } } // ---- -// Warning: (54-70): Different number of components on the left hand side (2) than on the right hand side (1). -// Warning: (107-128): Different number of components on the left hand side (2) than on the right hand side (3). -// Warning: (75-81): Unused local variable. -// Warning: (83-89): Unused local variable. -// Warning: (108-114): Unused local variable. -// Warning: (14-143): Function state mutability can be restricted to pure +// Warning: (54-67): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (104-125): Different number of components on the left hand side (2) than on the right hand side (3). +// Warning: (72-78): Unused local variable. +// Warning: (80-86): Unused local variable. +// Warning: (105-111): Unused local variable. +// Warning: (14-140): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/tight_packing_literals.sol b/test/libsolidity/syntaxTests/tight_packing_literals.sol index be8482ff..a136aa77 100644 --- a/test/libsolidity/syntaxTests/tight_packing_literals.sol +++ b/test/libsolidity/syntaxTests/tight_packing_literals.sol @@ -5,4 +5,4 @@ contract C { } // ---- -// Warning: (92-93): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning. +// TypeError: (92-93): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/tight_packing_literals_050.sol b/test/libsolidity/syntaxTests/tight_packing_literals_050.sol deleted file mode 100644 index 4e6210c6..00000000 --- a/test/libsolidity/syntaxTests/tight_packing_literals_050.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function k() pure public returns (bytes) { - return abi.encodePacked(1); - } -} - -// ---- -// TypeError: (122-123): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_function.sol b/test/libsolidity/syntaxTests/types/empty_tuple_function.sol index 05b54442..ff31d440 100644 --- a/test/libsolidity/syntaxTests/types/empty_tuple_function.sol +++ b/test/libsolidity/syntaxTests/types/empty_tuple_function.sol @@ -8,5 +8,5 @@ contract C { } } // ---- -// Warning: (162-165): Tuple component cannot be empty. -// Warning: (181-184): Tuple component cannot be empty. +// TypeError: (162-165): Tuple component cannot be empty. +// TypeError: (181-184): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_function_050.sol b/test/libsolidity/syntaxTests/types/empty_tuple_function_050.sol deleted file mode 100644 index c4b9e03f..00000000 --- a/test/libsolidity/syntaxTests/types/empty_tuple_function_050.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() private pure {} - function a() public pure { - bool x = true; - bool y = true; - (x) ? (f(), y = false) : (f(), y = false); - } -} -// ---- -// TypeError: (168-171): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol index cba30c1b..3d252f0b 100644 --- a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol +++ b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue.sol @@ -8,6 +8,6 @@ contract C { } } // ---- -// Warning: (146-149): Tuple component cannot be empty. -// Warning: (151-154): Tuple component cannot be empty. +// TypeError: (146-149): Tuple component cannot be empty. +// TypeError: (151-154): Tuple component cannot be empty. // TypeError: (145-155): Type tuple(tuple(),tuple()) is not implicitly convertible to expected type tuple(uint256,uint256). diff --git a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue_050.sol b/test/libsolidity/syntaxTests/types/empty_tuple_lvalue_050.sol deleted file mode 100644 index b0691778..00000000 --- a/test/libsolidity/syntaxTests/types/empty_tuple_lvalue_050.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() private pure {} - function a() public { - uint x; - uint y; - (x, y) = (f(), f()); - } -} -// ---- -// TypeError: (152-155): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/types/no_singleton_tuple.sol b/test/libsolidity/syntaxTests/types/no_singleton_tuple.sol new file mode 100644 index 00000000..62a58f83 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/no_singleton_tuple.sol @@ -0,0 +1,8 @@ +contract C { + function f() public pure { + uint a; + (a,) = (uint(1),); + } +} +// ---- +// TypeError: (60-70): Tuple component cannot be empty. diff --git a/test/libsolidity/syntaxTests/types/rational_number_exp_limit.sol b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol index 6785f580..058db2e9 100644 --- a/test/libsolidity/syntaxTests/types/rational_number_exp_limit.sol +++ b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fail.sol @@ -4,9 +4,6 @@ contract c { a = 4 ** 4 ** 2 ** 4 ** 4 ** 4 ** 4; a = -4 ** 4 ** 2 ** 4 ** 4 ** 4 ** 4 ** 4; a = 4 ** (-(2 ** 4 ** 4 ** 4 ** 4 ** 4)); - a = 0 ** 1E1233; // fine - a = 1 ** 1E1233; // fine - a = -1 ** 1E1233; // fine a = 2 ** 1E1233; a = -2 ** 1E1233; a = 2 ** -1E1233; @@ -28,23 +25,23 @@ contract c { // TypeError: (116-153): Operator ** not compatible with types int_const 1797...(301 digits omitted)...7216 and int_const 4 // TypeError: (116-153): Type int_const 1797...(301 digits omitted)...7216 is not implicitly convertible to expected type int256. // TypeError: (167-203): Operator ** not compatible with types int_const 4 and int_const -179...(302 digits omitted)...7216 -// TypeError: (317-328): Operator ** not compatible with types int_const 2 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (342-354): Operator ** not compatible with types int_const -2 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (368-380): Operator ** not compatible with types int_const 2 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (394-407): Operator ** not compatible with types int_const -2 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (421-432): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2 -// TypeError: (421-432): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (446-458): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 2 -// TypeError: (446-458): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (472-484): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -2 -// TypeError: (472-484): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (498-511): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -2 -// TypeError: (498-511): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (525-541): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (525-541): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (555-572): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (555-572): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (586-603): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 -// TypeError: (586-603): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. -// TypeError: (617-635): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 -// TypeError: (617-635): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (217-228): Operator ** not compatible with types int_const 2 and int_const 1000...(1226 digits omitted)...0000 +// TypeError: (242-254): Operator ** not compatible with types int_const -2 and int_const 1000...(1226 digits omitted)...0000 +// TypeError: (268-280): Operator ** not compatible with types int_const 2 and int_const -100...(1227 digits omitted)...0000 +// TypeError: (294-307): Operator ** not compatible with types int_const -2 and int_const -100...(1227 digits omitted)...0000 +// TypeError: (321-332): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 2 +// TypeError: (321-332): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (346-358): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 2 +// TypeError: (346-358): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (372-384): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -2 +// TypeError: (372-384): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (398-411): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -2 +// TypeError: (398-411): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (425-441): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 +// TypeError: (425-441): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (455-472): Operator ** not compatible with types int_const 1000...(1226 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 +// TypeError: (455-472): Type int_const 1000...(1226 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (486-503): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const 1000...(1226 digits omitted)...0000 +// TypeError: (486-503): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. +// TypeError: (517-535): Operator ** not compatible with types int_const -100...(1227 digits omitted)...0000 and int_const -100...(1227 digits omitted)...0000 +// TypeError: (517-535): Type int_const -100...(1227 digits omitted)...0000 is not implicitly convertible to expected type int256. diff --git a/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fine.sol b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fine.sol new file mode 100644 index 00000000..66d02eb9 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/rational_number_exp_limit_fine.sol @@ -0,0 +1,9 @@ +contract c { + function f() public pure { + int a; + a = 0 ** 1E1233; + a = 1 ** 1E1233; + a = -1 ** 1E1233; + a = 0E123456789; + } +} diff --git a/test/libsolidity/syntaxTests/types/var_type_suggest.sol b/test/libsolidity/syntaxTests/types/var_type_suggest.sol new file mode 100644 index 00000000..176fab96 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/var_type_suggest.sol @@ -0,0 +1,23 @@ +contract C { + function h() internal pure returns (uint, uint, uint) { + return (1, 2, 4); + } + function g(uint x) internal pure returns (uint) { + return x; + } + function f() internal pure { + var i = 31415; + var t = "string"; + var g2 = g; + var myblockhash = block.blockhash; + var (a, b) = (2, "troi"); + var (x,, z) = h(); + } +} +// ---- +// SyntaxError: (224-237): Use of the "var" keyword is disallowed. Use explicit declaration `uint16 i = ...´ instead. +// SyntaxError: (247-263): Use of the "var" keyword is disallowed. Use explicit declaration `string memory t = ...´ instead. +// SyntaxError: (273-283): Use of the "var" keyword is disallowed. Use explicit declaration `function (uint256) pure returns (uint256) g2 = ...´ instead. +// SyntaxError: (293-326): Use of the "var" keyword is disallowed. Type cannot be expressed in syntax. +// SyntaxError: (336-360): Use of the "var" keyword is disallowed. Use explicit declaration `(uint8 a, string memory b) = ...´ instead. +// SyntaxError: (370-387): Use of the "var" keyword is disallowed. Use explicit declaration `(uint256 x, , uint256 z) = ...´ instead. |