Skip to content

Commit

Permalink
Merge pull request #12696 from ethereum/unreliableAstJsonTests
Browse files Browse the repository at this point in the history
Fix unreliable ASTJson tests
  • Loading branch information
chriseth authored Mar 14, 2022
2 parents 3f6beaa + 8a254b7 commit 9ef590c
Show file tree
Hide file tree
Showing 28 changed files with 781 additions and 247 deletions.
13 changes: 7 additions & 6 deletions test/libsolidity/ASTJSON/address_payable.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,19 @@
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "239:7:1",
"src": "239:8:1",
"typeDescriptions":
{
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
"typeIdentifier": "t_type$_t_address_payable_$",
"typeString": "type(address payable)"
},
"typeName":
{
"id": 31,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "239:7:1",
"src": "239:8:1",
"stateMutability": "payable",
"typeDescriptions": {}
}
},
Expand All @@ -450,8 +451,8 @@
"tryCall": false,
"typeDescriptions":
{
"typeIdentifier": "t_address",
"typeString": "address"
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "232:17:1",
Expand Down
2 changes: 1 addition & 1 deletion test/libsolidity/ASTJSON/address_payable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ contract C {
address payable a = m[arg];
r = arg;
address c = address(this);
m[c] = address(0);
m[c] = payable(0);
}
}

Expand Down
5 changes: 3 additions & 2 deletions test/libsolidity/ASTJSON/address_payable_parseOnly.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,15 @@
{
"id": 32,
"nodeType": "ElementaryTypeNameExpression",
"src": "239:7:1",
"src": "239:8:1",
"typeDescriptions": {},
"typeName":
{
"id": 31,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "239:7:1",
"src": "239:8:1",
"stateMutability": "payable",
"typeDescriptions": {}
}
},
Expand Down
81 changes: 50 additions & 31 deletions test/libsolidity/ASTJSON/assembly/nested_functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"canonicalName": "C",
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 8,
"linearizedBaseContracts":
[
Expand All @@ -32,21 +33,21 @@
{
"id": 6,
"nodeType": "Block",
"src": "57:97:1",
"src": "57:95:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "72:78:1",
"src": "72:76:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "94:50:1",
"src": "94:35:1",
"statements":
[
{
Expand All @@ -59,43 +60,53 @@
"name": "f2",
"nodeType": "YulFunctionDefinition",
"src": "104:17:1"
},
{
"nodeType": "YulAssignment",
"src": "130:6:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "135:1:1",
"type": "",
"value": "2"
},
"variableNames":
[
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "130:1:1"
}
]
}
]
},
"name": "f1",
"nodeType": "YulFunctionDefinition",
"src": "80:64:1"
"src": "80:49:1"
},
{
"nodeType": "YulAssignment",
"src": "136:6:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "141:1:1",
"type": "",
"value": "2"
},
"variableNames":
[
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "136:1:1"
}
]
}
]
},
"evmVersion": %EVMVERSION%,
"externalReferences": [],
"externalReferences":
[
{
"declaration": 3,
"isOffset": false,
"isSlot": false,
"src": "136:1:1",
"valueSize": 1
}
],
"id": 5,
"nodeType": "InlineAssembly",
"src": "63:87:1"
"src": "63:85:1"
}
]
},
"functionSelector": "26121ff0",
"id": 7,
"implemented": true,
"kind": "function",
Expand Down Expand Up @@ -127,31 +138,39 @@
"src": "49:6:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {},
"typeDescriptions":
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName":
{
"id": 2,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "49:4:1",
"typeDescriptions": {}
"typeDescriptions":
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "48:8:1"
},
"scope": 8,
"src": "15:139:1",
"src": "15:137:1",
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
}
],
"scope": 9,
"src": "0:156:1",
"src": "0:154:1",
"usedErrors": []
}
],
"src": "0:157:1"
"src": "0:155:1"
}
2 changes: 1 addition & 1 deletion test/libsolidity/ASTJSON/assembly/nested_functions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ contract C {
assembly {
function f1() {
function f2() { }
x := 2
}
x := 2
}
}
}
Expand Down
56 changes: 28 additions & 28 deletions test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
{
"id": 6,
"nodeType": "Block",
"src": "57:97:1",
"src": "57:95:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "72:78:1",
"src": "72:76:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "94:50:1",
"src": "94:35:1",
"statements":
[
{
Expand All @@ -47,40 +47,40 @@
"name": "f2",
"nodeType": "YulFunctionDefinition",
"src": "104:17:1"
},
{
"nodeType": "YulAssignment",
"src": "130:6:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "135:1:1",
"type": "",
"value": "2"
},
"variableNames":
[
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "130:1:1"
}
]
}
]
},
"name": "f1",
"nodeType": "YulFunctionDefinition",
"src": "80:64:1"
"src": "80:49:1"
},
{
"nodeType": "YulAssignment",
"src": "136:6:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "141:1:1",
"type": "",
"value": "2"
},
"variableNames":
[
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "136:1:1"
}
]
}
]
},
"evmVersion": %EVMVERSION%,
"externalReferences": [],
"id": 5,
"nodeType": "InlineAssembly",
"src": "63:87:1"
"src": "63:85:1"
}
]
},
Expand Down Expand Up @@ -128,15 +128,15 @@
],
"src": "48:8:1"
},
"src": "15:139:1",
"src": "15:137:1",
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
}
],
"src": "0:156:1",
"src": "0:154:1",
"usedErrors": []
}
],
"src": "0:157:1"
"src": "0:155:1"
}
Loading

0 comments on commit 9ef590c

Please sign in to comment.