Fix semantic analysis with noReturn proc in tail pos (#10422)

Fixes #10417
This commit is contained in:
LemonBoy 2019-01-23 07:30:49 +01:00 • committed by Miran
commit eee9729f53
2 changed files with 12 additions and 1 deletions

View file

@ -279,6 +279,7 @@ proc semTry(c: PContext, n: PNode; flags: TExprFlags): PNode =
for i in 1..last: for i in 1..last:
var it = n.sons[i] var it = n.sons[i]
let j = it.len-1 let j = it.len-1
if not endsInNoReturn(it.sons[j]):
it.sons[j] = fitNode(c, typ, it.sons[j], it.sons[j].info) it.sons[j] = fitNode(c, typ, it.sons[j], it.sons[j].info)
result.typ = typ result.typ = typ

View file

@ -64,3 +64,13 @@ proc return_in_except =
try: return_in_except() try: return_in_except()
except: echo "RECOVER" except: echo "RECOVER"
block: #10417
proc moo() {.noreturn.} = discard
let bar =
try:
1
except:
moo()
doAssert(bar == 1)