-
-
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
parser-state: fix attribute merging #11294
Conversation
@@ -189,6 +155,60 @@ inline void ParserState::addAttr(ExprAttrs * attrs, AttrPath && attrPath, const | |||
} |
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 don't know if this stuff should be moved to the new overload or if it should be left here; I don't really understand what it's doing.
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.
What stuff are you referring to?
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.
Sorry, I was referring to the above five lines involving lexerState.positionToDocComment
; it's the same ‘stuff’ I'm wondering about in #11294 (comment).
ae->attrs.clear(); | ||
jAttrs->dynamicAttrs.insert(jAttrs->dynamicAttrs.end(), | ||
std::make_move_iterator(ae->dynamicAttrs.begin()), | ||
std::make_move_iterator(ae->dynamicAttrs.end())); | ||
ae->dynamicAttrs.clear(); | ||
if (ae->inheritFromExprs) { | ||
jAttrs->inheritFromExprs->insert(jAttrs->inheritFromExprs->end(), | ||
std::make_move_iterator(ae->inheritFromExprs->begin()), | ||
std::make_move_iterator(ae->inheritFromExprs->end())); | ||
ae->inheritFromExprs = nullptr; | ||
} |
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.
At the end of this block, everything about ae
worth retaining should have been merged into jAttrs
. In principle I would think that means ae
can be deleted. But because of the doc comment stuff lingering in the other overload, I don't think it's safe to do that. I settled for just clearing vectors instead. (I'm guessing at the right non-leaky stuff to do here, in general; are these move_iterators used correctly?)
I'm confused, though, about what good that doc comment stuff can do if it's being attached to an expression that essentially gets dropped on the floor.
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.
Maybe @roberth knows?
c780262
to
66ae0e2
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.
Wow! :)
66ae0e2
to
85b7453
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-08-19-nix-team-meeting-minutes-170/50942/1 |
Eelco has the week off. He'll review this later. |
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.
The improvements to error messaging are great!!
@edolstra is back afaik. |
85b7453
to
05515c5
Compare
@rhendric Can you resolve the merge conflict? Thanks! |
05515c5
to
8034589
Compare
I rebased. There was no actual merge conflict. |
Motivation
Fixes #11268.
Context
This should be non-breaking. As a side effect, it makes some duplicate attribute error messages nicer (later occurrences point back to previous occurrences rather than the other way around).
I'm working at the edge of my proficiency with C++ here, so please take extra care to verify that how I'm handling pointers and memory management is sensible, because I'm not confident that I'm doing it right.
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.