Skip to content

Commit da127a1

Browse files
committed
Moved storage size assert to TypeChecker from DeclarationTypeChecker
1 parent d8d2c49 commit da127a1

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

libsolidity/analysis/DeclarationTypeChecker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ void DeclarationTypeChecker::endVisit(ArrayTypeName const& _typeName)
289289
return;
290290
}
291291

292-
solAssert(baseType->storageBytes() != 0, "Illegal base type of storage size zero for array.");
293292
if (Expression const* length = _typeName.length())
294293
{
295294
optional<rational> lengthValue;

libsolidity/analysis/TypeChecker.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,14 @@ void TypeChecker::endVisit(RevertStatement const& _revert)
12201220
m_errorReporter.typeError(1885_error, errorCall.expression().location(), "Expression has to be an error.");
12211221
}
12221222

1223+
void TypeChecker::endVisit(ArrayTypeName const& _typeName)
1224+
{
1225+
solAssert(
1226+
_typeName.baseType().annotation().type &&
1227+
_typeName.baseType().annotation().type->storageBytes() != 0,
1228+
"Illegal base type of storage size zero for array."
1229+
);
1230+
}
12231231

12241232
bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
12251233
{

libsolidity/analysis/TypeChecker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class TypeChecker: private ASTConstVisitor
119119
void endVisit(InheritanceSpecifier const& _inheritance) override;
120120
void endVisit(ModifierDefinition const& _modifier) override;
121121
bool visit(FunctionDefinition const& _function) override;
122+
void endVisit(ArrayTypeName const& _typeName) override;
122123
bool visit(VariableDeclaration const& _variable) override;
123124
/// We need to do this manually because we want to pass the bases of the current contract in
124125
/// case this is a base constructor call.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
contract C {
2+
Left[] pu1;
3+
}
4+
type Left is bytes2;

0 commit comments

Comments
 (0)