diff --git a/Changelog.md b/Changelog.md index 26c958076..1b5233cfa 100644 --- a/Changelog.md +++ b/Changelog.md @@ -24,6 +24,7 @@ Bugfixes: * Source Locations: Properly set source location of scoped blocks. * Standard JSON: Properly allow the ``inliner`` setting under ``settings.optimizer.details``. * Type Checker: Fix internal compiler error related to having mapping types in constructor parameter for abstract contracts. + * Type Checker: Fix internal compiler error when attempting to use an invalid external function type on pre-byzantium EVMs. AST Changes: diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 22aff45d8..113755650 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -721,7 +721,7 @@ void TypeChecker::endVisit(FunctionTypeName const& _funType) { solAssert(t->annotation().type, "Type not set for parameter."); if (!t->annotation().type->interfaceType(false).get()) - m_errorReporter.typeError(2582_error, t->location(), "Internal type cannot be used for external function type."); + m_errorReporter.fatalTypeError(2582_error, t->location(), "Internal type cannot be used for external function type."); } solAssert(fun.interfaceType(false), "External function type uses internal types."); } diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/calling_external_function_via_local_variable_with_invalid_type.sol b/test/libsolidity/syntaxTests/iceRegressionTests/calling_external_function_via_local_variable_with_invalid_type.sol new file mode 100644 index 000000000..7257ef0f7 --- /dev/null +++ b/test/libsolidity/syntaxTests/iceRegressionTests/calling_external_function_via_local_variable_with_invalid_type.sol @@ -0,0 +1,8 @@ +contract C { + function f() public { + function() external returns (function() internal) getCallback; + getCallback(); + } +} +// ---- +// TypeError 2582: (76-96): Internal type cannot be used for external function type. diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/calling_external_function_via_parameter_with_invalid_type.sol b/test/libsolidity/syntaxTests/iceRegressionTests/calling_external_function_via_parameter_with_invalid_type.sol new file mode 100644 index 000000000..9bb40242e --- /dev/null +++ b/test/libsolidity/syntaxTests/iceRegressionTests/calling_external_function_via_parameter_with_invalid_type.sol @@ -0,0 +1,9 @@ +contract C { + function f( + function() external returns (function() internal) getCallback + ) public { + getCallback(); + } +} +// ---- +// TypeError 2582: (66-86): Internal type cannot be used for external function type.