[backport 2.0] nimsuggest fix (#23336)

This commit is contained in:
Juan M Gómez
2024-03-04 08:58:54 +00:00
committed by GitHub
parent 2f15b67fd9
commit 0de70dc7f3

View File

@@ -2114,6 +2114,9 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
else:
let symKind = if n.kind == nkIteratorTy: skIterator else: skProc
result = semProcTypeWithScope(c, n, prev, symKind)
if result == nil:
localError(c.config, n.info, "type expected, but got: " & renderTree(n))
result = newOrPrevType(tyError, prev, c)
if n.kind == nkIteratorTy and result.kind == tyProc:
result.flags.incl(tfIterator)
of nkEnumTy: result = semEnum(c, n, prev)