Unverified Commit d3f6befb authored by Silvan Mosberger's avatar Silvan Mosberger Committed by GitHub
Browse files

lib/types: types.either deprecate functor.wrapped in favor of functor payload.elemType (#375090)

parents 19f68bd6 484a0477
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@
    - `lib.types.nullOr`
    - `lib.types.functionTo`
    - `lib.types.coercedTo`
    - `lib.types.either`

- Plasma 5 and Qt 5 based versions of associated software are deprecated in NixOS 25.05, and will be removed in NixOS 25.11. Users are encouraged to upgrade to Plasma 6.

+8 −0
Original line number Diff line number Diff line
@@ -439,6 +439,14 @@ NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribu
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.coercedTo.type.functor.wrapped ./deprecated-wrapped.nix
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.coercedTo.type.nestedTypes.finalType.functor.wrapped ./deprecated-wrapped.nix
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.coercedTo.type.nestedTypes.coercedType.functor.wrapped ./deprecated-wrapped.nix
# either
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.either.type.functor.wrapped ./deprecated-wrapped.nix
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedEither.type.functor.wrapped ./deprecated-wrapped.nix

NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.either.type.nestedTypes.left.functor.wrapped ./deprecated-wrapped.nix
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.either.type.nestedTypes.right.functor.wrapped ./deprecated-wrapped.nix
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedEither.type.nestedTypes.left.functor.wrapped ./deprecated-wrapped.nix
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedEither.type.nestedTypes.right.functor.wrapped ./deprecated-wrapped.nix

# Even with multiple assignments, a type error should be thrown if any of them aren't valid
checkConfigError 'A definition for option .* is not of type .*' \
+10 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ let
    nullOr
    functionTo
    coercedTo
    either
    ;
in
{
@@ -56,6 +57,12 @@ in
        options.coercedTo = mkOption {
          type = coercedTo (listOf types.str) lib.id (listOf types.str);
        };
        options.either = mkOption {
          type = either (listOf types.str) (listOf types.str);
        };
        options.mergedEither = mkOption {
          type = either (listOf types.str) (listOf types.str);
        };
      }
    )
    # Module B
@@ -77,6 +84,9 @@ in
        options.mergedFunctionTo = mkOption {
          type = functionTo (listOf types.str);
        };
        options.mergedEither = mkOption {
          type = either (listOf types.str) (listOf types.str);
        };
      }
    )
  ];
+3 −3
Original line number Diff line number Diff line
@@ -1134,13 +1134,13 @@ rec {
               then t2.merge loc defs
          else mergeOneOption loc defs;
      typeMerge = f':
        let mt1 = t1.typeMerge (elemAt f'.wrapped 0).functor;
            mt2 = t2.typeMerge (elemAt f'.wrapped 1).functor;
        let mt1 = t1.typeMerge (elemAt f'.payload.elemType 0).functor;
            mt2 = t2.typeMerge (elemAt f'.payload.elemType 1).functor;
        in
           if (name == f'.name) && (mt1 != null) && (mt2 != null)
           then functor.type mt1 mt2
           else null;
      functor = (defaultFunctor name) // { wrapped = [ t1 t2 ]; };
      functor = elemTypeFunctor name { elemType = [ t1 t2 ]; };
      nestedTypes.left = t1;
      nestedTypes.right = t2;
    };