Skip to content

Commit ae725fb

Browse files
authored
interp: fix generic check on nil function
Related to issue traefik/traefik#9231
1 parent 14bc3b5 commit ae725fb

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

_test/gen10.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
func genFunc() (f func()) {
4+
return f
5+
}
6+
7+
func main() {
8+
println(genFunc() == nil)
9+
}
10+
11+
// Output:
12+
// true

interp/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ func isEmptyInterface(t *itype) bool {
22132213
}
22142214

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

22192219
func isFuncSrc(t *itype) bool {

0 commit comments

Comments
 (0)