Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noReturn pragma doesn't work when we add a doc comment #9839

Closed
timotheecour opened this issue Dec 2, 2018 · 0 comments · Fixed by #21048
Closed

noReturn pragma doesn't work when we add a doc comment #9839

timotheecour opened this issue Dec 2, 2018 · 0 comments · Fixed by #21048
Assignees
Labels

Comments

@timotheecour
Copy link
Member

timotheecour commented Dec 2, 2018

doc comment affects noReturn pragma: quit is marked as noreturn, but its effect is negated when there is a doc comment as shown below

Example

template myquit1():untyped=
  # foo
  quit(1)
template myquit2():untyped=
  ## foo
  quit(1)

proc main()=
  # uncommenting this gives Error: unreachable statement after 'return', as expected
  # myquit1()

  # BUG: uncommenting this doesn't give `Error: unreachable statement`
  myquit2()

  echo "after"

main()

Current Output

no error

Expected Output

Error: unreachable statement
@ringabout ringabout self-assigned this Dec 8, 2022
survivorm pushed a commit to survivorm/Nim that referenced this issue Feb 28, 2023
capocasa pushed a commit to capocasa/Nim that referenced this issue Mar 31, 2023
narimiran pushed a commit that referenced this issue Apr 25, 2023
narimiran pushed a commit that referenced this issue May 12, 2023
narimiran pushed a commit that referenced this issue May 15, 2023
bung87 pushed a commit to bung87/Nim that referenced this issue Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants