mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Don't consider contracts implicitly convertible to the type of super
- `super` for all intents and purposes behaves like a type and should be a TypeType rather than ContractType. We have an issue to fix it but it's a breaking change. Until then let's at least not treat other contracts as convertible to the ContractType that `super` represents.
This commit is contained in:
@@ -1569,11 +1569,15 @@ BoolResult ContractType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
return true;
|
||||
if (_convertTo.category() == Category::Contract)
|
||||
{
|
||||
auto const& targetContractType = dynamic_cast<ContractType const&>(_convertTo);
|
||||
if (targetContractType.isSuper())
|
||||
return false;
|
||||
|
||||
auto const& bases = contractDefinition().annotation().linearizedBaseContracts;
|
||||
return find(
|
||||
bases.begin(),
|
||||
bases.end(),
|
||||
&dynamic_cast<ContractType const&>(_convertTo).contractDefinition()
|
||||
&targetContractType.contractDefinition()
|
||||
) != bases.end();
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user