Skip to content

Commit

Permalink
interp: fix generic check on nil function
Browse files Browse the repository at this point in the history
Related to issue traefik/traefik#9231
  • Loading branch information
mvertes authored Aug 5, 2022
1 parent 14bc3b5 commit ae725fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions _test/gen10.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

func genFunc() (f func()) {
return f
}

func main() {
println(genFunc() == nil)
}

// Output:
// true
2 changes: 1 addition & 1 deletion interp/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ func isEmptyInterface(t *itype) bool {
}

func isGeneric(t *itype) bool {
return t.cat == funcT && t.node != nil && len(t.node.child[0].child) > 0
return t.cat == funcT && t.node != nil && len(t.node.child) > 0 && len(t.node.child[0].child) > 0
}

func isFuncSrc(t *itype) bool {
Expand Down

0 comments on commit ae725fb

Please sign in to comment.