deprecated-features/rec-set-overrides: Upgrade to hard error

Change-Id: Ifec24ee905e821058a7259be00460bf2988429d8
This commit is contained in:
piegames
2026-01-31 21:58:33 +01:00
parent c76632e17d
commit 16bd27fb78
15 changed files with 29 additions and 75 deletions
@@ -17,3 +17,4 @@ You can opt in into the old behavior with `--extra-deprecated-features` or any e
- `tokens-no-whitespace` Function applications without space around the arguments like `0a`, `0.00.0` or `foo"1"2` are now forbidden. The same applies to list elements. The primary reason for this deprecation is to remove foot guns around surprising tokenization rules regarding number literals, but this will also free up some syntax for other purposes (e.g. `r""` strings) for reuse at some point in the future.
- `shadow-internal-symbols` has been expanded to also forbid shadowing `null`, `true` and `false`.
- `ancient-let` deprecation has been turned into a full parser error instead of a warning.
- `rec-set-overrides` deprecation has been turned into a full parser error instead of a warning.
+4 -4
View File
@@ -91,14 +91,14 @@ inline void State::dupAttr(Symbol attr, const PosIdx pos, const PosIdx prevPos)
}
inline void State::overridesFound(const PosIdx pos) {
// Added 2024-09-18, updated 2025-11-27. Turn into an error at some point in the future.
// Added 2024-09-18 as a warning, updated and made hard error 2025-11-27
// See the documentation on deprecated features for more details.
logWarning({
throw ParseError({
.msg = HintFmt(
"%s attributes are deprecated and will be removed in the future. Use %s to silence this warning.",
"__overrides",
"--extra-deprecated-features rec-set-overrides"
),
"--extra-deprecated-features rec-set-overrides"
),
.pos = positions[pos],
});
}
@@ -6,6 +6,10 @@ timeline:
release: 2.92.0
cls: [1744]
message: Introduced as soft deprecation with a warning.
- date: 2026-01-29
release: 2.95.0
cls: [5040]
message: Upgraded the warning to a parse error.
---
The magic symbol `__overrides` in recursive attribute sets is deprecated.
It was introduced in the early days of the language before the widespread use of overlays and is not needed anymore.
@@ -0,0 +1,5 @@
error: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
at /pwd/in.nix:1:8:
1| rec { __overrides.foo = 2; }
| ^
2|
@@ -0,0 +1,6 @@
error: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
at /pwd/in.nix:3:4:
2| "${"foo"}" = "bar";
3| __overrides = { bar = "qux"; };
| ^
4| }
@@ -1,7 +1,7 @@
[[test]]
name = "warning"
runner = "eval-okay"
runner = "parse-fail"
flags = ["--extra-deprecated-features", "rec-set-dynamic-attrs"]
in = [ "in.nix", "in-rec.nix" ]
matrix = true
[[test]]
@@ -1 +0,0 @@
{ a = { __overrides = { a = 1; }; }; }
@@ -1,5 +0,0 @@
warning: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
at /pwd/in.nix:1:8:
1| rec { __overrides.foo = 2; }
| ^
2|
@@ -1 +0,0 @@
{ __overrides = { foo = 2; }; foo = 2; }
@@ -1,6 +0,0 @@
warning: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
at /pwd/in.nix:3:4:
2| "${"foo"}" = "bar";
3| __overrides = { bar = "qux"; };
| ^
4| }
@@ -1 +0,0 @@
{ __overrides = { bar = "qux"; }; bar = "qux"; foo = "bar"; }
@@ -0,0 +1,6 @@
error: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
at /pwd/in.nix:3:17:
2| # Should warn
3| { a = rec {}; a.__overrides = {}; }
| ^
4| rec { __overrides = {}; }
@@ -1,12 +0,0 @@
warning: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
at /pwd/in.nix:3:17:
2| # Should warn
3| { a = rec {}; a.__overrides = {}; }
| ^
4| rec { __overrides = {}; }
warning: __overrides attributes are deprecated and will be removed in the future. Use --extra-deprecated-features rec-set-overrides to silence this warning.
at /pwd/in.nix:4:9:
3| { a = rec {}; a.__overrides = {}; }
4| rec { __overrides = {}; }
| ^
5| # Should not warn: Not recursive
@@ -1,40 +0,0 @@
_type: ExprList
elems:
- _type: ExprSet
attrs:
a:
_type: ExprSet
attrs:
__overrides:
_type: ExprSet
recursive: false
recursive: true
recursive: false
- _type: ExprSet
attrs:
__overrides:
_type: ExprSet
recursive: false
recursive: true
- _type: ExprSet
attrs:
__overrides:
_type: ExprSet
recursive: false
recursive: false
- _type: ExprSet
dynamicAttrs:
- name:
_type: ExprConcatStrings
es:
- _type: ExprLiteral
value: __overrides
valueType: String
- _type: ExprLiteral
value: ''
valueType: String
isInterpolation: false
value:
_type: ExprSet
recursive: false
recursive: true
@@ -2,10 +2,8 @@
runner = "parse-okay"
flags = [ "--extra-deprecated-features", "rec-set-overrides rec-set-merges rec-set-dynamic-attrs" ]
# Same as above but with deprecation warning
[[test]]
name = "parse-okay-deprecation-warning"
runner = "parse-okay"
runner = "parse-fail"
flags = [ "--extra-deprecated-features", "rec-set-merges rec-set-dynamic-attrs" ]
[[test]]