mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into develop_060
This commit is contained in:
+1
-1
@@ -5,4 +5,4 @@
|
||||
"compiler-fixed": "off",
|
||||
"no-inline-assembly": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
require_overload/input.sol:4:9: Error: No matching declaration found after argument-dependent lookup.
|
||||
require(this);
|
||||
^-----^
|
||||
Candidate: function require(bool)
|
||||
Candidate: function require(bool, string memory)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,6 @@
|
||||
pragma solidity >=0.0;
|
||||
contract C {
|
||||
function f() public pure {
|
||||
require(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { bytes s1 = \"test\"; bytes s2; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"s1","offset":0,"slot":"0","type":"t_bytes_storage"},{"astId":5,"contract":"fileA:A","label":"s2","offset":0,"slot":"1","type":"t_bytes_storage"}],"types":{"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { bytes s1 = \"test\"; bytes s2; }
|
||||
^-----------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":43,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { uint[] array1; bool[] array2; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"array1","offset":0,"slot":"0","type":"t_array(t_uint256)dyn_storage"},{"astId":6,"contract":"fileA:A","label":"array2","offset":0,"slot":"1","type":"t_array(t_bool)dyn_storage"}],"types":{"t_array(t_bool)dyn_storage":{"base":"t_bool","encoding":"dynamic_array","label":"bool[]","numberOfBytes":"32"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { uint[] array1; bool[] array2; }
|
||||
^------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":44,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { struct S { uint128 a; uint128 b; uint[2] staticArray; uint[] dynArray; } uint x; uint y; S s; address addr; mapping (uint => mapping (address => bool)) map; uint[] array; string s1; bytes b1; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"},{"astId":26,"contract":"fileA:A","label":"map","offset":0,"slot":"7","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"},{"astId":29,"contract":"fileA:A","label":"array","offset":0,"slot":"8","type":"t_array(t_uint256)dyn_storage"},{"astId":31,"contract":"fileA:A","label":"s1","offset":0,"slot":"9","type":"t_string_storage"},{"astId":33,"contract":"fileA:A","label":"b1","offset":0,"slot":"10","type":"t_bytes_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { struct S { uint128 a; ... int[] array; string s1; bytes b1; }
|
||||
^-------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":206,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { uint x; uint y; mapping (uint => mapping (address => bool)) map; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":10,"contract":"fileA:A","label":"map","offset":0,"slot":"2","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { uint x; uint y; mapping (uint => mapping (address => bool)) map; }
|
||||
^-----------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":79,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[],"types":null}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { }
|
||||
^------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":14,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { }"
|
||||
},
|
||||
"fileB": {
|
||||
"content": "contract A { uint x; uint y; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[],"types":null}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { }
|
||||
^------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":14,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0},"fileB":{"id":1}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { string s1 = \"test\"; string s2; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":3,"contract":"fileA:A","label":"s1","offset":0,"slot":"0","type":"t_string_storage"},{"astId":5,"contract":"fileA:A","label":"s2","offset":0,"slot":"1","type":"t_string_storage"}],"types":{"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { string s1 = \"test\"; string s2; }
|
||||
^-------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":45,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { struct S { uint a; uint b; uint[2] staticArray; uint[] dynArray; } uint x; uint y; S s; address addr; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"7","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"b","offset":0,"slot":"1","type":"t_uint256"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"2","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"4","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { struct S { uint a; uint b; uint[2] staticArray; uint[] dynArray; } uint x; uint y; S s; address addr; }
|
||||
^------------------------------------------------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":116,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { struct S { uint128 a; uint128 b; uint[2] staticArray; uint[] dynArray; } uint x; uint y; S s; address addr; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { struct S { uint128 a; uint128 b; uint[2] staticArray; uint[] dynArray; } uint x; uint y; S s; address addr; }
|
||||
^------------------------------------------------------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":122,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { uint x; uint y; address addr; uint[2] array; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":6,"contract":"fileA:A","label":"addr","offset":0,"slot":"2","type":"t_address"},{"astId":10,"contract":"fileA:A","label":"array","offset":0,"slot":"3","type":"t_array(t_uint256)2_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { uint x; uint y; address addr; uint[2] array; }
|
||||
^---------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":59,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"fileA": {
|
||||
"content": "contract A { uint64 x; uint128 y; uint128 z; address addr; uint[2] array; }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"fileA": {
|
||||
"A": [ "storageLayout" ],
|
||||
"": [ "storageLayout" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":2,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint64"},{"astId":4,"contract":"fileA:A","label":"y","offset":8,"slot":"0","type":"t_uint128"},{"astId":6,"contract":"fileA:A","label":"z","offset":0,"slot":"1","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"addr","offset":0,"slot":"2","type":"t_address"},{"astId":12,"contract":"fileA:A","label":"array","offset":0,"slot":"3","type":"t_array(t_uint256)2_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"},"t_uint64":{"encoding":"inplace","label":"uint64","numberOfBytes":"8"}}}}}},"errors":[{"component":"general","formattedMessage":"fileA:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A { uint64 x; uint128 y; uint128 z; address addr; uint[2] array; }
|
||||
^-------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":75,"file":"fileA","start":0},"type":"Warning"}],"sources":{"fileA":{"id":0}}}
|
||||
@@ -1,9 +1,14 @@
|
||||
contract X {}
|
||||
library test {
|
||||
struct StructType { uint a; }
|
||||
function f(StructType storage b, uint[] storage c, test d) public returns (uint[] memory e, StructType storage f) { f = f; }
|
||||
function f1(uint[] memory c, test d) public pure returns (uint[] memory e) { }
|
||||
function f(StructType storage b, uint[] storage c, X d) public returns (uint[] memory e, StructType storage f) { f = f; }
|
||||
function f1(uint[] memory c, X d) public pure returns (uint[] memory e) { }
|
||||
}
|
||||
// ----
|
||||
// :X
|
||||
// []
|
||||
//
|
||||
//
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
@@ -15,9 +20,9 @@ library test {
|
||||
// "type": "uint256[]"
|
||||
// },
|
||||
// {
|
||||
// "internalType": "library test",
|
||||
// "internalType": "contract X",
|
||||
// "name": "d",
|
||||
// "type": "test"
|
||||
// "type": "X"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f1",
|
||||
|
||||
@@ -64,7 +64,7 @@ eth::AssemblyItems compileContract(std::shared_ptr<CharStream> _sourceCode)
|
||||
|
||||
map<ASTNode const*, shared_ptr<DeclarationContainer>> scopes;
|
||||
GlobalContext globalContext;
|
||||
NameAndTypeResolver resolver(globalContext, scopes, errorReporter);
|
||||
NameAndTypeResolver resolver(globalContext, dev::test::Options::get().evmVersion(), scopes, errorReporter);
|
||||
solAssert(Error::containsOnlyWarnings(errorReporter.errors()), "");
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
|
||||
|
||||
@@ -78,15 +78,34 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
|
||||
for (auto& test: m_tests)
|
||||
test.reset();
|
||||
|
||||
map<string, dev::test::Address> libraries;
|
||||
|
||||
bool constructed = false;
|
||||
|
||||
for (auto& test: m_tests)
|
||||
{
|
||||
if (&test == &m_tests.front())
|
||||
if (test.call().isConstructor)
|
||||
deploy("", test.call().value, test.call().arguments.rawBytes());
|
||||
else
|
||||
soltestAssert(deploy("", 0, bytes()), "Failed to deploy contract.");
|
||||
if (constructed)
|
||||
{
|
||||
soltestAssert(!test.call().isLibrary, "Libraries have to be deployed before any other call.");
|
||||
soltestAssert(!test.call().isConstructor, "Constructor has to be the first function call expect for library deployments.");
|
||||
}
|
||||
else if (test.call().isLibrary)
|
||||
{
|
||||
soltestAssert(
|
||||
deploy(test.call().signature, 0, {}, libraries) && m_transactionSuccessful,
|
||||
"Failed to deploy library " + test.call().signature
|
||||
);
|
||||
libraries[test.call().signature] = m_contractAddress;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
soltestAssert(!test.call().isConstructor, "Constructor has to be the first function call.");
|
||||
{
|
||||
if (test.call().isConstructor)
|
||||
deploy("", test.call().value, test.call().arguments.rawBytes(), libraries);
|
||||
else
|
||||
soltestAssert(deploy("", 0, bytes(), libraries), "Failed to deploy contract.");
|
||||
constructed = true;
|
||||
}
|
||||
|
||||
if (test.call().isConstructor)
|
||||
{
|
||||
@@ -171,8 +190,8 @@ void SemanticTest::parseExpectations(istream& _stream)
|
||||
std::move(functionCalls.begin(), functionCalls.end(), back_inserter(m_tests));
|
||||
}
|
||||
|
||||
bool SemanticTest::deploy(string const& _contractName, u256 const& _value, bytes const& _arguments)
|
||||
bool SemanticTest::deploy(string const& _contractName, u256 const& _value, bytes const& _arguments, map<string, dev::test::Address> const& _libraries)
|
||||
{
|
||||
auto output = compileAndRunWithoutCheck(m_source, _value, _contractName, _arguments);
|
||||
auto output = compileAndRunWithoutCheck(m_source, _value, _contractName, _arguments, _libraries);
|
||||
return !output.empty() && m_transactionSuccessful;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
/// Compiles and deploys currently held source.
|
||||
/// Returns true if deployment was successful, false otherwise.
|
||||
bool deploy(std::string const& _contractName, u256 const& _value, bytes const& _arguments);
|
||||
bool deploy(std::string const& _contractName, u256 const& _value, bytes const& _arguments, std::map<std::string, dev::test::Address> const& _libraries = {});
|
||||
|
||||
private:
|
||||
std::string m_source;
|
||||
|
||||
@@ -118,7 +118,7 @@ bytes compileFirstExpression(
|
||||
ErrorReporter errorReporter(errors);
|
||||
GlobalContext globalContext;
|
||||
map<ASTNode const*, shared_ptr<DeclarationContainer>> scopes;
|
||||
NameAndTypeResolver resolver(globalContext, scopes, errorReporter);
|
||||
NameAndTypeResolver resolver(globalContext, dev::test::Options::get().evmVersion(), scopes, errorReporter);
|
||||
resolver.registerDeclarations(*sourceUnit);
|
||||
|
||||
vector<ContractDefinition const*> inheritanceHierarchy;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
library L {
|
||||
function f(uint256 v) external pure returns (uint) {
|
||||
return v * v;
|
||||
}
|
||||
function g(uint256 v) external returns (uint) {
|
||||
return v * v;
|
||||
}
|
||||
}
|
||||
contract C {
|
||||
function addr() public view returns (bool) {
|
||||
return address(L) == address(0);
|
||||
}
|
||||
function g(uint256 v) public view returns (uint256) {
|
||||
return L.f(v);
|
||||
}
|
||||
function h(uint256 v) public returns (uint256) {
|
||||
(bool success, bytes memory result) = address(L).delegatecall(abi.encodeWithSignature("f(uint256)", v));
|
||||
assert(success);
|
||||
return abi.decode(result, (uint256));
|
||||
}
|
||||
function i(uint256 v) public returns (uint256) {
|
||||
(bool success, bytes memory result) = address(L).call(abi.encodeWithSignature("f(uint256)", v));
|
||||
assert(success);
|
||||
return abi.decode(result, (uint256));
|
||||
}
|
||||
function j(uint256 v) public returns (uint256) {
|
||||
(bool success, bytes memory result) = address(L).delegatecall(abi.encodeWithSignature("g(uint256)", v));
|
||||
assert(success);
|
||||
return abi.decode(result, (uint256));
|
||||
}
|
||||
function k(uint256 v) public returns (uint256) {
|
||||
(bool success, bytes memory result) = address(L).call(abi.encodeWithSignature("g(uint256)", v));
|
||||
assert(success);
|
||||
return abi.decode(result, (uint256));
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
// library: L
|
||||
// addr() -> false
|
||||
// g(uint256): 1 -> 1
|
||||
// g(uint256): 2 -> 4
|
||||
// g(uint256): 4 -> 16
|
||||
// h(uint256): 1 -> 1
|
||||
// h(uint256): 2 -> 4
|
||||
// h(uint256): 4 -> 16
|
||||
// i(uint256): 1 -> 1
|
||||
// i(uint256): 2 -> 4
|
||||
// i(uint256): 4 -> 16
|
||||
// j(uint256): 1 -> 1
|
||||
// j(uint256): 2 -> 4
|
||||
// j(uint256): 4 -> 16
|
||||
// k(uint256): 1 -> FAILURE
|
||||
// k(uint256): 2 -> FAILURE
|
||||
// k(uint256): 4 -> FAILURE
|
||||
@@ -0,0 +1,24 @@
|
||||
library L {
|
||||
function f(uint256 a, uint256 b) external {
|
||||
assert(a * a == b);
|
||||
}
|
||||
}
|
||||
contract C {
|
||||
function addr() public view returns (bool) {
|
||||
return address(L) == address(0);
|
||||
}
|
||||
function g(uint256 a, uint256 b) public returns (bool) {
|
||||
(bool success,) = address(L).delegatecall(abi.encodeWithSignature("f(uint256,uint256)", a, b));
|
||||
return success;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// library: L
|
||||
// g(uint256,uint256): 1, 1 -> true
|
||||
// g(uint256,uint256): 1, 2 -> false
|
||||
// g(uint256,uint256): 2, 3 -> false
|
||||
// g(uint256,uint256): 2, 4 -> true
|
||||
// g(uint256,uint256): 2, 5 -> false
|
||||
// g(uint256,uint256): 4, 15 -> false
|
||||
// g(uint256,uint256): 4, 16 -> true
|
||||
// g(uint256,uint256): 4, 17 -> false
|
||||
@@ -0,0 +1,13 @@
|
||||
library L {
|
||||
function f(uint256 v) external returns (uint256) { return v*v; }
|
||||
}
|
||||
contract C {
|
||||
function g(uint256 v) external returns (uint256) {
|
||||
return L.f(v);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// library: L
|
||||
// g(uint256): 1 -> 1
|
||||
// g(uint256): 2 -> 4
|
||||
// g(uint256): 4 -> 16
|
||||
@@ -0,0 +1,12 @@
|
||||
library L {
|
||||
function f(uint256 v) internal returns (uint256) { return v*v; }
|
||||
}
|
||||
contract C {
|
||||
function g(uint256 v) external returns (uint256) {
|
||||
return L.f(v);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// g(uint256): 1 -> 1
|
||||
// g(uint256): 2 -> 4
|
||||
// g(uint256): 4 -> 16
|
||||
@@ -12,17 +12,33 @@ contract C {
|
||||
x = true;
|
||||
require(true);
|
||||
}
|
||||
/* Not properly supported by test system yet
|
||||
function f2(bool a) public pure returns (bool x) {
|
||||
x = a;
|
||||
string memory message;
|
||||
message = "fancy message!";
|
||||
require(a, message);
|
||||
}*/
|
||||
}
|
||||
function f3(bool a) public pure returns (bool x) {
|
||||
x = a;
|
||||
require(a, "msg");
|
||||
}
|
||||
function f4(bool a) public pure returns (bool x) {
|
||||
x = a;
|
||||
string memory message;
|
||||
require(a, message);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
// f(bool): true -> true
|
||||
// f(bool): false -> FAILURE
|
||||
// fail() -> FAILURE
|
||||
// succeed() -> true
|
||||
// f2(bool): true -> true
|
||||
// f2(bool): false -> FAILURE, hex"08c379a0", 0x20, 14, "fancy message!"
|
||||
// f3(bool): true -> true
|
||||
// f3(bool): false -> FAILURE, hex"08c379a0", 0x20, 3, "msg"
|
||||
// f4(bool): true -> true
|
||||
// f4(bool): false -> FAILURE, hex"08c379a0", 0x20, 0
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f(address a, function(uint) external g) internal pure {
|
||||
address b = address(g);
|
||||
assert(a == b);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (128-138): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning: (142-156): Assertion violation happens here
|
||||
@@ -0,0 +1,8 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f(function(uint) external returns (uint) g, function(uint) external returns (uint) h) public {
|
||||
assert(g(2) == h(2));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (155-175): Assertion violation happens here
|
||||
@@ -0,0 +1,13 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f(function(uint) returns (uint) g, function(uint) returns (uint) h) internal {
|
||||
assert(g(2) == h(2));
|
||||
assert(g == h);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (146-150): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (154-158): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (170-176): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons
|
||||
// Warning: (139-159): Assertion violation happens here
|
||||
// Warning: (163-177): Assertion violation happens here
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract B {
|
||||
function f() pure public {
|
||||
g("0123456");
|
||||
}
|
||||
function g(bytes7 a) pure public {
|
||||
assert(a == "0123456");
|
||||
assert(a == "1234567");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (162-184): Assertion violation happens here
|
||||
// Warning: (136-158): Assertion violation happens here
|
||||
// Warning: (162-184): Assertion violation happens here
|
||||
@@ -0,0 +1,11 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract B {
|
||||
function f() mod2("0123456") pure public { }
|
||||
modifier mod2(bytes7 a) {
|
||||
assert(a == "0123456");
|
||||
assert(a == "1234567");
|
||||
_;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (152-174): Assertion violation happens here
|
||||
@@ -0,0 +1,12 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function g() public pure returns (bytes32 val) { return "abc"; }
|
||||
function f1() public pure returns (bytes32 val) { return g(); }
|
||||
|
||||
function a() public pure {
|
||||
assert(f1() == "abc");
|
||||
assert(f1() == "cde");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (238-259): Assertion violation happens here
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function h() public pure returns (bytes32 val, bytes3 val2) { return ("abc", "def"); }
|
||||
function g() public pure returns (bytes32 val) { return "abc"; }
|
||||
function f1() public pure returns (bytes32 val) { return g(); }
|
||||
function f2() public pure returns (bytes32 val, bytes3 val2) { return h(); }
|
||||
|
||||
function a() public pure {
|
||||
(bytes32 v1, bytes3 v2) = f2();
|
||||
assert(v1 == "abc");
|
||||
assert(v2 == "cde");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (442-461): Assertion violation happens here
|
||||
@@ -0,0 +1,5 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f(function(uint) external g) public {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function(uint) m_g;
|
||||
function f(function(uint) internal g) internal {
|
||||
g(2);
|
||||
}
|
||||
function h() public {
|
||||
f(m_g);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (121-125): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (121-125): Assertion checker does not yet implement this type of function call.
|
||||
@@ -0,0 +1,11 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f(function(uint) external payable g) internal {
|
||||
g.selector;
|
||||
g.gas(2).value(3)(4);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (108-118): Assertion checker does not yet support this expression.
|
||||
// Warning: (122-130): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (122-139): Assertion checker does not yet implement this type of function call.
|
||||
@@ -0,0 +1,22 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function(uint) m_g;
|
||||
function f1(function(uint) internal g1) internal {
|
||||
g1(2);
|
||||
}
|
||||
function f2(function(function(uint) internal) internal g2) internal {
|
||||
g2(m_g);
|
||||
}
|
||||
function h() public {
|
||||
f2(f1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (123-128): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (152-197): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (212-214): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (212-219): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (255-257): Internal error: Expression undefined for SMT solver.
|
||||
// Warning: (255-257): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (212-214): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (212-219): Assertion checker does not yet implement this type of function call.
|
||||
@@ -0,0 +1,27 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function(uint) m_g;
|
||||
function r() internal view returns (function(uint)) {
|
||||
return m_g;
|
||||
}
|
||||
function f1(function(uint) internal g1) internal {
|
||||
g1(2);
|
||||
}
|
||||
function f2(function(function(uint) internal) internal g2) internal {
|
||||
g2(r());
|
||||
}
|
||||
function h() public {
|
||||
f2(f1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (195-200): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (224-269): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (284-286): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (287-288): Assertion checker does not yet support this global variable.
|
||||
// Warning: (284-291): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (327-329): Internal error: Expression undefined for SMT solver.
|
||||
// Warning: (327-329): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (284-286): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (287-288): Assertion checker does not yet support this global variable.
|
||||
// Warning: (284-291): Assertion checker does not yet implement this type of function call.
|
||||
@@ -1,12 +1,12 @@
|
||||
contract C {
|
||||
function f() pure external {
|
||||
function f() pure external returns (uint id) {
|
||||
assembly {
|
||||
pop(chainid())
|
||||
id := chainid()
|
||||
}
|
||||
}
|
||||
function g() view external {
|
||||
function g() view external returns (uint sb) {
|
||||
assembly {
|
||||
pop(selfbalance())
|
||||
sb := selfbalance()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
contract C {
|
||||
function f() pure external returns (uint id) {
|
||||
assembly {
|
||||
id := chainid()
|
||||
}
|
||||
}
|
||||
function g() view external returns (uint sb) {
|
||||
assembly {
|
||||
sb := selfbalance()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =petersburg
|
||||
// ----
|
||||
// TypeError: (101-110): The "chainid" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
|
||||
// TypeError: (215-228): The "selfbalance" instruction is only available for Istanbul-compatible VMs (you are currently compiling for "petersburg").
|
||||
+1
@@ -6,4 +6,5 @@ contract test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (87-90): The type of a variable cannot be a library.
|
||||
// TypeError: (100-103): Member "l" not found or not visible after argument-dependent lookup in library L.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
library X { }
|
||||
|
||||
contract Y {
|
||||
X abc;
|
||||
function foo(X param) private view
|
||||
{
|
||||
X ofg;
|
||||
ofg = abc;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (29-34): The type of a variable cannot be a library.
|
||||
// TypeError: (50-57): The type of a variable cannot be a library.
|
||||
// TypeError: (77-82): The type of a variable cannot be a library.
|
||||
@@ -0,0 +1,8 @@
|
||||
library L {
|
||||
}
|
||||
contract C {
|
||||
function f() public pure returns (address) {
|
||||
return address(L);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,9 @@
|
||||
library L {
|
||||
}
|
||||
contract C {
|
||||
function f() public pure returns (address payable) {
|
||||
return address(L);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (99-109): Return argument type address is not implicitly convertible to expected type (type of first return variable) address payable.
|
||||
@@ -58,6 +58,7 @@ namespace test
|
||||
K(Boolean, "boolean", 0) \
|
||||
/* special keywords */ \
|
||||
K(Left, "left", 0) \
|
||||
K(Library, "library", 0) \
|
||||
K(Right, "right", 0) \
|
||||
K(Failure, "FAILURE", 0) \
|
||||
|
||||
@@ -268,6 +269,8 @@ struct FunctionCall
|
||||
/// Marks this function call as "short-handed", meaning
|
||||
/// no `->` declared.
|
||||
bool omitsArrow = true;
|
||||
/// Marks a library deployment call.
|
||||
bool isLibrary = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -75,44 +75,56 @@ vector<dev::solidity::test::FunctionCall> TestFileParser::parseFunctionCalls(siz
|
||||
|
||||
try
|
||||
{
|
||||
tie(call.signature, call.useCallWithoutSignature) = parseFunctionSignature();
|
||||
if (accept(Token::Comma, true))
|
||||
call.value = parseFunctionCallValue();
|
||||
if (accept(Token::Colon, true))
|
||||
call.arguments = parseFunctionCallArguments();
|
||||
|
||||
if (accept(Token::Newline, true))
|
||||
if (accept(Token::Library, true))
|
||||
{
|
||||
call.displayMode = FunctionCall::DisplayMode::MultiLine;
|
||||
m_lineNumber++;
|
||||
}
|
||||
|
||||
call.arguments.comment = parseComment();
|
||||
|
||||
if (accept(Token::Newline, true))
|
||||
{
|
||||
call.displayMode = FunctionCall::DisplayMode::MultiLine;
|
||||
m_lineNumber++;
|
||||
}
|
||||
|
||||
if (accept(Token::Arrow, true))
|
||||
{
|
||||
call.omitsArrow = false;
|
||||
call.expectations = parseFunctionCallExpectations();
|
||||
if (accept(Token::Newline, true))
|
||||
m_lineNumber++;
|
||||
expect(Token::Colon);
|
||||
call.signature = m_scanner.currentLiteral();
|
||||
expect(Token::Identifier);
|
||||
call.isLibrary = true;
|
||||
call.expectations.failure = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
call.expectations.failure = false;
|
||||
call.displayMode = FunctionCall::DisplayMode::SingleLine;
|
||||
tie(call.signature, call.useCallWithoutSignature) = parseFunctionSignature();
|
||||
if (accept(Token::Comma, true))
|
||||
call.value = parseFunctionCallValue();
|
||||
if (accept(Token::Colon, true))
|
||||
call.arguments = parseFunctionCallArguments();
|
||||
|
||||
if (accept(Token::Newline, true))
|
||||
{
|
||||
call.displayMode = FunctionCall::DisplayMode::MultiLine;
|
||||
m_lineNumber++;
|
||||
}
|
||||
|
||||
call.arguments.comment = parseComment();
|
||||
|
||||
if (accept(Token::Newline, true))
|
||||
{
|
||||
call.displayMode = FunctionCall::DisplayMode::MultiLine;
|
||||
m_lineNumber++;
|
||||
}
|
||||
|
||||
if (accept(Token::Arrow, true))
|
||||
{
|
||||
call.omitsArrow = false;
|
||||
call.expectations = parseFunctionCallExpectations();
|
||||
if (accept(Token::Newline, true))
|
||||
m_lineNumber++;
|
||||
}
|
||||
else
|
||||
{
|
||||
call.expectations.failure = false;
|
||||
call.displayMode = FunctionCall::DisplayMode::SingleLine;
|
||||
}
|
||||
|
||||
call.expectations.comment = parseComment();
|
||||
|
||||
if (call.signature == "constructor()")
|
||||
call.isConstructor = true;
|
||||
|
||||
}
|
||||
|
||||
call.expectations.comment = parseComment();
|
||||
|
||||
if (call.signature == "constructor()")
|
||||
call.isConstructor = true;
|
||||
|
||||
calls.emplace_back(std::move(call));
|
||||
}
|
||||
catch (Error const& _e)
|
||||
@@ -456,6 +468,7 @@ void TestFileParser::Scanner::scanNextToken()
|
||||
if (_literal == "false") return TokenDesc{Token::Boolean, _literal};
|
||||
if (_literal == "ether") return TokenDesc{Token::Ether, _literal};
|
||||
if (_literal == "left") return TokenDesc{Token::Left, _literal};
|
||||
if (_literal == "library") return TokenDesc{Token::Library, _literal};
|
||||
if (_literal == "right") return TokenDesc{Token::Right, _literal};
|
||||
if (_literal == "hex") return TokenDesc{Token::Hex, _literal};
|
||||
if (_literal == "FAILURE") return TokenDesc{Token::Failure, _literal};
|
||||
|
||||
@@ -57,7 +57,9 @@ void testFunctionCall(
|
||||
u256 _value = 0,
|
||||
string _argumentComment = "",
|
||||
string _expectationComment = "",
|
||||
vector<string> _rawArguments = vector<string>{}
|
||||
vector<string> _rawArguments = vector<string>{},
|
||||
bool _isConstructor = false,
|
||||
bool _isLibrary = false
|
||||
)
|
||||
{
|
||||
BOOST_REQUIRE_EQUAL(_call.expectations.failure, _failure);
|
||||
@@ -79,6 +81,9 @@ void testFunctionCall(
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_REQUIRE_EQUAL(_call.isConstructor, _isConstructor);
|
||||
BOOST_REQUIRE_EQUAL(_call.isLibrary, _isLibrary);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestFileParserTest)
|
||||
@@ -883,6 +888,51 @@ BOOST_AUTO_TEST_CASE(call_unexpected_character)
|
||||
BOOST_REQUIRE_THROW(parse(source), langutil::Error);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(constructor)
|
||||
{
|
||||
char const* source = R"(
|
||||
// constructor()
|
||||
)";
|
||||
auto const calls = parse(source);
|
||||
BOOST_REQUIRE_EQUAL(calls.size(), 1);
|
||||
testFunctionCall(
|
||||
calls.at(0),
|
||||
Mode::SingleLine,
|
||||
"constructor()",
|
||||
false,
|
||||
{},
|
||||
{},
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
{},
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(library)
|
||||
{
|
||||
char const* source = R"(
|
||||
// library: L
|
||||
)";
|
||||
auto const calls = parse(source);
|
||||
BOOST_REQUIRE_EQUAL(calls.size(), 1);
|
||||
testFunctionCall(
|
||||
calls.at(0),
|
||||
Mode::SingleLine,
|
||||
"L",
|
||||
false,
|
||||
{},
|
||||
{},
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
{},
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
||||
@@ -55,6 +55,12 @@ string TestFunctionCall::format(
|
||||
string newline = formatToken(Token::Newline);
|
||||
string failure = formatToken(Token::Failure);
|
||||
|
||||
if (m_call.isLibrary)
|
||||
{
|
||||
stream << _linePrefix << newline << ws << "library:" << ws << m_call.signature;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Formats the function signature. This is the same independent from the display-mode.
|
||||
stream << _linePrefix << newline << ws << m_call.signature;
|
||||
if (m_call.value > u256(0))
|
||||
|
||||
Reference in New Issue
Block a user