Merge pull request #7713 from ethereum/no-lib-instance-7625

Disallow variables of library types
This commit is contained in:
chriseth
2019-11-14 13:39:56 +01:00
committed by GitHub
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())