mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allowing conversion from bytes to bytesNN in type checker.
This commit is contained in:
@@ -1570,9 +1570,9 @@ BoolResult ArrayType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
if (isImplicitlyConvertibleTo(_convertTo))
|
||||
return true;
|
||||
// allow conversion bytes <-> string
|
||||
// allow conversion bytes <-> string and bytes -> bytesNN
|
||||
if (_convertTo.category() != category())
|
||||
return false;
|
||||
return isByteArray() && !isString() && _convertTo.category() == Type::Category::FixedBytes;
|
||||
auto& convertTo = dynamic_cast<ArrayType const&>(_convertTo);
|
||||
if (convertTo.location() != location())
|
||||
return false;
|
||||
@@ -1929,6 +1929,13 @@ BoolResult ArraySliceType::isImplicitlyConvertibleTo(Type const& _other) const
|
||||
);
|
||||
}
|
||||
|
||||
BoolResult ArraySliceType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
return
|
||||
isImplicitlyConvertibleTo(_convertTo) ||
|
||||
m_arrayType.isExplicitlyConvertibleTo(_convertTo);
|
||||
}
|
||||
|
||||
string ArraySliceType::richIdentifier() const
|
||||
{
|
||||
return m_arrayType.richIdentifier() + "_slice";
|
||||
|
||||
Reference in New Issue
Block a user