diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index d2f709be0..bcd90acfc 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -365,23 +365,25 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) { case Type::Category::CONTRACT: { + bool alsoSearchInteger = false; ContractType const& type = dynamic_cast(*_memberAccess.getExpression().getType()); if (type.isSuper()) - { m_context << m_context.getSuperFunctionEntryLabel(member, type.getContractDefinition()).pushTag(); - break; - } else { + // ordinary contract type u256 identifier = type.getFunctionIdentifier(member); if (identifier != Invalid256) { appendTypeConversion(type, IntegerType(0, IntegerType::Modifier::ADDRESS), true); m_context << identifier; - break; } - // fall-through to "integer" otherwise (address) + else + // not found in contract, search in members inherited from address + alsoSearchInteger = true; } + if (!alsoSearchInteger) + break; } case Type::Category::INTEGER: if (member == "balance") diff --git a/libsolidity/GlobalContext.cpp b/libsolidity/GlobalContext.cpp index 40a498c8e..687c9c9d4 100644 --- a/libsolidity/GlobalContext.cpp +++ b/libsolidity/GlobalContext.cpp @@ -89,7 +89,6 @@ MagicVariableDeclaration const* GlobalContext::getCurrentSuper() const m_superPointer[m_currentContract] = make_shared( "super", make_shared(*m_currentContract, true)); return m_superPointer[m_currentContract].get(); - } }