Change error message and add tests

This commit is contained in:
Leonardo Alt
2019-01-17 14:28:03 +01:00
parent c96b760c47
commit 83e7233bb8
5 changed files with 35 additions and 1 deletions
@@ -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.
@@ -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.
@@ -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.
@@ -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.