diff options
author | chriseth <chris@ethereum.org> | 2018-11-08 18:38:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-08 18:38:07 +0800 |
commit | e906b36604d247175063a7bf28f0d4b9839a2084 (patch) | |
tree | 9679c7cb911f6b808ad040edb2c99bf89129de5f | |
parent | d3e111d493df8bb922bc57e8c84ae539f2209bc2 (diff) | |
parent | 8b2f8b1ea27450c7ceec14d32e6afb31598c148c (diff) | |
download | dexon-solidity-e906b36604d247175063a7bf28f0d4b9839a2084.tar.gz dexon-solidity-e906b36604d247175063a7bf28f0d4b9839a2084.tar.zst dexon-solidity-e906b36604d247175063a7bf28f0d4b9839a2084.zip |
Merge pull request #5352 from ethereum/docContractConversions
[DOCS] Document disallowed explicit conversions between unrelated contract types.
-rw-r--r-- | docs/050-breaking-changes.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/050-breaking-changes.rst b/docs/050-breaking-changes.rst index d4abbf54..48112cd9 100644 --- a/docs/050-breaking-changes.rst +++ b/docs/050-breaking-changes.rst @@ -102,6 +102,14 @@ For most of the topics the compiler will provide suggestions. ``c.transfer(...)`` to ``address(c).transfer(...)``, and ``c.balance`` to ``address(c).balance``. +* Explicit conversions between unrelated contract types are now disallowed. You can only + convert from a contract type to one of its base or ancestor types. If you are sure that + a contract is compatible with the contract type you want to convert to, although it does not + inherit from it, you can work around this by converting to ``address`` first. + Example: if ``A`` and ``B`` are contract types, ``B`` does not inherit from ``A`` and + ``b`` is a contract of type ``B``, you can still convert ``b`` to type ``A`` using ``A(address(b))``. + Note that you still need to watch out for matching payable fallback functions, as explained below. + * The ``address`` type was split into ``address`` and ``address payable``, where only ``address payable`` provides the ``transfer`` function. An ``address payable`` can be directly converted to an ``address``, but the |