Skip to content
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

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

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

hsjobeki
Copy link
Contributor

@hsjobeki hsjobeki commented Jan 19, 2025

migrates types.either to use functor.payload.elemType to store the type

With this PR I Tested manually that basic type merge behavior still works.

Alternative design thoughts:

How about using named functor.payload attributes instead of elemtType. In this case .left and .right which would help to remove using list indexes.
Since this PR changes the type it would be a good opportunity to also change the internal representation in one go.

(elemAt f'.payload.elemType 0).functor;
(elemAt f'.payload.elemType 0).functor;

would become

f'.payload.left.functor;
f'.payload.right.functor;

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 8.has: documentation This PR adds or changes documentation 6.topic: module system About "NixOS" module system internals 6.topic: lib The Nixpkgs function library labels Jan 19, 2025
@nix-owners nix-owners bot requested review from roberth and infinisil January 19, 2025 15:52
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@infinisil This warning message is not 100% correct in this case. Because either has nestedTypes.left and right not elemType. Should we change the message to use nestedTypes.* instead ? (Leave out the last part because different types might use different attribute names)

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed together in a meeting with @hsjobeki, looking good after resolving the merge conflict :)

@infinisil infinisil merged commit d3f6bef into NixOS:master Mar 20, 2025
27 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: lib The Nixpkgs function library 6.topic: module system About "NixOS" module system internals 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants