diff options
author | Christian <c@ethdev.com> | 2015-01-20 06:34:49 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-20 06:35:04 +0800 |
commit | 417f9c03d03a9fa52665bd238a42081d55df62c9 (patch) | |
tree | dbbdc1e6d2c7f9eb26f4bf7261bc0c961f1f5872 /Types.cpp | |
parent | ddf5e20d100535c10315d0ae73ba4ed753ef3397 (diff) | |
download | dexon-solidity-417f9c03d03a9fa52665bd238a42081d55df62c9.tar dexon-solidity-417f9c03d03a9fa52665bd238a42081d55df62c9.tar.gz dexon-solidity-417f9c03d03a9fa52665bd238a42081d55df62c9.tar.bz2 dexon-solidity-417f9c03d03a9fa52665bd238a42081d55df62c9.tar.lz dexon-solidity-417f9c03d03a9fa52665bd238a42081d55df62c9.tar.xz dexon-solidity-417f9c03d03a9fa52665bd238a42081d55df62c9.tar.zst dexon-solidity-417f9c03d03a9fa52665bd238a42081d55df62c9.zip |
Implicit conversion from derived to base.
Diffstat (limited to 'Types.cpp')
-rw-r--r-- | Types.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -431,12 +431,19 @@ bool ContractType::isImplicitlyConvertibleTo(Type const& _convertTo) const return true; if (_convertTo.getCategory() == Category::INTEGER) return dynamic_cast<IntegerType const&>(_convertTo).isAddress(); + if (_convertTo.getCategory() == Category::CONTRACT) + { + auto const& bases = getContractDefinition().getLinearizedBaseContracts(); + return find(bases.begin(), bases.end(), + &dynamic_cast<ContractType const&>(_convertTo).getContractDefinition()) != bases.end(); + } return false; } bool ContractType::isExplicitlyConvertibleTo(Type const& _convertTo) const { - return isImplicitlyConvertibleTo(_convertTo) || _convertTo.getCategory() == Category::INTEGER; + return isImplicitlyConvertibleTo(_convertTo) || _convertTo.getCategory() == Category::INTEGER || + _convertTo.getCategory() == Category::CONTRACT; } TypePointer ContractType::unaryOperatorResult(Token::Value _operator) const |