interp: fix generic check on nil function

Related to issue https://github.com/traefik/traefik/issues/9231
This commit is contained in:
Marc Vertes
2022-08-05 18:20:08 +02:00
committed by GitHub
parent 14bc3b56b8
commit ae725fb3d9
2 changed files with 13 additions and 1 deletions

12
_test/gen10.go Normal file
View File

@@ -0,0 +1,12 @@
package main
func genFunc() (f func()) {
return f
}
func main() {
println(genFunc() == nil)
}
// Output:
// true

View File

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