mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8977 from ethereum/mapping-type-error
Error when Mapping type in (non-local) storage is assigned to
This commit is contained in:
@@ -453,7 +453,15 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
||||
if (contractType->contractDefinition().isLibrary())
|
||||
m_errorReporter.typeError(1273_error, _variable.location(), "The type of a variable cannot be a library.");
|
||||
if (_variable.value())
|
||||
expectType(*_variable.value(), *varType);
|
||||
{
|
||||
if (_variable.isStateVariable() && dynamic_cast<MappingType const*>(varType))
|
||||
{
|
||||
m_errorReporter.typeError(6280_error, _variable.location(), "Mappings cannot be assigned to.");
|
||||
_variable.value()->accept(*this);
|
||||
}
|
||||
else
|
||||
expectType(*_variable.value(), *varType);
|
||||
}
|
||||
if (_variable.isConstant())
|
||||
{
|
||||
if (!_variable.type()->isValueType())
|
||||
|
||||
Reference in New Issue
Block a user