Skip to content

Commit 9ef590c

Browse files
authored
Merge pull request #12696 from ethereum/unreliableAstJsonTests
Fix unreliable ASTJson tests
2 parents 3f6beaa + 8a254b7 commit 9ef590c

28 files changed

+781
-247
lines changed

test/libsolidity/ASTJSON/address_payable.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,18 +423,19 @@
423423
"isPure": true,
424424
"lValueRequested": false,
425425
"nodeType": "ElementaryTypeNameExpression",
426-
"src": "239:7:1",
426+
"src": "239:8:1",
427427
"typeDescriptions":
428428
{
429-
"typeIdentifier": "t_type$_t_address_$",
430-
"typeString": "type(address)"
429+
"typeIdentifier": "t_type$_t_address_payable_$",
430+
"typeString": "type(address payable)"
431431
},
432432
"typeName":
433433
{
434434
"id": 31,
435435
"name": "address",
436436
"nodeType": "ElementaryTypeName",
437-
"src": "239:7:1",
437+
"src": "239:8:1",
438+
"stateMutability": "payable",
438439
"typeDescriptions": {}
439440
}
440441
},
@@ -450,8 +451,8 @@
450451
"tryCall": false,
451452
"typeDescriptions":
452453
{
453-
"typeIdentifier": "t_address",
454-
"typeString": "address"
454+
"typeIdentifier": "t_address_payable",
455+
"typeString": "address payable"
455456
}
456457
},
457458
"src": "232:17:1",

test/libsolidity/ASTJSON/address_payable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ contract C {
44
address payable a = m[arg];
55
r = arg;
66
address c = address(this);
7-
m[c] = address(0);
7+
m[c] = payable(0);
88
}
99
}
1010

test/libsolidity/ASTJSON/address_payable_parseOnly.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,15 @@
268268
{
269269
"id": 32,
270270
"nodeType": "ElementaryTypeNameExpression",
271-
"src": "239:7:1",
271+
"src": "239:8:1",
272272
"typeDescriptions": {},
273273
"typeName":
274274
{
275275
"id": 31,
276276
"name": "address",
277277
"nodeType": "ElementaryTypeName",
278-
"src": "239:7:1",
278+
"src": "239:8:1",
279+
"stateMutability": "payable",
279280
"typeDescriptions": {}
280281
}
281282
},

test/libsolidity/ASTJSON/assembly/nested_functions.json

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"canonicalName": "C",
1818
"contractDependencies": [],
1919
"contractKind": "contract",
20+
"fullyImplemented": true,
2021
"id": 8,
2122
"linearizedBaseContracts":
2223
[
@@ -32,21 +33,21 @@
3233
{
3334
"id": 6,
3435
"nodeType": "Block",
35-
"src": "57:97:1",
36+
"src": "57:95:1",
3637
"statements":
3738
[
3839
{
3940
"AST":
4041
{
4142
"nodeType": "YulBlock",
42-
"src": "72:78:1",
43+
"src": "72:76:1",
4344
"statements":
4445
[
4546
{
4647
"body":
4748
{
4849
"nodeType": "YulBlock",
49-
"src": "94:50:1",
50+
"src": "94:35:1",
5051
"statements":
5152
[
5253
{
@@ -59,43 +60,53 @@
5960
"name": "f2",
6061
"nodeType": "YulFunctionDefinition",
6162
"src": "104:17:1"
62-
},
63-
{
64-
"nodeType": "YulAssignment",
65-
"src": "130:6:1",
66-
"value":
67-
{
68-
"kind": "number",
69-
"nodeType": "YulLiteral",
70-
"src": "135:1:1",
71-
"type": "",
72-
"value": "2"
73-
},
74-
"variableNames":
75-
[
76-
{
77-
"name": "x",
78-
"nodeType": "YulIdentifier",
79-
"src": "130:1:1"
80-
}
81-
]
8263
}
8364
]
8465
},
8566
"name": "f1",
8667
"nodeType": "YulFunctionDefinition",
87-
"src": "80:64:1"
68+
"src": "80:49:1"
69+
},
70+
{
71+
"nodeType": "YulAssignment",
72+
"src": "136:6:1",
73+
"value":
74+
{
75+
"kind": "number",
76+
"nodeType": "YulLiteral",
77+
"src": "141:1:1",
78+
"type": "",
79+
"value": "2"
80+
},
81+
"variableNames":
82+
[
83+
{
84+
"name": "x",
85+
"nodeType": "YulIdentifier",
86+
"src": "136:1:1"
87+
}
88+
]
8889
}
8990
]
9091
},
9192
"evmVersion": %EVMVERSION%,
92-
"externalReferences": [],
93+
"externalReferences":
94+
[
95+
{
96+
"declaration": 3,
97+
"isOffset": false,
98+
"isSlot": false,
99+
"src": "136:1:1",
100+
"valueSize": 1
101+
}
102+
],
93103
"id": 5,
94104
"nodeType": "InlineAssembly",
95-
"src": "63:87:1"
105+
"src": "63:85:1"
96106
}
97107
]
98108
},
109+
"functionSelector": "26121ff0",
99110
"id": 7,
100111
"implemented": true,
101112
"kind": "function",
@@ -127,31 +138,39 @@
127138
"src": "49:6:1",
128139
"stateVariable": false,
129140
"storageLocation": "default",
130-
"typeDescriptions": {},
141+
"typeDescriptions":
142+
{
143+
"typeIdentifier": "t_uint256",
144+
"typeString": "uint256"
145+
},
131146
"typeName":
132147
{
133148
"id": 2,
134149
"name": "uint",
135150
"nodeType": "ElementaryTypeName",
136151
"src": "49:4:1",
137-
"typeDescriptions": {}
152+
"typeDescriptions":
153+
{
154+
"typeIdentifier": "t_uint256",
155+
"typeString": "uint256"
156+
}
138157
},
139158
"visibility": "internal"
140159
}
141160
],
142161
"src": "48:8:1"
143162
},
144163
"scope": 8,
145-
"src": "15:139:1",
164+
"src": "15:137:1",
146165
"stateMutability": "pure",
147166
"virtual": false,
148167
"visibility": "public"
149168
}
150169
],
151170
"scope": 9,
152-
"src": "0:156:1",
171+
"src": "0:154:1",
153172
"usedErrors": []
154173
}
155174
],
156-
"src": "0:157:1"
175+
"src": "0:155:1"
157176
}

test/libsolidity/ASTJSON/assembly/nested_functions.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ contract C {
33
assembly {
44
function f1() {
55
function f2() { }
6-
x := 2
76
}
7+
x := 2
88
}
99
}
1010
}

test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@
2020
{
2121
"id": 6,
2222
"nodeType": "Block",
23-
"src": "57:97:1",
23+
"src": "57:95:1",
2424
"statements":
2525
[
2626
{
2727
"AST":
2828
{
2929
"nodeType": "YulBlock",
30-
"src": "72:78:1",
30+
"src": "72:76:1",
3131
"statements":
3232
[
3333
{
3434
"body":
3535
{
3636
"nodeType": "YulBlock",
37-
"src": "94:50:1",
37+
"src": "94:35:1",
3838
"statements":
3939
[
4040
{
@@ -47,40 +47,40 @@
4747
"name": "f2",
4848
"nodeType": "YulFunctionDefinition",
4949
"src": "104:17:1"
50-
},
51-
{
52-
"nodeType": "YulAssignment",
53-
"src": "130:6:1",
54-
"value":
55-
{
56-
"kind": "number",
57-
"nodeType": "YulLiteral",
58-
"src": "135:1:1",
59-
"type": "",
60-
"value": "2"
61-
},
62-
"variableNames":
63-
[
64-
{
65-
"name": "x",
66-
"nodeType": "YulIdentifier",
67-
"src": "130:1:1"
68-
}
69-
]
7050
}
7151
]
7252
},
7353
"name": "f1",
7454
"nodeType": "YulFunctionDefinition",
75-
"src": "80:64:1"
55+
"src": "80:49:1"
56+
},
57+
{
58+
"nodeType": "YulAssignment",
59+
"src": "136:6:1",
60+
"value":
61+
{
62+
"kind": "number",
63+
"nodeType": "YulLiteral",
64+
"src": "141:1:1",
65+
"type": "",
66+
"value": "2"
67+
},
68+
"variableNames":
69+
[
70+
{
71+
"name": "x",
72+
"nodeType": "YulIdentifier",
73+
"src": "136:1:1"
74+
}
75+
]
7676
}
7777
]
7878
},
7979
"evmVersion": %EVMVERSION%,
8080
"externalReferences": [],
8181
"id": 5,
8282
"nodeType": "InlineAssembly",
83-
"src": "63:87:1"
83+
"src": "63:85:1"
8484
}
8585
]
8686
},
@@ -128,15 +128,15 @@
128128
],
129129
"src": "48:8:1"
130130
},
131-
"src": "15:139:1",
131+
"src": "15:137:1",
132132
"stateMutability": "pure",
133133
"virtual": false,
134134
"visibility": "public"
135135
}
136136
],
137-
"src": "0:156:1",
137+
"src": "0:154:1",
138138
"usedErrors": []
139139
}
140140
],
141-
"src": "0:157:1"
141+
"src": "0:155:1"
142142
}

0 commit comments

Comments
 (0)