diff options
author | Leonardo Alt <leo@ethereum.org> | 2019-01-17 20:54:31 +0800 |
---|---|---|
committer | Leonardo Alt <leo@ethereum.org> | 2019-01-17 21:28:03 +0800 |
commit | 83e7233bb8923a83d7ecc093dae88b140336a137 (patch) | |
tree | bb0af447868101e4b36aa594c0e3170e9860d440 /test | |
parent | c96b760c472a134c59deb20c27e5252319c74e2b (diff) | |
download | dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar.gz dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar.bz2 dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar.lz dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar.xz dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar.zst dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.zip |
Change error message and add tests
Diffstat (limited to 'test')
4 files changed, 34 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_fractional.sol new file mode 100644 index 00000000..16c76d9a --- /dev/null +++ b/test/libsolidity/syntaxTests/types/encoding_fractional.sol @@ -0,0 +1,7 @@ +contract C { + function f1() public pure returns (bytes memory) { + return abi.encode(0.1, 1); + } +} +// ---- +// TypeError: (92-95): Fractional numbers cannot yet be encoded. diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol new file mode 100644 index 00000000..80efa9c5 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol @@ -0,0 +1,9 @@ +pragma experimental ABIEncoderV2; +contract C { + function f1() public pure returns (bytes memory) { + return abi.encode(0.1, 1); + } +} +// ---- +// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. +// TypeError: (126-129): Fractional numbers cannot yet be encoded. diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol new file mode 100644 index 00000000..71080cb0 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol @@ -0,0 +1,8 @@ +contract C { + function f1() public pure returns (bytes memory) { + return abi.encodePacked(0.1, 1); + } +} +// ---- +// TypeError: (98-101): Fractional numbers cannot yet be encoded. +// TypeError: (103-104): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol new file mode 100644 index 00000000..e82c3c9a --- /dev/null +++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol @@ -0,0 +1,10 @@ +pragma experimental ABIEncoderV2; +contract C { + function f1() public pure returns (bytes memory) { + return abi.encodePacked(0.1, 1); + } +} +// ---- +// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. +// TypeError: (132-135): Fractional numbers cannot yet be encoded. +// TypeError: (137-138): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. |