-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Rust: Account for captured variables #17696
Conversation
381caf9
to
5afd2d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code and results LGTM. Couple of nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
} | ||
|
||
/** Same as `DenseRank`, but allows for a context consisting of one element. */ | ||
module DenseRank2<DenseRankInputSig2 Input> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the naming perhaps be a bit better if the numbering was shifted? I.e. DenseRank1
here to indicate a size one context?
} | ||
|
||
/** Gets the dense rank of `r` in the context provided by `c1` and `c2`. */ | ||
int denseRank(C1 c1, C2 c2, Ranked r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think perhaps I would have swapped the rank and the Ranked columns, so the Ranked would be the result, same as with the builtin aggregate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whether to similarly swap in the input predicate, I don't know.
Add AST logic for identifying captured variables.
I identified and fixed two bugs as well:
variableAccessCandInScope
, as the comment says.rank
being potentially non-dense, by applying a newly introducedDenseRank
library.