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

result variable not accepted in bool expression in parentheses #16855

Open
a-mr opened this issue Jan 28, 2021 · 0 comments · May be fixed by #24406
Open

result variable not accepted in bool expression in parentheses #16855

a-mr opened this issue Jan 28, 2021 · 0 comments · May be fixed by #24406

Comments

@a-mr
Copy link
Contributor

a-mr commented Jan 28, 2021

Example

proc f(): int =
  echo (result = 1; result > 0)

A more realistic example:

proc process(): int = 1

proc loop(): int =
  while true and (result = process(); result > 0):
    break

Current Output

Does not compile:

Error: expression '0 < result' is of type 'bool' and has to be used (or discarded)

Expected Output

Should compile and work like any other variable.

Additional Information

$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-01-28
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: fc9cf2088d8ba969115a335239d57c05fbee9ad4
active boot switches: -d:release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant