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

noSideEffect has no effect in term rewriting macro #16566

Closed
bobeff opened this issue Jan 3, 2021 · 2 comments
Closed

noSideEffect has no effect in term rewriting macro #16566

bobeff opened this issue Jan 3, 2021 · 2 comments

Comments

@bobeff
Copy link
Contributor

bobeff commented Jan 3, 2021

According to the documentation, the following code should not match the term rewriting macro.

template optMul{`*`(a, 2)}(a: int{noSideEffect}): int = a+a

proc f(): int =
  echo "side effect!"
  result = 55

echo f() * 2 # not optimized ;-)

Current Output

side effect!
side effect!
110

Expected Output

side effect!
110

Compiler Version

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

git hash: 2aed4186989e0c9192eadcc28f989d41f92237b0
active boot switches: -d:danger
@awr1
Copy link
Contributor

awr1 commented Jan 3, 2021

Regression from v0.14.2 to v0.15

@ringabout
Copy link
Member

ringabout commented Jan 6, 2021

duplicated issue:
see #6217

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

No branches or pull requests

3 participants