Change types.string error to a warning instead#248278
Change types.string error to a warning instead#248278infinisil merged 2 commits intoNixOS:masterfrom
types.string error to a warning instead#248278Conversation
This reverts commit c59c6b1. This was a bit too ambitious, because no warnings were previously triggered when `string` was nested e.g. `attrsOf string`, `nullOr string`, etc. Support for nested type deprecation warnings was introduced in 4b54aed, but had to be reverted in a36e676 because it caused infinite recursion for some users, and I couldn't remember that it was reverted.
This will cause a poorer error message without option location information, but it will catch all uses of its use.
emilazy
left a comment
There was a problem hiding this comment.
This works for me, although the warning message is of course not very helpful; I guess it is too technically difficult to get option name information for this?
Maybe it'd be a good idea to leave a comment with the release it can be turned into a hard throw by so that it doesn't take another 4 years to get rid of?
|
You can get a trace for a warning using We should explain how to solve the problem instead of referring to a discussion following a post claiming that we should get rid of it (instead of why and how!). |
Yeah that was tried in the PR that had to be reverted, mentioned in the PR description
|
Is there a recommendation for manually debugging this?
|
|
@Michael-J-Ward It should at least be only a warning now, which as @roberth showed can be turned into an error, then also supporting If you're having trouble with the backtrace, could you share it here? |
The |
|
An example backtrace with the previous Detailserror:
… while calling 'g'
|
|
I'm not sure if this would be related to docs generation; the nix-darwin and Home Manager manuals don't include user-imported modules. In this case it was the configuration of a user who was having unrelated issues I was debugging that happened to have a local module with a |
|
I hacked on improved recursive type deprecation today, which does indeed work correctly and shouldn't infinite rec: #248444 |
|
If it's useful, here's the backtrace that (I think) originates from home-manager. And I'd like to verify an assumption of mine: should I expect |
Correct. Specifically it is triggered via the manual which is generated from the options.
It depends. You'd have to declare an option in such a file instead of just defining values. |
Description of changes
For one, reverts #247848.
This was a bit too ambitious, as reported in #247937 and other issues, because no warnings were previously triggered when
stringwas nested e.g.attrsOf string,nullOr string, etc.Support for nested type deprecation warnings was introduced in #99132, but had to be reverted in #121816 because it caused infinite recursion for some users, and I couldn't remember that it was reverted.
Instead this PR switches
stringsto emit a warning usinglib.warninstead. This will cause a poorer error message without option location information, but it will catch all uses of its use, hopefully allowing an actual error within a few years, any day now.