From d3cea9507fca333c23ebf5b19bfddc6ff17a9181 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Wed, 23 Oct 2019 09:27:03 +0200 Subject: 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 --- pkg/compiler/check.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg/compiler/check.go') 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, -- cgit mrf-deployment