TypeChecker: Use cast instead of category() check

This commit is contained in:
Mathias Baumann 2019-02-14 11:39:51 +01:00
parent 10a9960eb3
commit 223dac3eca

View File

@ -2051,18 +2051,15 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
errorMsg.pop_back(); errorMsg.pop_back();
errorMsg += " - did you forget the \"payable\" modifier?"; errorMsg += " - did you forget the \"payable\" modifier?";
} }
else if (exprType->category() == Type::Category::Function) else if (auto const& funType = dynamic_pointer_cast<FunctionType const>(exprType))
{ {
if (auto const& funType = dynamic_pointer_cast<FunctionType const>(exprType)) auto const& t = funType->returnParameterTypes();
{ if (t.size() == 1)
auto const& t = funType->returnParameterTypes(); if (
if (t.size() == 1) t.front()->category() == Type::Category::Contract ||
if ( t.front()->category() == Type::Category::Struct
t.front()->category() == Type::Category::Contract || )
t.front()->category() == Type::Category::Struct errorMsg += " Did you intend to call the function?";
)
errorMsg += " Did you intend to call the function?";
}
} }
else if (exprType->category() == Type::Category::Contract) else if (exprType->category() == Type::Category::Contract)
{ {