Skip to content

Commit

Permalink
fix: handle recursive type definition involving a map object
Browse files Browse the repository at this point in the history
  • Loading branch information
mvertes authored Feb 4, 2020
1 parent 92a63db commit 4fd6a2d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions _test/map19.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import "fmt"

type cmap struct {
servers map[int64]*server
}

type server struct {
cm *cmap
}

func main() {
m := cmap{}
fmt.Println(m)
}
2 changes: 1 addition & 1 deletion interp/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ func (t *itype) refType(defined map[string]bool) reflect.Type {
case interfaceT:
t.rtype = interf
case mapT:
t.rtype = reflect.MapOf(t.key.TypeOf(), t.val.TypeOf())
t.rtype = reflect.MapOf(t.key.refType(defined), t.val.refType(defined))
case ptrT:
t.rtype = reflect.PtrTo(t.val.refType(defined))
case structT:
Expand Down

0 comments on commit 4fd6a2d

Please sign in to comment.