empty container param error msg (#11158)

This commit is contained in:
Jasper Jenkins 2019-05-04 14:28:09 -07:00 • committed by Andreas Rumpf
commit 6e4ea40475
2 changed files with 8 additions and 0 deletions

View file

@ -1133,6 +1133,9 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
if typ == nil: if typ == nil:
typ = def.typ typ = def.typ
if isEmptyContainer(typ):
localError(c.config, a.info, "cannot infer the type of parameter '" & a[0].ident.s & "'")
if typ.kind == tyTypeDesc: if typ.kind == tyTypeDesc:
# consider a proc such as: # consider a proc such as:
# proc takesType(T = int) # proc takesType(T = int)

View file

@ -0,0 +1,5 @@
discard """
errormsg: "cannot infer the type of parameter 'x'"
line: 5
"""
proc a(x = {}) = discard