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,9 +2051,7 @@ 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(); auto const& t = funType->returnParameterTypes();
if (t.size() == 1) if (t.size() == 1)
@ -2063,7 +2061,6 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
) )
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)
{ {
for (auto const& addressMember: AddressType::addressPayable().nativeMembers(nullptr)) for (auto const& addressMember: AddressType::addressPayable().nativeMembers(nullptr))