aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-20 06:34:49 +0800
committerChristian <c@ethdev.com>2015-01-20 06:35:04 +0800
commit417f9c03d03a9fa52665bd238a42081d55df62c9 (patch)
treedbbdc1e6d2c7f9eb26f4bf7261bc0c961f1f5872 /Types.cpp
parentddf5e20d100535c10315d0ae73ba4ed753ef3397 (diff)
downloaddexon-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.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Types.cpp b/Types.cpp
index 94fd5750..c6d8b62f 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -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