diff --git a/compiler/sem.nim b/compiler/sem.nim index e2ffc13089..1ced234f57 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -183,7 +183,7 @@ proc endsInNoReturn(n: PNode): bool = var it = n while it.kind in {nkStmtList, nkStmtListExpr} and it.len > 0: it = it.lastSon - result = it.kind in (nkLastBlockStmts-{nkReturnStmt}) or + result = it.kind in nkLastBlockStmts or it.kind in nkCallKinds and it[0].kind == nkSym and sfNoReturn in it[0].sym.flags proc commonType*(x: PType, y: PNode): PType = diff --git a/tests/casestmt/tcasestmt.nim b/tests/casestmt/tcasestmt.nim index 8c6ce7a389..6abea53bc6 100644 --- a/tests/casestmt/tcasestmt.nim +++ b/tests/casestmt/tcasestmt.nim @@ -258,7 +258,7 @@ func foo(input: string): int = try: parseInt(input) except: - 0 + return func foo2(b, input: string): int = case b: