Improved error messages when converting to/from builtin functions

This commit is contained in:
Alex Beregszaszi
2020-12-10 22:38:15 +00:00
parent ff7e45f417
commit fa37e69c25
11 changed files with 25 additions and 15 deletions
+7
View File
@@ -3111,6 +3111,13 @@ BoolResult FunctionType::isImplicitlyConvertibleTo(Type const& _convertTo) const
FunctionType const& convertTo = dynamic_cast<FunctionType const&>(_convertTo);
// These two checks are duplicated in equalExcludingStateMutability, but are added here for error reporting.
if (convertTo.bound() != bound())
return BoolResult::err("Bound functions can not be converted to non-bound functions.");
if (convertTo.kind() != kind())
return BoolResult::err("Special functions can not be converted to function types.");
if (!equalExcludingStateMutability(convertTo))
return false;