mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Correct wrong error message referencing .slot and .offset when .length was used
This commit is contained in:
@@ -799,7 +799,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
m_errorReporter.typeError(6252_error, _identifier.debugData->location, "Constant variables cannot be assigned to.");
|
||||
return false;
|
||||
}
|
||||
else if (!identifierInfo.suffix.empty())
|
||||
else if (identifierInfo.suffix == "slot" || identifierInfo.suffix == "offset")
|
||||
{
|
||||
m_errorReporter.typeError(6617_error, _identifier.debugData->location, "The suffixes .offset and .slot can only be used on non-constant storage variables.");
|
||||
return false;
|
||||
@@ -829,7 +829,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
{
|
||||
string const& suffix = identifierInfo.suffix;
|
||||
solAssert((set<string>{"offset", "slot", "length"}).count(suffix), "");
|
||||
if (var->isStateVariable() || var->type()->dataStoredIn(DataLocation::Storage))
|
||||
if (!var->isConstant() && (var->isStateVariable() || var->type()->dataStoredIn(DataLocation::Storage)))
|
||||
{
|
||||
if (suffix != "slot" && suffix != "offset")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user