mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7374 from ethereum/hexStringUnderscores
Allow underscores in hex strings.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure returns(bytes memory) {
|
||||
return hex"12_34_5678_9A";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f() -> 32, 5, left(0x123456789A)
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
hex"12__34";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (52-60): Invalid use of number separator '_'.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
hex"_1234";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (52-57): Invalid use of number separator '_'.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
hex"1_234";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (52-56): Expected even number of hex-nibbles.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
hex"1234_";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (52-61): Invalid use of number separator '_'.
|
||||
@@ -0,0 +1,3 @@
|
||||
contract C {
|
||||
bytes constant c = hex"12_3456_789012";
|
||||
}
|
||||
Reference in New Issue
Block a user