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

fix[lang]: fix precedence in floordiv hint #4203

Merged
merged 10 commits into from
Aug 6, 2024

Conversation

cyberthirst
Copy link
Collaborator

@cyberthirst cyberthirst commented Aug 2, 2024

What I did

Commit Message

fix parenthesisation of child exprs in the floordiv hint. previously,
an expression like
```vyper
(x + y) / z
```

could result in a hint suggesting something with incorrect precedence,
like
```vyper
x + y // z
```

this commit conservatively adds parentheses to the hint whenever the
expr in question has child binops.

@cyberthirst
Copy link
Collaborator Author

we don't need to handle braces for AugAssign, right?

elif isinstance(node, vy_ast.AugAssign):

vyper/ast/nodes.py Outdated Show resolved Hide resolved
@cyberthirst cyberthirst added this to the v0.4.1 milestone Aug 5, 2024
@charles-cooper charles-cooper changed the title fix[lang]: fix braces for division hint fix[lang]: fix parentheses for floordiv hint Aug 6, 2024
Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@charles-cooper charles-cooper changed the title fix[lang]: fix parentheses for floordiv hint fix[lang]: fix parentheses in floordiv hint Aug 6, 2024
@charles-cooper charles-cooper changed the title fix[lang]: fix parentheses in floordiv hint fix[lang]: fix precedence in floordiv hint Aug 6, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) August 6, 2024 03:53
@charles-cooper charles-cooper merged commit b91730b into vyperlang:master Aug 6, 2024
155 checks passed
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 this pull request may close these issues.

Compiler gives incorrect arithmetic hint for decimal division
2 participants