diff --git a/runtime/sema/type.go b/runtime/sema/type.go index 9e2ab8b422..b074d2efa6 100644 --- a/runtime/sema/type.go +++ b/runtime/sema/type.go @@ -4262,9 +4262,8 @@ func (t *CompositeType) GetMembers() map[string]MemberResolver { } func (t *CompositeType) initializeMemberResolvers() { - t.memberResolversOnce.Do(func() { + f := func() { memberResolvers := MembersMapAsResolvers(t.Members) - // Check conformances. // If this composite type results from a normal composite declaration, // it must have members declared for all interfaces it conforms to. @@ -4281,7 +4280,12 @@ func (t *CompositeType) initializeMemberResolvers() { }) t.memberResolvers = withBuiltinMembers(t, memberResolvers) - }) + } + t.memberResolversOnce.Do(f) + + if len(t.memberResolvers) != t.Members.Len() { + f() + } } func (t *CompositeType) FieldPosition(name string, declaration ast.CompositeLikeDeclaration) ast.Position {