diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index bd64af729b..99fd625504 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -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) diff --git a/tests/errmsgs/temptysetparam.nim b/tests/errmsgs/temptysetparam.nim new file mode 100644 index 0000000000..20763fedab --- /dev/null +++ b/tests/errmsgs/temptysetparam.nim @@ -0,0 +1,5 @@ +discard """ + errormsg: "cannot infer the type of parameter 'x'" + line: 5 +""" +proc a(x = {}) = discard