-
-
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
Set comparison throws error when attribute has error #8364
Comments
Equality only works in the realm of values, not in the realm of broader evaluation outcomes. I find this to be a sensible design decision, as most of the language operates this way.
|
You just need to move the nix-repl> x = { a = { b = throw "lol"; }; }
nix-repl> x == x
true See #3371. |
Having pointer equality would really help with graph algorithms that currently try to compare these attrsets by value. |
Describe the bug
When comparing sets where an attribute has an error, the comparison results in an error.
Steps To Reproduce
Evaluate either of the following expressions in nix repl
Expected behavior
In the two examples above the first one should be
true
and the second one should befalse
since the attribute sets are equal/unequal and we never tried to evaluate the attributes where the error is.nix-env --version
outputnix-env (Nix) 2.11.1
Additional context
builtins.elem has some strange behavior in this situation.
So a workaround to compare sets could be to use
builtins.elem
with a list of one element, but its still problematic if the element in the list has a attribute error or if the attrset has been re-named.Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: