mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-20 07:51:32 +00:00
empty container param error msg (#11158)
This commit is contained in:
committed by
Andreas Rumpf
parent
ce152ed91f
commit
6e4ea40475
@@ -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)
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user