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
parent ce152ed91f
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:
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:
# consider a proc such as:
# 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