forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make literals an error for tight packing (experimental 0.5.0)
- Loading branch information
Showing
3 changed files
with
45 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/libsolidity/syntaxTests/tight_packing_literals_050.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
pragma experimental "v0.5.0"; | ||
contract C { | ||
function f() pure public returns (bytes32) { | ||
return keccak256(1); | ||
} | ||
function g() pure public returns (bytes32) { | ||
return sha3(1); | ||
} | ||
function h() pure public returns (bytes32) { | ||
return sha256(1); | ||
} | ||
function j() pure public returns (bytes32) { | ||
return ripemd160(1); | ||
} | ||
function k() pure public returns (bytes) { | ||
return abi.encodePacked(1); | ||
} | ||
} | ||
|
||
// ---- | ||
// TypeError: (117-118): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. | ||
// Warning: (191-198): "sha3" has been deprecated in favour of "keccak256" | ||
// TypeError: (196-197): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. | ||
// TypeError: (277-278): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. | ||
// TypeError: (361-362): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. | ||
// TypeError: (450-451): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. |