mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7713 from ethereum/no-lib-instance-7625
Disallow variables of library types
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user