empty container param error msg (#11158)
This commit is contained in:
parent
ce152ed91f
commit
6e4ea40475
2 changed files with 8 additions and 0 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
5
tests/errmsgs/temptysetparam.nim
Normal file
5
tests/errmsgs/temptysetparam.nim
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "cannot infer the type of parameter 'x'"
|
||||||
|
line: 5
|
||||||
|
"""
|
||||||
|
proc a(x = {}) = discard
|
||||||
Loading…
Add table
Add a link
Reference in a new issue