mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow conversion from `super`
This commit is contained in:
@@ -1433,6 +1433,9 @@ Type const* ContractType::encodingType() const
|
||||
|
||||
BoolResult ContractType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
if (m_super)
|
||||
return false;
|
||||
|
||||
if (*this == _convertTo)
|
||||
return true;
|
||||
if (_convertTo.category() == Category::Contract)
|
||||
@@ -1450,8 +1453,12 @@ BoolResult ContractType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
|
||||
BoolResult ContractType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
if (m_super)
|
||||
return false;
|
||||
|
||||
if (auto const* addressType = dynamic_cast<AddressType const*>(&_convertTo))
|
||||
return isPayable() || (addressType->stateMutability() < StateMutability::Payable);
|
||||
|
||||
return isImplicitlyConvertibleTo(_convertTo);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user