diff options
author | Christian Parpart <christian@ethereum.org> | 2018-07-02 23:00:09 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-07-11 04:14:19 +0800 |
commit | 1505e28b56c3a90abdb606ed1389394d7918d7eb (patch) | |
tree | dc7e6da3a8ce720de73313065cceb6ec9f34cc9b /test/libsolidity | |
parent | d84976dc871a1fdfab233650b989af69e325bf2b (diff) | |
download | dexon-solidity-1505e28b56c3a90abdb606ed1389394d7918d7eb.tar dexon-solidity-1505e28b56c3a90abdb606ed1389394d7918d7eb.tar.gz dexon-solidity-1505e28b56c3a90abdb606ed1389394d7918d7eb.tar.bz2 dexon-solidity-1505e28b56c3a90abdb606ed1389394d7918d7eb.tar.lz dexon-solidity-1505e28b56c3a90abdb606ed1389394d7918d7eb.tar.xz dexon-solidity-1505e28b56c3a90abdb606ed1389394d7918d7eb.tar.zst dexon-solidity-1505e28b56c3a90abdb606ed1389394d7918d7eb.zip |
semantics: Suggest auto-deduced type when user declares variable with `var` keyword.
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/syntaxTests/types/var_type_suggest.sol | 23 |
1 files changed, 23 insertions, 0 deletions
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. |