Make unreachable code a warning instead of an error (#14816)

* Make unreachable code a warning

* Adapt test

* Trigger CI
This commit is contained in:
Clyybber 2020-06-29 08:49:53 +02:00 • committed by GitHub
commit 299ddda5f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View file

@ -2269,10 +2269,8 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
sfNoReturn in n[i][0].sym.flags:
for j in i + 1..<n.len:
case n[j].kind
of nkPragma, nkCommentStmt, nkNilLit, nkEmpty, nkBlockExpr,
nkBlockStmt, nkState: discard
else: localError(c.config, n[j].info,
"unreachable statement after 'return' statement or '{.noReturn.}' proc")
of nkPragma, nkCommentStmt, nkNilLit, nkEmpty, nkState: discard
else: message(c.config, n[j].info, warnUnreachableCode)
else: discard
if result.len == 1 and