Skip to content

Commit 5942f7d

Browse files
committed
Single HexStringLiteral and UntypedTupleMember with storageLocation
1 parent 3691c26 commit 5942f7d

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

tests/config/run-format-test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ const antlrMismatchTests = new Map(
8282
// ANTLR doesn't support assembly assignment operators separated by a space
8383
// like `: =` or `= :`
8484
"AssemblyV0.4.26/Assembly.sol",
85+
// ANTLR doesn't support UntypedTupleMember with a storage location, which
86+
// is valid Slang, but not in Solidity.
87+
"AllSolidityFeaturesV0.4.26/AllSolidityFeatures.sol",
8588
].map((fixture) => {
8689
const [file, compareBytecode = () => true] = Array.isArray(fixture)
8790
? fixture

tests/format/AllSolidityFeaturesV0.4.26/AllSolidityFeatures.sol

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ contract test {
1818
var b = 7 + (c * (8 - 7)) - x;
1919
return -(-b | 0);
2020
}
21+
22+
function singleHexString() payable {
23+
string storage a = hex"ab1248fe";
24+
}
25+
26+
27+
function storageLocationsInTuple() {
28+
var (
29+
memory foo,
30+
storage bar,
31+
baz) =
32+
(0, 0, 0);
33+
// ~~~~~~ ~~~~~~~ => these are the storage locations
34+
}
2135
}
2236

2337
contract c {

tests/format/AllSolidityFeaturesV0.4.26/__snapshots__/format.test.js.snap

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ contract test {
2727
var b = 7 + (c * (8 - 7)) - x;
2828
return -(-b | 0);
2929
}
30+
31+
function singleHexString() payable {
32+
string storage a = hex"ab1248fe";
33+
}
34+
35+
36+
function storageLocationsInTuple() {
37+
var (
38+
memory foo,
39+
storage bar,
40+
baz) =
41+
(0, 0, 0);
42+
// ~~~~~~ ~~~~~~~ => these are the storage locations
43+
}
3044
}
3145
3246
contract c {
@@ -225,6 +239,15 @@ contract test {
225239
var b = 7 + (c * (8 - 7)) - x;
226240
return -(-b | 0);
227241
}
242+
243+
function singleHexString() payable {
244+
string storage a = hex"ab1248fe";
245+
}
246+
247+
function storageLocationsInTuple() {
248+
var (memory foo, storage bar, baz) = (0, 0, 0);
249+
// ~~~~~~ ~~~~~~~ => these are the storage locations
250+
}
228251
}
229252
230253
contract c {

0 commit comments

Comments
 (0)