-
Notifications
You must be signed in to change notification settings - Fork 68
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 std::fmt::Display
for abort expressions
#830
base: main
Are you sure you want to change the base?
Conversation
Just noticed a few more instances of failing to serialize out re-parsable expressions, namely infailable function calls and queries. |
src/parser/ast.rs
Outdated
@@ -933,7 +933,7 @@ pub struct Query { | |||
|
|||
impl fmt::Display for Query { | |||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |||
write!(f, "{}{}", self.target, self.path) | |||
write!(f, "{}.{}", self.target, self.path) |
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.
Without this variable queries end up mushed together e.g. foo.bar
becomes foobar
however that then causes .foo.bar
to become ..foo.bar
without the change to QueryTarget
below.
src/parser/ast.rs
Outdated
@@ -958,7 +958,7 @@ impl fmt::Display for QueryTarget { | |||
match self { | |||
Internal(v) => v.fmt(f), | |||
External(prefix) => match prefix { | |||
PathPrefix::Event => write!(f, "."), | |||
PathPrefix::Event => write!(f, ""), |
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.
Should probably just remove this write!
all together? If I understand correctly, and based on my testing QueryTarget
always appears with a .
after it even if OwnedValuePath
is empty. So this is safe.
Hi @DylanRJohnston, your project sounds quite interesting but this PR breaks a test. I don't have time to do a thorough review but for faster dev iterations you can locally use |
Hi @DylanRJohnston, since this is deep change, it is also worth pointing Vector's VRL dependency to this sha and see if those CI checks are passing. |
Hey @pront apologies I was waiting until the project was complete before coming back to fixing this pull request as I keep uncovering new problems as the project progresses and I didn't want to waste everyone's time with lots of pull requests. Since these changes are only needed at transpile time I've been able to get away with just using a fork for now although I am very interested in getting something like these changes merged into upstream. I also made a fairly controversial decision to overload the I also want to write some more comprehensive tests that ensure the |
Fixes #829. I couldn't see any tests for this code, but a very simply one exists as I wrote in the issue. Let me know if you want that included and where it should live.