mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Change error message and add tests
This commit is contained in:
@@ -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.
|
||||
Reference in New Issue
Block a user