mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not add members of address to contracts in experimental 0.5.0
This commit is contained in:
parent
880be25811
commit
09276cb9d3
@ -1,13 +1,14 @@
|
|||||||
### 0.4.18 (unreleased)
|
### 0.4.18 (unreleased)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
* Code Generator: Always use all available gas for calls as experimental 0.5.0 feature
|
||||||
|
(previously, some amount was retained in order to work in pre-tangerine whistle
|
||||||
|
EVM versions)
|
||||||
* Parser: Better error message for unexpected trailing comma in parameter lists.
|
* Parser: Better error message for unexpected trailing comma in parameter lists.
|
||||||
* Standard JSON: Support the ``outputSelection`` field for selective compilation of supplied sources.
|
* Standard JSON: Support the ``outputSelection`` field for selective compilation of supplied sources.
|
||||||
* Syntax Checker: Unary ``+`` is now a syntax error as experimental 0.5.0 feature.
|
* Syntax Checker: Unary ``+`` is now a syntax error as experimental 0.5.0 feature.
|
||||||
* Type Checker: Disallow non-pure constant state variables as experimental 0.5.0 feature.
|
* Type Checker: Disallow non-pure constant state variables as experimental 0.5.0 feature.
|
||||||
* Code Generator: Always use all available gas for calls as experimental 0.5.0 feature
|
* Type Checker: Do not add members of ``address`` to contracts as experimental 0.5.0 feature.
|
||||||
(previously, some amount was retained in order to work in pre-tangerine whistle
|
|
||||||
EVM versions)
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Parser: Fix source location of VariableDeclarationStatement.
|
* Parser: Fix source location of VariableDeclarationStatement.
|
||||||
|
@ -107,6 +107,9 @@ Operators:
|
|||||||
|
|
||||||
* ``<=``, ``<``, ``==``, ``!=``, ``>=`` and ``>``
|
* ``<=``, ``<``, ``==``, ``!=``, ``>=`` and ``>``
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Starting with version 0.5.0 contracts do not derive from the address type, but can still be explicitly converted to address.
|
||||||
|
|
||||||
.. _members-of-addresses:
|
.. _members-of-addresses:
|
||||||
|
|
||||||
Members of Addresses
|
Members of Addresses
|
||||||
|
@ -1616,9 +1616,10 @@ string ContractType::canonicalName() const
|
|||||||
return m_contract.annotation().canonicalName;
|
return m_contract.annotation().canonicalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) const
|
MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _contract) const
|
||||||
{
|
{
|
||||||
MemberList::MemberMap members;
|
MemberList::MemberMap members;
|
||||||
|
solAssert(_contract, "");
|
||||||
if (m_super)
|
if (m_super)
|
||||||
{
|
{
|
||||||
// add the most derived of all functions which are visible in derived contracts
|
// add the most derived of all functions which are visible in derived contracts
|
||||||
@ -1660,7 +1661,9 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) con
|
|||||||
&it.second->declaration()
|
&it.second->declaration()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
addNonConflictingAddressMembers(members);
|
// In 0.5.0 address members are not populated into the contract.
|
||||||
|
if (!_contract->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050))
|
||||||
|
addNonConflictingAddressMembers(members);
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7100,6 +7100,64 @@ BOOST_AUTO_TEST_CASE(array_length_validation)
|
|||||||
CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal.");
|
CHECK_ERROR(text, TypeError, "Invalid array length, expected integer literal.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(no_address_members_on_contract)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
pragma experimental "v0.5.0";
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
this.balance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Member \"balance\" not found or not visible after argument-dependent lookup in contract");
|
||||||
|
text = R"(
|
||||||
|
pragma experimental "v0.5.0";
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
this.transfer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Member \"transfer\" not found or not visible after argument-dependent lookup in contract");
|
||||||
|
text = R"(
|
||||||
|
pragma experimental "v0.5.0";
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
this.send;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Member \"send\" not found or not visible after argument-dependent lookup in contract");
|
||||||
|
text = R"(
|
||||||
|
pragma experimental "v0.5.0";
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
this.call;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Member \"call\" not found or not visible after argument-dependent lookup in contract");
|
||||||
|
text = R"(
|
||||||
|
pragma experimental "v0.5.0";
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
this.callcode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Member \"callcode\" not found or not visible after argument-dependent lookup in contract");
|
||||||
|
text = R"(
|
||||||
|
pragma experimental "v0.5.0";
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
this.delegatecall;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_ERROR(text, TypeError, "Member \"delegatecall\" not found or not visible after argument-dependent lookup in contract");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user