Repository navigation
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.
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.
What stuff are you referring to?
There was a problem hiding this comment.
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.
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.
c780262 to
66ae0e2
Compare
66ae0e2 to
85b7453
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
Eelco has the week off. He'll review this later. |
kh3rld
left a comment
There was a problem hiding this comment.
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. |
…1294 parser-state: fix attribute merging (backport #11294)
…1294 parser-state: fix attribute merging (backport #11294)
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.