mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 16:23:02 +00:00
Merge pull request #3238 from puckipedia/attrset-overrides-dynamic
Ensure enough space in attrset bindings
This commit is contained in:
commit
872740cf60
@ -875,7 +875,7 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v)
|
|||||||
if (hasOverrides) {
|
if (hasOverrides) {
|
||||||
Value * vOverrides = (*v.attrs)[overrides->second.displ].value;
|
Value * vOverrides = (*v.attrs)[overrides->second.displ].value;
|
||||||
state.forceAttrs(*vOverrides);
|
state.forceAttrs(*vOverrides);
|
||||||
Bindings * newBnds = state.allocBindings(v.attrs->size() + vOverrides->attrs->size());
|
Bindings * newBnds = state.allocBindings(v.attrs->capacity() + vOverrides->attrs->size());
|
||||||
for (auto & i : *v.attrs)
|
for (auto & i : *v.attrs)
|
||||||
newBnds->push_back(i);
|
newBnds->push_back(i);
|
||||||
for (auto & i : *vOverrides->attrs) {
|
for (auto & i : *vOverrides->attrs) {
|
||||||
|
1
tests/lang/eval-okay-attrs6.exp
Normal file
1
tests/lang/eval-okay-attrs6.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
{ __overrides = { bar = "qux"; }; bar = "qux"; foo = "bar"; }
|
4
tests/lang/eval-okay-attrs6.nix
Normal file
4
tests/lang/eval-okay-attrs6.nix
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
rec {
|
||||||
|
"${"foo"}" = "bar";
|
||||||
|
__overrides = { bar = "qux"; };
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user