Merge pull request #3932 from ethereum/betterErrorForFailedLookup

Better error for failed lookup
This commit is contained in:
chriseth
2018-04-19 14:25:12 +02:00
committed by GitHub
7 changed files with 51 additions and 26 deletions
@@ -2993,21 +2993,6 @@ BOOST_AUTO_TEST_CASE(literal_strings)
CHECK_SUCCESS(text);
}
BOOST_AUTO_TEST_CASE(memory_structs_with_mappings)
{
char const* text = R"(
contract Test {
struct S { uint8 a; mapping(uint => uint) b; uint8 c; }
S s;
function f() public {
S memory x;
x.b[1];
}
}
)";
CHECK_ERROR(text, TypeError, "Member \"b\" is not available in struct Test.S memory outside of storage.");
}
BOOST_AUTO_TEST_CASE(string_bytes_conversion)
{
char const* text = R"(
@@ -0,0 +1,7 @@
contract C {
function f(uint, uint) {}
function f(uint) {}
function g() { f(1, 2, 3); }
}
// ----
// TypeError: (80-81): No matching declaration found after argument-dependent lookup.
@@ -0,0 +1,9 @@
library L {
function f(uint, uint) {}
function f(uint) {}
}
contract C {
function g() { L.f(1, 2, 3); }
}
// ----
// TypeError: (94-97): Member "f" not found or not visible after argument-dependent lookup in type(library L)
@@ -0,0 +1,10 @@
contract Test {
struct S { uint8 a; mapping(uint => uint) b; uint8 c; }
S s;
function f() public {
S memory x;
x.b[1];
}
}
// ----
// TypeError: (118-121): Member "b" is not available in struct Test.S memory outside of storage.
@@ -0,0 +1,8 @@
contract Test {
function f() public pure {
uint[] memory x;
x.push(1);
}
}
// ----
// TypeError: (77-83): Member "push" is not available in uint256[] memory outside of storage.