fix: handle forward declaration of alias type

This commit is contained in:
Marc Vertes
2019-09-24 16:10:04 +02:00
committed by Traefiker Bot
parent 8a88a1ab8a
commit effd64c980
2 changed files with 17 additions and 1 deletions

16
_test/alias1.go Normal file
View File

@@ -0,0 +1,16 @@
package main
import "fmt"
type MyT T
type T struct {
Name string
}
func main() {
fmt.Println(MyT{})
}
// Output:
// {}

View File

@@ -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