From 223dac3ecae62186e399e613401f5c9990ef982e Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Thu, 14 Feb 2019 11:39:51 +0100 Subject: [PATCH] TypeChecker: Use cast instead of category() check --- libsolidity/analysis/TypeChecker.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 1d30a1910..ce1910129 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2051,18 +2051,15 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) errorMsg.pop_back(); errorMsg += " - did you forget the \"payable\" modifier?"; } - else if (exprType->category() == Type::Category::Function) + else if (auto const& funType = dynamic_pointer_cast(exprType)) { - if (auto const& funType = dynamic_pointer_cast(exprType)) - { - auto const& t = funType->returnParameterTypes(); - if (t.size() == 1) - if ( - t.front()->category() == Type::Category::Contract || - t.front()->category() == Type::Category::Struct - ) - errorMsg += " Did you intend to call the function?"; - } + auto const& t = funType->returnParameterTypes(); + if (t.size() == 1) + if ( + t.front()->category() == Type::Category::Contract || + t.front()->category() == Type::Category::Struct + ) + errorMsg += " Did you intend to call the function?"; } else if (exprType->category() == Type::Category::Contract) {