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 @@ -621,6 +621,16 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
621621 return false ;
622622}
623623
624+ void TypeChecker::endVisit (StructDefinition const & _struct)
625+ {
626+ for (auto const & member: _struct.members ())
627+ solAssert (
628+ member->annotation ().type &&
629+ member->annotation ().type ->canBeStored (),
630+ " Type cannot be used in struct."
631+ );
632+ }
633+
624634void TypeChecker::visitManually (
625635 ModifierInvocation const & _modifier,
626636 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