mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
lib.types.defaultTypeMerge: Fix for functors with no wrapped attr
Downstream types that want to use `lib.types.defaultTypeMerge` must include `wrapped` even though it is deprecated or the internal `wrappedDeprecationMessage`. This is caused by accessing the `wrapped` attr in `lib.types.defaultTypeMerge`. The logic should first check if the attr exists and then if it does check if it is null.
This commit is contained in:
parent
f70c52577a
commit
f32c37b88c
3 changed files with 39 additions and 2 deletions
|
|
@ -158,8 +158,11 @@ rec {
|
|||
assert (f'.payload != null) == (f.payload != null);
|
||||
f.payload != null;
|
||||
hasWrapped =
|
||||
assert (f'.wrapped != null) == (f.wrapped != null);
|
||||
f.wrapped != null;
|
||||
let
|
||||
hasWrappedNonNull = set: set ? "wrapped" && set.wrapped != null;
|
||||
in
|
||||
assert (hasWrappedNonNull f') == (hasWrappedNonNull f);
|
||||
hasWrappedNonNull f;
|
||||
|
||||
typeFromPayload = if mergedPayload == null then null else f.type mergedPayload;
|
||||
typeFromWrapped = if mergedWrapped == null then null else f.type mergedWrapped;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue