mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow conversions between declaration function types.
This commit is contained in:
parent
755110aed4
commit
0ab0842c29
@ -29,6 +29,7 @@ Bugfixes:
|
|||||||
* SMTChecker: Fix false negative when a verification target can be violated only by trusted external call from another public function.
|
* SMTChecker: Fix false negative when a verification target can be violated only by trusted external call from another public function.
|
||||||
* SMTChecker: Fix internal error caused by using external identifier to encode member access to functions that take an internal function as a parameter.
|
* SMTChecker: Fix internal error caused by using external identifier to encode member access to functions that take an internal function as a parameter.
|
||||||
* Standard JSON Interface: Fix an incomplete AST being returned when analysis is interrupted by certain kinds of fatal errors.
|
* Standard JSON Interface: Fix an incomplete AST being returned when analysis is interrupted by certain kinds of fatal errors.
|
||||||
|
* Type Checker: Function declaration types referring to different declarations are no longer convertible to each other.
|
||||||
* Yul Optimizer: Ensure that the assignment of memory slots for variables moved to memory does not depend on AST IDs that may depend on whether additional files are included during compilation.
|
* Yul Optimizer: Ensure that the assignment of memory slots for variables moved to memory does not depend on AST IDs that may depend on whether additional files are included during compilation.
|
||||||
* Yul Optimizer: Fix ``FullInliner`` step not ignoring code that is not in expression-split form.
|
* Yul Optimizer: Fix ``FullInliner`` step not ignoring code that is not in expression-split form.
|
||||||
* Yul Optimizer: Fix optimized IR being unnecessarily passed through the Yul optimizer again before bytecode generation.
|
* Yul Optimizer: Fix optimized IR being unnecessarily passed through the Yul optimizer again before bytecode generation.
|
||||||
|
@ -3127,6 +3127,12 @@ BoolResult FunctionType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
|||||||
if (convertTo.kind() != kind())
|
if (convertTo.kind() != kind())
|
||||||
return BoolResult::err("Special functions cannot be converted to function types.");
|
return BoolResult::err("Special functions cannot be converted to function types.");
|
||||||
|
|
||||||
|
if (
|
||||||
|
kind() == FunctionType::Kind::Declaration &&
|
||||||
|
m_declaration != convertTo.m_declaration
|
||||||
|
)
|
||||||
|
return BoolResult::err("Function declaration types referring to different functions cannot be converted to each other.");
|
||||||
|
|
||||||
if (!equalExcludingStateMutability(convertTo))
|
if (!equalExcludingStateMutability(convertTo))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
contract D {
|
||||||
|
function f() external {}
|
||||||
|
function g() external {}
|
||||||
|
}
|
||||||
|
contract C {
|
||||||
|
function f(bool c) public pure {
|
||||||
|
(c ? D.f : D.g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 1080: (117-130): True expression's type function D.f() does not match false expression's type function D.g().
|
@ -0,0 +1,11 @@
|
|||||||
|
contract C {
|
||||||
|
function f() internal {}
|
||||||
|
function g() internal {}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract D is C {
|
||||||
|
function h(bool b) public pure {
|
||||||
|
(b ? C.f : C.g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
Loading…
Reference in New Issue
Block a user