mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10527 from ethereum/errorOnMsgDataInReceive
[BREAKING] Disallowing usage of msg.data in receive() function.
This commit is contained in:
commit
15ef45576d
@ -19,6 +19,7 @@ Breaking Changes:
|
||||
* Type System: Explicit conversions between two types are disallowed if it changes more than one of sign, width or kind at the same time.
|
||||
* Type System: Declarations with the name ``this``, ``super`` and ``_`` are disallowed, with the exception of public functions and events.
|
||||
* Type System: Disallow ``type(super)``.
|
||||
* Type System: Disallow ``msg.data`` in ``receive()`` function.
|
||||
* Command Line Interface: JSON fields `abi`, `devdoc`, `userdoc` and `storage-layout` are now sub-objects rather than strings.
|
||||
* Scanner: Remove support for the ``\b``, ``\f``, and ``\v`` escape sequences.
|
||||
|
||||
|
@ -224,6 +224,17 @@ bool StaticAnalyzer::visit(MemberAccess const& _memberAccess)
|
||||
"Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode."
|
||||
);
|
||||
}
|
||||
else if (
|
||||
m_currentFunction &&
|
||||
m_currentFunction->isReceive() &&
|
||||
type->kind() == MagicType::Kind::Message &&
|
||||
_memberAccess.memberName() == "data"
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
7139_error,
|
||||
_memberAccess.location(),
|
||||
R"("msg.data" cannot be used inside of "receive" function.)"
|
||||
);
|
||||
}
|
||||
|
||||
if (_memberAccess.memberName() == "callcode")
|
||||
|
@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
receive() external payable { msg.data; }
|
||||
}
|
||||
// ----
|
||||
// TypeError 7139: (46-54): "msg.data" cannot be used inside of "receive" function.
|
Loading…
Reference in New Issue
Block a user