mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implicit conversion from derived to base.
This commit is contained in:
parent
ddf5e20d10
commit
417f9c03d0
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user