Add update suggestion.

This commit is contained in:
Daniel Kirchner
2019-08-19 14:58:05 +02:00
committed by chriseth
parent 20b23e124b
commit 4354ef2ef4
2 changed files with 18 additions and 2 deletions
+17 -1
View File
@@ -1478,12 +1478,28 @@ TypePointer TypeChecker::typeCheckTypeConversionAndRetrieveReturnType(
variableDeclaration->location()
);
m_errorReporter.typeError(
_functionCall.location(), ssl,
_functionCall.location(),
ssl,
"Explicit type conversion not allowed from non-payable \"address\" to \"" +
resultType->toString() +
"\", which has a payable fallback function."
);
}
else if (
auto const* functionType = dynamic_cast<FunctionType const*>(argType);
functionType &&
functionType->kind() == FunctionType::Kind::External &&
resultType->category() == Type::Category::Address
)
m_errorReporter.typeError(
_functionCall.location(),
"Explicit type conversion not allowed from \"" +
argType->toString() +
"\" to \"" +
resultType->toString() +
"\". To obtain the address of the contract of the function, " +
"you can use the .address member of the function."
);
else
m_errorReporter.typeError(
_functionCall.location(),
@@ -4,4 +4,4 @@ contract C {
}
}
// ----
// TypeError: (77-92): Explicit type conversion not allowed from "function () view external returns (address)" to "address".
// TypeError: (77-92): Explicit type conversion not allowed from "function () view external returns (address)" to "address". To obtain the address of the contract of the function, you can use the .address member of the function.