Skip to content

Commit

Permalink
Merge pull request ethereum#5558 from anurag-git/issue_5130
Browse files Browse the repository at this point in the history
Fix internal compiler error for unimplemented base contract function.
  • Loading branch information
chriseth authored Dec 3, 2018
2 parents 0df641f + 82f5763 commit eed353a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Bugfixes:
* Type Checker: Disallow struct return types for getters of public state variables unless the new ABI encoder is active.
* Type Checker: Fix internal compiler error when a field of a struct used as a parameter in a function type has a non-existent type.
* Type Checker: Disallow functions ``sha3`` and ``suicide`` also without a function call.
* Type Checker: Fix internal compiler error with ``super`` when base contract function is not implemented.
* Type Checker: Fixed internal error when trying to create abstract contract in some cases.
* Type Checker: Fixed internal error related to double declaration of events.
* Type Checker: Disallow inline arrays of mapping type.
Expand Down
3 changes: 2 additions & 1 deletion libsolidity/ast/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,9 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con
for (ContractDefinition const* base: bases | boost::adaptors::sliced(1, bases.size()))
for (FunctionDefinition const* function: base->definedFunctions())
{
if (!function->isVisibleInDerivedContracts())
if (!function->isVisibleInDerivedContracts() || !function->isImplemented())
continue;

auto functionType = make_shared<FunctionType>(*function, true);
bool functionWithEqualArgumentsFound = false;
for (auto const& member: members)
Expand Down
8 changes: 8 additions & 0 deletions test/libsolidity/syntaxTests/unimplemented_super_function.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
contract a {
function f() public;
}
contract b is a {
function f() public { super.f(); }
}
// ----
// TypeError: (84-91): Member "f" not found or not visible after argument-dependent lookup in contract super b.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
contract a {
function f() public;
}
contract b is a {
function f() public { super.f(); }
}
contract c is a,b {
// No error here.
function f() public { super.f(); }
}
// ----
// TypeError: (84-91): Member "f" not found or not visible after argument-dependent lookup in contract super b.

0 comments on commit eed353a

Please sign in to comment.