-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix C++ Print AST handling of Conversions #4493
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
Conversation
Thanks for looking into this! |
Yes, indeed. |
This PR makes the AST viewer output less confusing, but it also removes all information about conversions. At least for my own usage of Can you add this information back in a less confusing place? For the output that previously looked like this:
I'd suggest making it look like this instead:
This reflects how on the |
I had initially thought that the backwards solution was the logical conclusion of the desire to mirror what getter to call, but my brain couldn't accept printing an expression tree backwards. I was able to rationalize my preferred (forward) solution as follows:
It's not quite as clean a justification as just "create nodes for |
I suppose if #4279 is implemented then both of our solutions will be clearer. Mine will have My proposal is backwards, but it preserves adjacency. For I can see advantages and drawbacks of both proposals. I suggest we sleep on it, let the team sleep on it, and make a decision in the next team meeting. |
There might be a third option. If we do #4279, then the designators to the left of the colon will change from Here's what our running example would look like under that proposal.
|
@jbj That looks pretty verbose. I understand the push to help new QL authors learn what predicates to call, but once a developer has learned the basics, a less verbose form like we have today seems easier to read. Still, if we're putting the predicate names in there anyway, I do like your proposal to keep the existing order. |
I really like the idea of using a relatively long line to highlight the fact that there's a conversion that a user might not have thought about. 👍 |
Counterpoint: In the VSCode UI, such long strings might not be that easy to display/fit in. |
My opinion is that as long as the most useful information is generally at the start of the string, then having long strings is fine. If someone wants to see the whole string, they can make the AST Viewer wider, or simply hover over the node. Otherwise, you can just ignore the end part of the string. One thing we can consider for the future is to differentiate between the hover text and the node text. We could put more detailed information in the hover and keeping the key parts in the node text, but that's less important for now. |
The team discussed and likes another option:
|
To make this concrete, here's my interpretation of the running example under "option 4":
I threw a |
Do the "converted" entries only include the conversion chain, or will there be duplication of the |
I'm pretty sure we agreed on "no duplicates", so maybe it should be called "conversions" instead of "converted"? |
8c19eb6
to
447ba20
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.
LGTM!
This addresses #4278.
This PR does not add metadata about conversions to the nodes.
The (prior) inclusion of conversion nodes in the tree meant that multiple conversions, i.e.
were handled correctly.
With just a metadata attribute on the VariableAccess, I do not see how to represent the AST faithfully - just including the inner- or outermost cast would be misleading.
I am not happy with this, and open to suggestions how to better address this problem.