Skip to content

Rust: Data flow through overloaded operators #19685

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

paldepind
Copy link
Contributor

@paldepind paldepind commented Jun 6, 2025

This PR adds data flow through (simple) overloaded operators.

It does this by:

  • Adding a new Call class that abstracts away the different ways in which a call can occur.
  • Uses Call in type inference which chops down some LOCs.
  • Uses Call in data flow which then causes overloaded operators to be handled as calls.

Future work:

  • Support operators with more complicated desugaring (assignment operators like += and the deref operator). In the tests writing out the desugaring doesn't work either, which seem to indicate this is blocked on other missing features in data flow.
  • I think we could try and merge Call with CallExprBase. That seems doable but also has larger ramifications.
  • MaD for overloaded operators. This might make more sense to do after or together with using QL created canonical paths for MaD.

paldepind added 2 commits June 6, 2025 14:18
For instance the binary `&` is overloadable but the prefix `&` is not. Similarly, `*` has a different target depending on if it's prefix or infix.
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jun 6, 2025
@paldepind paldepind force-pushed the rust/df-operator-overloading branch from a8d8756 to 7947dbf Compare June 6, 2025 12:28
@paldepind paldepind force-pushed the rust/df-operator-overloading branch from 7947dbf to 0953436 Compare June 6, 2025 12:40
@paldepind paldepind marked this pull request as ready for review June 6, 2025 12:49
@paldepind paldepind requested a review from a team as a code owner June 6, 2025 12:49
@paldepind paldepind changed the title Rust: Data flow through operator overloading Rust: Data flow through overloaded operators Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant