Skip to content

Commit

Permalink
fix: handle forward declaration of alias type
Browse files Browse the repository at this point in the history
  • Loading branch information
mvertes authored and traefiker committed Sep 24, 2019
1 parent 8a88a1a commit effd64c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions _test/alias1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import "fmt"

type MyT T

type T struct {
Name string
}

func main() {
fmt.Println(MyT{})
}

// Output:
// {}
2 changes: 1 addition & 1 deletion interp/gta.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (interp *Interpreter) gta(root *node, rpath string) ([]*node, error) {
return false
}
if n.child[1].kind == identExpr {
n.typ = &itype{cat: aliasT, val: typ, name: typeName, path: rpath}
n.typ = &itype{cat: aliasT, val: typ, name: typeName, path: rpath, incomplete: typ.incomplete}
} else {
n.typ = typ
n.typ.name = typeName
Expand Down

0 comments on commit effd64c

Please sign in to comment.