mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 04:05:40 +03:00
Revert "lib/types: init {types.attrsWith}"
This commit is contained in:
parent
afd9ca8bf0
commit
907cb3d253
4 changed files with 47 additions and 177 deletions
|
@ -751,47 +751,17 @@ let
|
|||
t' = opt.options.type;
|
||||
mergedType = t.typeMerge t'.functor;
|
||||
typesMergeable = mergedType != null;
|
||||
|
||||
# TODO: Remove this when all downstream reliances of internals: 'functor.wrapped' are sufficiently migrated.
|
||||
# A function that adds the deprecated wrapped message to a type.
|
||||
addDeprecatedWrapped = t:
|
||||
t // {
|
||||
functor = t.functor // {
|
||||
wrapped = t.functor.wrappedDeprecationMessage {
|
||||
inherit loc;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
typeSet =
|
||||
if opt.options ? type then
|
||||
if res ? type then
|
||||
if typesMergeable then
|
||||
{
|
||||
type =
|
||||
if mergedType ? functor.wrappedDeprecationMessage then
|
||||
addDeprecatedWrapped mergedType
|
||||
else
|
||||
mergedType;
|
||||
}
|
||||
else
|
||||
# Keep in sync with the same error below!
|
||||
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
|
||||
else if opt.options.type ? functor.wrappedDeprecationMessage then
|
||||
{ type = addDeprecatedWrapped opt.options.type; }
|
||||
else
|
||||
{}
|
||||
else
|
||||
{};
|
||||
|
||||
typeSet = if (bothHave "type") && typesMergeable
|
||||
then { type = mergedType; }
|
||||
else {};
|
||||
bothHave = k: opt.options ? ${k} && res ? ${k};
|
||||
in
|
||||
if bothHave "default" ||
|
||||
bothHave "example" ||
|
||||
bothHave "description" ||
|
||||
bothHave "apply"
|
||||
bothHave "apply" ||
|
||||
(bothHave "type" && (! typesMergeable))
|
||||
then
|
||||
# Keep in sync with the same error above!
|
||||
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
|
||||
else
|
||||
let
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue