mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fixes large rational number literals being wrongly interpreted.
Fixes #5052.
This commit is contained in:
committed by
chriseth
parent
547b26d464
commit
4d5216c2e0
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f(uint y) public pure {
|
||||
// fits FixedBytes with exactly 32-bytes
|
||||
y = 0xffffffff00000000ffffffff00000000ffffffff00000000ffffffff00000000; // FixedBytes (32)
|
||||
|
||||
// fits exactly into FixedBytes (32), ensures underscored literals won't hurt
|
||||
y = 0xffffffff00000000ffffffff00000000ffffffff00000000ffffffff_00000000;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f(uint y) public pure {
|
||||
// one byte too long for storing in Fixedbytes (would require 33 bytes)
|
||||
y = 0xffffffff00000000ffffffff00000000ffffffff00000000ffffffff000000001;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (142-209): Type int_const 1852...(71 digits omitted)...7281 is not implicitly convertible to expected type uint256.
|
||||
Reference in New Issue
Block a user