Update existing tests.

This commit is contained in:
chriseth 2020-06-16 03:35:09 +02:00
parent 9324fb4f20
commit e9f91edc4b
70 changed files with 84 additions and 7 deletions

View File

@ -292,7 +292,7 @@ bool FunctionDefinition::libraryFunction() const
Visibility FunctionDefinition::defaultVisibility() const
{
solAssert(!isConstructor(), "");
return Declaration::defaultVisibility();
return isFree() ? Visibility::Internal : Declaration::defaultVisibility();
}
FunctionTypePointer FunctionDefinition::functionType(bool _internal) const

View File

@ -852,9 +852,6 @@ public:
ContractDefinition const* _searchStart = nullptr
) const override;
protected:
Visibility defaultVisibility() const override { return isFree() ? Visibility::Internal : Visibility::Public; }
private:
StateMutability m_stateMutability;
bool m_free;

View File

@ -58,6 +58,7 @@ JSON AST:
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": true,
"kind": "constructor",
@ -120,6 +121,7 @@ JSON AST:
{
"attributes":
{
"freeFunction": false,
"functionSelector": "af11c34c",
"implemented": true,
"isConstructor": false,

View File

@ -1,4 +1,4 @@
Error: Expected pragma, import directive or contract/interface/library/struct/enum definition.
Error: Expected pragma, import directive or contract/interface/library/struct/enum/function definition.
--> recovery_ast_empty_contract/input.sol:3:1:
|
3 | c

View File

@ -1 +1 @@
{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":6,"linearizedBaseContracts":[6],"name":"C","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"97:2:0","statements":[]},"documentation":null,"functionSelector":"26121ff0","id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nodeType":"FunctionDefinition","overrides":null,"parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"82:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"97:0:0"},"scope":6,"src":"72:27:0","stateMutability":"pure","virtual":false,"visibility":"public"}],"scope":7,"src":"59:42:0"}],"src":"36:65:0"},"id":0}}}
{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":6,"linearizedBaseContracts":[6],"name":"C","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"97:2:0","statements":[]},"documentation":null,"freeFunction":false,"functionSelector":"26121ff0","id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nodeType":"FunctionDefinition","overrides":null,"parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"82:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"97:0:0"},"scope":6,"src":"72:27:0","stateMutability":"pure","virtual":false,"visibility":"public"}],"scope":7,"src":"59:42:0"}],"src":"36:65:0"},"id":0}}}

View File

@ -34,6 +34,7 @@
"src": "37:4:1",
"statements": []
},
"freeFunction": false,
"id": 4,
"implemented": true,
"kind": "constructor",

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": true,
"kind": "constructor",

View File

@ -462,6 +462,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "fc68521a",
"id": 38,
"implemented": true,

View File

@ -91,6 +91,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "fc68521a",
"implemented": true,
"isConstructor": false,

View File

@ -131,6 +131,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "b582ec5f",
"id": 5,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "b582ec5f",
"implemented": true,
"isConstructor": false,

View File

@ -56,6 +56,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "e2179b8e",
"id": 5,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "e2179b8e",
"implemented": true,
"isConstructor": false,

View File

@ -118,6 +118,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "b8c9d365",
"id": 5,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "b8c9d365",
"implemented": true,
"isConstructor": false,

View File

@ -68,6 +68,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "ece866b9",
"id": 5,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "ece866b9",
"implemented": true,
"isConstructor": false,

View File

@ -131,6 +131,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "e2179b8e",
"id": 5,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "e2179b8e",
"implemented": true,
"isConstructor": false,

View File

@ -95,6 +95,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 7,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -196,6 +196,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "ffae15ba",
"id": 10,
"implemented": true,

View File

@ -112,6 +112,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "ffae15ba",
"implemented": true,
"isConstructor": false,

View File

@ -72,6 +72,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "5a2ee019",
"id": 5,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "5a2ee019",
"implemented": true,
"isConstructor": false,

View File

@ -180,6 +180,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 5,
"implemented": true,

View File

@ -95,6 +95,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "e2179b8e",
"id": 5,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "e2179b8e",
"implemented": true,
"isConstructor": false,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -121,6 +121,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 8,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -34,6 +34,7 @@
"src": "28:4:1",
"statements": []
},
"freeFunction": false,
"id": 4,
"implemented": true,
"kind": "constructor",

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": true,
"kind": "constructor",

View File

@ -216,6 +216,7 @@
"src": "162:25:3",
"text": "Some comment on fn."
},
"freeFunction": false,
"functionSelector": "a4a2c40b",
"id": 22,
"implemented": true,

View File

@ -161,6 +161,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "a4a2c40b",
"implemented": true,
"isConstructor": false,

View File

@ -34,6 +34,7 @@
"src": "43:5:1",
"statements": []
},
"freeFunction": false,
"id": 4,
"implemented": true,
"kind": "fallback",

View File

@ -34,6 +34,7 @@
"src": "42:5:1",
"statements": []
},
"freeFunction": false,
"id": 4,
"implemented": true,
"kind": "receive",
@ -68,6 +69,7 @@
"src": "78:5:1",
"statements": []
},
"freeFunction": false,
"id": 8,
"implemented": true,
"kind": "fallback",

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": false,
"kind": "receive",
@ -100,6 +101,7 @@
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": false,
"kind": "fallback",

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": false,
"kind": "fallback",

View File

@ -34,6 +34,7 @@
"src": "34:2:1",
"statements": []
},
"freeFunction": false,
"id": 4,
"implemented": true,
"kind": "fallback",

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": false,
"kind": "fallback",

View File

@ -34,6 +34,7 @@
"src": "120:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "d6cd4974",
"id": 16,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "d6cd4974",
"implemented": true,
"isConstructor": false,

View File

@ -134,6 +134,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 10,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -142,6 +142,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 14,
"implemented": true,

View File

@ -79,6 +79,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -94,6 +94,7 @@
"src": "64:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "28811f59",
"id": 13,
"implemented": true,

View File

@ -102,6 +102,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "28811f59",
"implemented": true,
"isConstructor": false,

View File

@ -94,6 +94,7 @@
"src": "64:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "28811f59",
"id": 13,
"implemented": true,

View File

@ -102,6 +102,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "28811f59",
"implemented": true,
"isConstructor": false,

View File

@ -94,6 +94,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 8,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -42,6 +42,7 @@
"src": "36:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "a399b6a2",
"id": 4,
"implemented": true,
@ -113,6 +114,7 @@
"nodes":
[
{
"freeFunction": false,
"functionSelector": "c2985578",
"id": 10,
"implemented": false,
@ -152,6 +154,7 @@
"src": "115:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "a399b6a2",
"id": 15,
"implemented": true,
@ -243,6 +246,7 @@
"src": "170:3:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "c2985578",
"id": 23,
"implemented": true,
@ -289,6 +293,7 @@
"src": "212:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "a399b6a2",
"id": 30,
"implemented": true,

View File

@ -46,6 +46,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "a399b6a2",
"implemented": true,
"isConstructor": false,
@ -154,6 +155,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "c2985578",
"implemented": false,
"isConstructor": false,
@ -208,6 +210,7 @@
[
4
],
"freeFunction": false,
"functionSelector": "a399b6a2",
"implemented": true,
"isConstructor": false,
@ -334,6 +337,7 @@
[
10
],
"freeFunction": false,
"functionSelector": "c2985578",
"implemented": true,
"isConstructor": false,
@ -413,6 +417,7 @@
[
15
],
"freeFunction": false,
"functionSelector": "a399b6a2",
"implemented": true,
"isConstructor": false,

View File

@ -34,6 +34,7 @@
"src": "42:5:1",
"statements": []
},
"freeFunction": false,
"id": 4,
"implemented": true,
"kind": "receive",

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"implemented": true,
"isConstructor": false,
"kind": "receive",

View File

@ -88,6 +88,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 10,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -99,6 +99,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 11,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -131,6 +131,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 11,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -95,6 +95,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 8,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -42,6 +42,7 @@
"src": "45:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 4,
"implemented": true,
@ -96,6 +97,7 @@
"src": "95:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 9,
"implemented": true,
@ -199,6 +201,7 @@
"src": "160:2:1",
"statements": []
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 21,
"implemented": true,

View File

@ -46,6 +46,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,
@ -137,6 +138,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,
@ -272,6 +274,7 @@
4,
9
],
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -95,6 +95,7 @@
}
]
},
"freeFunction": false,
"functionSelector": "26121ff0",
"id": 8,
"implemented": true,

View File

@ -38,6 +38,7 @@
{
"attributes":
{
"freeFunction": false,
"functionSelector": "26121ff0",
"implemented": true,
"isConstructor": false,

View File

@ -1,3 +1,3 @@
unexpected
// ----
// ParserError 7858: (0-10): Expected pragma, import directive or contract/interface/library/struct/enum definition.
// ParserError 7858: (0-10): Expected pragma, import directive or contract/interface/library/struct/enum/function definition.