mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Report why assigning oversized hex strings to bytes fail
This commit is contained in:
@@ -1351,7 +1351,11 @@ StringLiteralType::StringLiteralType(string _value):
|
||||
BoolResult StringLiteralType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
if (auto fixedBytes = dynamic_cast<FixedBytesType const*>(&_convertTo))
|
||||
return static_cast<size_t>(fixedBytes->numBytes()) >= m_value.size();
|
||||
{
|
||||
if (static_cast<size_t>(fixedBytes->numBytes()) < m_value.size())
|
||||
return BoolResult::err("Literal is larger than the type.");
|
||||
return true;
|
||||
}
|
||||
else if (auto arrayType = dynamic_cast<ArrayType const*>(&_convertTo))
|
||||
return
|
||||
arrayType->location() != DataLocation::CallData &&
|
||||
|
||||
Reference in New Issue
Block a user