mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Treat invalid external function type as a fatal error to prevent the type from being used
- `returnParameterTypesWithoutDynamicTypes()` assumes it won't encounter such types.
This commit is contained in:
parent
4cbf9ff74c
commit
4a19c7e495
@ -23,6 +23,7 @@ Bugfixes:
|
|||||||
* Source Locations: Properly set source location of scoped blocks.
|
* Source Locations: Properly set source location of scoped blocks.
|
||||||
* Standard JSON: Properly allow the ``inliner`` setting under ``settings.optimizer.details``.
|
* 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 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:
|
AST Changes:
|
||||||
|
@ -721,7 +721,7 @@ void TypeChecker::endVisit(FunctionTypeName const& _funType)
|
|||||||
{
|
{
|
||||||
solAssert(t->annotation().type, "Type not set for parameter.");
|
solAssert(t->annotation().type, "Type not set for parameter.");
|
||||||
if (!t->annotation().type->interfaceType(false).get())
|
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.");
|
solAssert(fun.interfaceType(false), "External function type uses internal types.");
|
||||||
}
|
}
|
||||||
|
@ -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.
|
@ -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.
|
Loading…
Reference in New Issue
Block a user