FunctionType::canTakeArguments(): Use the correct index when comparing named parameter types

This commit is contained in:
Kamil Śliwak
2020-09-09 14:45:58 +02:00
parent d089b56457
commit 5e9dd67a0a
13 changed files with 130 additions and 4 deletions
@@ -0,0 +1,13 @@
contract C {
event e(uint u, string s, bool b);
function call() public {
emit e({s: "abc", u: 1, b: true});
emit e({s: "abc", b: true, u: 1});
emit e({u: 1, s: "abc", b: true});
emit e({b: true, s: "abc", u: 1});
emit e({u: 1, b: true, s: "abc"});
emit e({b: true, u: 1, s: "abc"});
}
}
// ----
@@ -0,0 +1,10 @@
contract C {
event e(uint u, string s);
event e(string s, uint u);
function call() public {
emit e({u: 2, s: "abc"});
}
}
// ----
// TypeError 4487: (118-119): No unique declaration found after argument-dependent lookup.
@@ -0,0 +1,10 @@
contract C {
event e(uint u, string s);
event e(bytes s, int u);
function call() public {
emit e({u: 2, s: "abc"});
}
}
// ----
// TypeError 4487: (116-117): No unique declaration found after argument-dependent lookup.
@@ -0,0 +1,14 @@
contract C {
event e(uint u, string s, bool b);
event e(uint u, uint s, uint b);
function call() public {
emit e({s: "abc", u: 1, b: true});
emit e({s: "abc", b: true, u: 1});
emit e({u: 1, s: "abc", b: true});
emit e({b: true, s: "abc", u: 1});
emit e({u: 1, b: true, s: "abc"});
emit e({b: true, u: 1, s: "abc"});
}
}
// ----
@@ -0,0 +1,10 @@
contract C {
event e(uint u, string s);
event e(string s, uint u);
function call() public {
emit e({s: 2, u: "abc"});
}
}
// ----
// TypeError 9322: (118-119): No matching declaration found after argument-dependent lookup.
@@ -0,0 +1,13 @@
contract C {
function f(uint u, string memory s, bool b) internal {}
function call() public {
f({s: "abc", u: 1, b: true});
f({s: "abc", b: true, u: 1});
f({u: 1, s: "abc", b: true});
f({b: true, s: "abc", u: 1});
f({u: 1, b: true, s: "abc"});
f({b: true, u: 1, s: "abc"});
}
}
// ----
@@ -0,0 +1,11 @@
contract C {
function f(uint x, string memory y, bool z) internal {}
function f(string memory y, uint x, bool z) internal {}
function f(bool z, string memory y, uint x) internal {}
function call() internal {
f({x: 1, y: "abc", z: true});
}
}
// ----
// TypeError 4487: (233-234): No unique declaration found after argument-dependent lookup.
@@ -0,0 +1,10 @@
contract C {
function f(uint x, string memory y) internal {}
function f(bytes memory y, int x) internal {}
function call() internal {
f({x: 1, y: "abc"});
}
}
// ----
// TypeError 4487: (155-156): No unique declaration found after argument-dependent lookup.
@@ -0,0 +1,10 @@
contract C {
function f(uint x, string memory y, bool z) internal {}
function f(uint x, uint y, uint z) internal {}
function call() internal {
f({y: 1, x: "abc", z: true});
}
}
// ----
// TypeError 9322: (164-165): No matching declaration found after argument-dependent lookup.
@@ -0,0 +1,10 @@
contract C {
function f(uint x, string memory y, bool z) internal {}
function f(uint x, uint y, uint z) internal {}
function call() internal {
f({a: 1, b: "abc", c: true});
}
}
// ----
// TypeError 9322: (164-165): No matching declaration found after argument-dependent lookup.
@@ -0,0 +1,14 @@
contract C {
function f(uint u, string memory s, bool b) internal {}
function f(uint u, uint s, uint b) internal {}
function call() public {
f({s: "abc", u: 1, b: true});
f({s: "abc", b: true, u: 1});
f({u: 1, s: "abc", b: true});
f({b: true, s: "abc", u: 1});
f({u: 1, b: true, s: "abc"});
f({b: true, u: 1, s: "abc"});
}
}
// ----