Skip to content

Commit 13cc75e

Browse files
committed
last proc can be called with tyProc
1 parent 0c77e1a commit 13cc75e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/ast.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,8 +809,10 @@ proc replaceSon*(n: PNode; i: int; newson: PNode) {.inline.} =
809809

810810
proc last*(n: PType): PType {.inline.} =
811811
if n.state == Partial: loadType(n)
812-
assert n.kind != tyProc
813-
n.sonsImpl[^1]
812+
if n.kind == tyProc and n.nImpl.len > 1:
813+
n.nImpl[^1].sym.typ
814+
else:
815+
n.sonsImpl[^1]
814816

815817
proc elementType*(n: PType): PType {.inline.} =
816818
if n.state == Partial: loadType(n)

0 commit comments

Comments
 (0)