Skip to content

Commit

Permalink
lib.types.defaultTypeMerge: change precedence of payload vs wrapped
Browse files Browse the repository at this point in the history
  • Loading branch information
hsjobeki committed Oct 17, 2024
1 parent 66f9d13 commit ebe48f1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ rec {
else if (f.wrapped == null && f'.wrapped == null)
&& (f.payload == null && f'.payload == null)
then f.type
# value types
else if (f.payload != null && f'.payload != null) then
if payload != null
then f.type payload
else null
# composed types
else if (f.wrapped != null && f'.wrapped != null) && (wrapped != null)
then f.type wrapped
# value types
else if (f.payload != null && f'.payload != null) && (payload != null)
then f.type payload
else null;

# Default type functor
Expand Down Expand Up @@ -617,7 +619,7 @@ rec {
getSubModules = elemType.getSubModules;
substSubModules = m: attrsWith { elemType = elemType.substSubModules m; inherit name lazy; };
functor = defaultFunctor "attrsWith" // {
type = payload: attrsWith payload;
wrapped = elemType;
payload = {
# Important!: Add new function attributes here in case of future changes
inherit elemType name lazy;
Expand All @@ -640,7 +642,7 @@ rec {
else
null;
in
if elemType == null || name == null || lazy == null then
if elemType == null || lazy == null || name == null then
null
else
{
Expand Down

0 comments on commit ebe48f1

Please sign in to comment.