File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed
test/libsolidity/syntaxTests/userDefinedValueType Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,6 @@ bool DeclarationTypeChecker::visit(StructDefinition const& _struct)
100100 m_recursiveStructSeen = false ;
101101 member->accept (*this );
102102 solAssert (member->annotation ().type , " " );
103- solAssert (member->annotation ().type ->canBeStored (), " Type cannot be used in struct." );
104103 if (m_recursiveStructSeen)
105104 hasRecursiveChild = true ;
106105 }
Original file line number Diff line number Diff line change @@ -630,6 +630,16 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
630630 return false ;
631631}
632632
633+ void TypeChecker::endVisit (StructDefinition const & _struct)
634+ {
635+ for (auto const & member: _struct.members ())
636+ solAssert (
637+ member->annotation ().type &&
638+ member->annotation ().type ->canBeStored (),
639+ " Type cannot be used in struct."
640+ );
641+ }
642+
633643void TypeChecker::visitManually (
634644 ModifierInvocation const & _modifier,
635645 vector<ContractDefinition const *> const & _bases
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ class TypeChecker: private ASTConstVisitor
121121 bool visit (FunctionDefinition const & _function) override ;
122122 void endVisit (ArrayTypeName const & _typeName) override ;
123123 bool visit (VariableDeclaration const & _variable) override ;
124+ void endVisit (StructDefinition const & _struct) override ;
124125 // / We need to do this manually because we want to pass the bases of the current contract in
125126 // / case this is a base constructor call.
126127 void visitManually (ModifierInvocation const & _modifier, std::vector<ContractDefinition const *> const & _bases);
Original file line number Diff line number Diff line change 1+ struct S { U u; }
2+ contract C { S s; }
3+ type U is address ;
You can’t perform that action at this time.
0 commit comments