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

Precedence issue with using <= for assignment #318

Open
leonardt opened this issue Nov 14, 2018 · 0 comments
Open

Precedence issue with using <= for assignment #318

leonardt opened this issue Nov 14, 2018 · 0 comments

Comments

@leonardt
Copy link
Collaborator

From Pat (#315 (comment)):

One thing to watch out for using <=

for i in range(N):
    I[i] <= main.J1[i] if i < 8 else 0

doesn't work since <= has lower precedence than x if p then y. This need to be written as

for i in range(N):
    I[i] <= (main.J1[i] if i < 8 else 0)

We should document this issue and consider where there's a way we can safeguard against it (e.g. AST visitor that checks for these cases and inserts the parenthesis or emits a warning).

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

1 participant