Skip to content

Commit b74e384

Browse files
committed
generic-func: fixes #1700 for generic type constraint interface nil type crash by returning err
1 parent 9fbaae2 commit b74e384

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

interp/type.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,8 @@ func nodeType2(interp *Interpreter, sc *scope, n *node, seen []*node) (t *itype,
975975
}
976976
}
977977

978-
if lt.incomplete {
978+
if lt.incomplete { // note: per #1700 this results in a nil type with no err
979+
// but TestIssue1388 for #1388 triggers this, so not changing here.
979980
break
980981
}
981982
name := n.child[1].ident
@@ -1118,6 +1119,7 @@ func nodeType2(interp *Interpreter, sc *scope, n *node, seen []*node) (t *itype,
11181119

11191120
switch {
11201121
case t == nil:
1122+
err = n.cfgErrorf("nil type (could be trying to use a generic type constraint interface?): %s", n.kind)
11211123
case t.name != "" && t.path != "":
11221124
t.str = t.path + "." + t.name
11231125
case t.cat == nilT:

0 commit comments

Comments
 (0)