diff options
| author | Paul Chaignon <paul.chaignon@orange.com> | 2019-10-23 09:27:03 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-10-23 10:22:35 +0200 |
| commit | d3cea9507fca333c23ebf5b19bfddc6ff17a9181 (patch) | |
| tree | f480da30ea734f360e8df8ee1cd9320e3ba85b56 /pkg/compiler/check.go | |
| parent | bb6c338b9e670cf70d21927770f424cee38e06f6 (diff) | |
pkg/compiler: fix root node not visited in typedef checks
Without this fix, the compiler throws an error 'template argument BASE is
not used' for the following typedef.
type templ1[BASE] BASE
foo(a ptr[in, templ1[int64]])
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Diffstat (limited to 'pkg/compiler/check.go')
| -rw-r--r-- | pkg/compiler/check.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go index adf6f4e9d..24f0a13be 100644 --- a/pkg/compiler/check.go +++ b/pkg/compiler/check.go @@ -942,7 +942,7 @@ func (comp *compiler) instantiate(templ ast.Node, params []*ast.Ident, args []*a } argUsed := make(map[string]bool) err0 := comp.errors - templ.Walk(ast.PostRecursive(func(n ast.Node) { + ast.PostRecursive(func(n ast.Node) { templArg, ok := n.(*ast.Type) if !ok { return @@ -972,7 +972,7 @@ func (comp *compiler) instantiate(templ ast.Node, params []*ast.Ident, args []*a col.Pos = concreteArg.Pos } } - })) + })(templ) for _, param := range params { if !argUsed[param.Name] { comp.error(argMap[param.Name].Pos, |
