Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Improve documentation and warning about accessing contract members in…
…herited from address.
  • Loading branch information
ekpyron committed Apr 13, 2018
commit 05c5ab19fb67849d806d8de1b9c3a2982d37f721
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Features:
* Syntax Checker: Issue warning for empty structs (or error as experimental 0.5.0 feature).
* Syntax Checker: Warn about modifiers on functions without implementation (this will turn into an error with version 0.5.0).
* Syntax Tests: Add source locations to syntax test expectations.
* Type Checker: Improve documentation and warnings for accessing contract members inherited from ``address``.
* General: Introduce new constructor syntax using the ``constructor`` keyword as experimental 0.5.0 feature.
* Inheritance: Error when using empty parentheses for base class constructors that require arguments as experimental 0.5.0 feature.
* Inheritance: Error when using no parentheses in modifier-style constructor calls as experimental 0.5.0 feature.
Expand Down
4 changes: 2 additions & 2 deletions docs/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ All three functions ``call``, ``delegatecall`` and ``callcode`` are very low-lev
The ``.gas()`` option is available on all three methods, while the ``.value()`` option is not supported for ``delegatecall``.

.. note::
All contracts inherit the members of address, so it is possible to query the balance of the
current contract using ``this.balance``.
All contracts can be converted to ``address`` type, so it is possible to query the balance of the
current contract using ``address(this).balance``.

.. note::
The use of ``callcode`` is discouraged and will be removed in the future.
Expand Down
3 changes: 2 additions & 1 deletion libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,8 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
m_errorReporter.warning(
_memberAccess.location(),
"Using contract member \"" + memberName +"\" inherited from the address type is deprecated." +
" Convert the contract to \"address\" type to access the member."
" Convert the contract to \"address\" type to access the member,"
" for example use \"address(contract)." + memberName + "\" instead."
);
}

Expand Down