Error when Mapping type in (non-local) storage is assigned to

This commit is contained in:
Harikrishnan Mulackal
2020-05-19 19:12:38 +05:30
parent 142a6b0d4f
commit 774edd4670
5 changed files with 55 additions and 1 deletions
+9 -1
View File
@@ -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())