From 7d7abeb1496dddfab7eb8705dbfc3d06284cf25d Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Mon, 6 Aug 2018 14:59:37 +0200 Subject: Disallow ambiguous conversions between number literals and bytesXX types. --- .../libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol | 2 +- .../viewPureChecker/builtin_functions_restrict_warning.sol | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test/libsolidity/syntaxTests/viewPureChecker') diff --git a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol index 51e36a58..2cb185c9 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions.sol @@ -9,7 +9,7 @@ contract C { function g() pure public { bytes32 x = keccak256("abc"); bytes32 y = sha256("abc"); - address z = ecrecover(bytes32(1), uint8(2), bytes32(3), bytes32(4)); + address z = ecrecover(bytes32(uint256(1)), uint8(2), bytes32(uint256(3)), bytes32(uint256(4))); require(true); assert(true); x; y; z; diff --git a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol index 0b834022..4a651d21 100644 --- a/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol +++ b/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_restrict_warning.sol @@ -2,7 +2,7 @@ contract C { function f() view public { bytes32 x = keccak256("abc"); bytes32 y = sha256("abc"); - address z = ecrecover(bytes32(1), uint8(2), bytes32(3), bytes32(4)); + address z = ecrecover(bytes32(uint256(1)), uint8(2), bytes32(uint256(3)), bytes32(uint256(4))); require(true); assert(true); x; y; z; @@ -10,12 +10,12 @@ contract C { function g() public { bytes32 x = keccak256("abc"); bytes32 y = sha256("abc"); - address z = ecrecover(bytes32(1), uint8(2), bytes32(3), bytes32(4)); + address z = ecrecover(bytes32(uint256(1)), uint8(2), bytes32(uint256(3)), bytes32(uint256(4))); require(true); assert(true); x; y; z; } } // ---- -// Warning: (17-261): Function state mutability can be restricted to pure -// Warning: (266-505): Function state mutability can be restricted to pure +// Warning: (17-288): Function state mutability can be restricted to pure +// Warning: (293-559): Function state mutability can be restricted to pure -- cgit