-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add more order of operation comparisons #13
base: main
Are you sure you want to change the base?
Conversation
Previously all BinOps were grouped under a single precedence enum "Op." Now, they are spread out and more fine grained. This should fix issues regarding parentheses and order of operations
src/subset/helpers.rs
Outdated
Expr::IPath( | ||
InstancePath::new(path), | ||
Some(Rc::new(Expr::new_ref(index))), | ||
) |
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.
This looks like a formatting change. In general, we try to only commit the required functional changes for a particular commit. Can you remove this?
use crate::util::pretty_print::{block, intersperse, PrettyHelper, PrettyPrint}; | ||
use crate::util::pretty_print::{ | ||
block, intersperse, PrettyHelper, PrettyPrint, | ||
}; |
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.
Formatting change
.append(width.to_doc()) | ||
.brackets(), | ||
) | ||
} |
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.
Formatting change
RcDoc::text(".") | ||
.append(RcDoc::as_string(id)) | ||
.append(expr.to_doc().parens()) | ||
}), | ||
}, | ||
), |
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.
Formatting change
src/util/pretty_print.rs
Outdated
pub fn intersperse<'a>( | ||
iter: impl Iterator<Item = RcDoc<'a>>, | ||
separator: RcDoc<'a>, | ||
) -> RcDoc<'a> { |
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.
Formatting change
src/v05/helpers.rs
Outdated
Decl::Param( | ||
name.to_string(), | ||
Expr::new_ulit_dec(32, &value.to_string()), | ||
) | ||
} |
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.
Both are formatting changes
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.
@nathanielnrn Seems like you might've committed a bunch of formatting changes. Can you separate them into a different PR or remove them entirely? Once done, I can re-review.
This reverts commit 9649010.
Sorry about that. |
src/subset/pretty_print.rs
Outdated
(P::Index, P::Not) => Ordering::Less, | ||
(P::Index, _) => Ordering::Greater, | ||
|
||
(P::Mul, P::Not) | (P::Mul, P::Index) => Ordering::Less, |
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.
Since this code was written, rust started supporting nested patterns so you can write something like:
(P::Mul, P::Not | P::Index)
Which might be easier to read
yeah, seems like this project doesn't have a |
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.
One small suggestion but otherwise looks good!
Made things nested, checks still fail due to other files' formatting from what I can tell, but should be good I think. |
That's really weird. The commands run for the workflow are here: https://github.com/vegaluisjose/vast/blob/main/Makefile Can you try running the rules in the Makefile and see if you can locally reproduce the errors? It might be the case that VSCode might be using a globally configured |
As discussed with @rachitnigam
Previously all BinOps were grouped under a single precedence enum "Op."
Now, they are spread out and more fine grained. This should fix issues
regarding parentheses and order of operations.
Also, some formatting was affected
Fixes #12