From ff9039b2a82f5679cb79bf0a47f280283554ba89 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Mon, 17 Oct 2016 20:54:53 +0200 Subject: [PATCH] When a contract type is super, its members do not contain the functions of itself Fixes #1151 --- libsolidity/ast/Types.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index eb98047c7..b28ae482d 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1324,7 +1324,14 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) con if (m_super) { // add the most derived of all functions which are visible in derived contracts - for (ContractDefinition const* base: m_contract.annotation().linearizedBaseContracts) + auto bases = m_contract.annotation().linearizedBaseContracts; + if (bases.size() < 1) + BOOST_THROW_EXCEPTION( + InternalCompilerError() << + errinfo_comment("linearizedBaseContracts should at least contain the most derived contract.") + ); + bases.erase(bases.begin()); // Remove the most derived contract, which should not be searchable from `super`. + for (ContractDefinition const* base: bases) for (FunctionDefinition const* function: base->definedFunctions()) { if (!function->isVisibleInDerivedContracts())