Disallow variables of library types

This commit is contained in:
Mathias Baumann
2019-11-14 13:20:31 +01:00
parent f6191a7183
commit 0891b9451b
5 changed files with 28 additions and 4 deletions
+3
View File
@@ -450,6 +450,9 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
TypePointer varType = _variable.annotation().type;
solAssert(!!varType, "Variable type not provided.");
if (auto contractType = dynamic_cast<ContractType const*>(varType))
if (contractType->contractDefinition().isLibrary())
m_errorReporter.typeError(_variable.location(), "The type of a variable cannot be a library.");
if (_variable.value())
expectType(*_variable.value(), *varType);
if (_variable.isConstant())