diff --git a/doc/manual/rl-next/deprecated-features.md b/doc/manual/rl-next/deprecated-features.md index 60fca16f4..e80436a7c 100644 --- a/doc/manual/rl-next/deprecated-features.md +++ b/doc/manual/rl-next/deprecated-features.md @@ -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. diff --git a/lix/libexpr/parser/state.hh b/lix/libexpr/parser/state.hh index 2417d977b..4556c4e6e 100644 --- a/lix/libexpr/parser/state.hh +++ b/lix/libexpr/parser/state.hh @@ -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], }); } diff --git a/lix/libutil/deprecated-features/rec-set-overrides.md b/lix/libutil/deprecated-features/rec-set-overrides.md index e15fc2462..22478161d 100644 --- a/lix/libutil/deprecated-features/rec-set-overrides.md +++ b/lix/libutil/deprecated-features/rec-set-overrides.md @@ -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. diff --git a/tests/functional2/lang/attrs-__overrides/parse-fail-rec.err.exp b/tests/functional2/lang/attrs-__overrides/parse-fail-rec.err.exp new file mode 100644 index 000000000..2689ab837 --- /dev/null +++ b/tests/functional2/lang/attrs-__overrides/parse-fail-rec.err.exp @@ -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| diff --git a/tests/functional2/lang/attrs-__overrides/parse-fail.err.exp b/tests/functional2/lang/attrs-__overrides/parse-fail.err.exp new file mode 100644 index 000000000..2578e60b9 --- /dev/null +++ b/tests/functional2/lang/attrs-__overrides/parse-fail.err.exp @@ -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| } diff --git a/tests/functional2/lang/attrs-__overrides/test.toml b/tests/functional2/lang/attrs-__overrides/test.toml index c1aaddc08..1464dbeed 100644 --- a/tests/functional2/lang/attrs-__overrides/test.toml +++ b/tests/functional2/lang/attrs-__overrides/test.toml @@ -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]] diff --git a/tests/functional2/lang/attrs-__overrides/warning-false-positive.out.exp b/tests/functional2/lang/attrs-__overrides/warning-false-positive.out.exp deleted file mode 100644 index cb2453fed..000000000 --- a/tests/functional2/lang/attrs-__overrides/warning-false-positive.out.exp +++ /dev/null @@ -1 +0,0 @@ -{ a = { __overrides = { a = 1; }; }; } diff --git a/tests/functional2/lang/attrs-__overrides/warning-rec.err.exp b/tests/functional2/lang/attrs-__overrides/warning-rec.err.exp deleted file mode 100644 index 45e4fffba..000000000 --- a/tests/functional2/lang/attrs-__overrides/warning-rec.err.exp +++ /dev/null @@ -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| diff --git a/tests/functional2/lang/attrs-__overrides/warning-rec.out.exp b/tests/functional2/lang/attrs-__overrides/warning-rec.out.exp deleted file mode 100644 index 7b0beb504..000000000 --- a/tests/functional2/lang/attrs-__overrides/warning-rec.out.exp +++ /dev/null @@ -1 +0,0 @@ -{ __overrides = { foo = 2; }; foo = 2; } diff --git a/tests/functional2/lang/attrs-__overrides/warning.err.exp b/tests/functional2/lang/attrs-__overrides/warning.err.exp deleted file mode 100644 index 8de159cc2..000000000 --- a/tests/functional2/lang/attrs-__overrides/warning.err.exp +++ /dev/null @@ -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| } diff --git a/tests/functional2/lang/attrs-__overrides/warning.out.exp b/tests/functional2/lang/attrs-__overrides/warning.out.exp deleted file mode 100644 index b46938032..000000000 --- a/tests/functional2/lang/attrs-__overrides/warning.out.exp +++ /dev/null @@ -1 +0,0 @@ -{ __overrides = { bar = "qux"; }; bar = "qux"; foo = "bar"; } diff --git a/tests/functional2/lang/rec-set-overrides/parse-fail.err.exp b/tests/functional2/lang/rec-set-overrides/parse-fail.err.exp new file mode 100644 index 000000000..2de0f954e --- /dev/null +++ b/tests/functional2/lang/rec-set-overrides/parse-fail.err.exp @@ -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 = {}; } diff --git a/tests/functional2/lang/rec-set-overrides/parse-okay-deprecation-warning.err.exp b/tests/functional2/lang/rec-set-overrides/parse-okay-deprecation-warning.err.exp deleted file mode 100644 index 21f3dc81e..000000000 --- a/tests/functional2/lang/rec-set-overrides/parse-okay-deprecation-warning.err.exp +++ /dev/null @@ -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 diff --git a/tests/functional2/lang/rec-set-overrides/parse-okay-deprecation-warning.out.exp b/tests/functional2/lang/rec-set-overrides/parse-okay-deprecation-warning.out.exp deleted file mode 100644 index 2d1ea55cc..000000000 --- a/tests/functional2/lang/rec-set-overrides/parse-okay-deprecation-warning.out.exp +++ /dev/null @@ -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 diff --git a/tests/functional2/lang/rec-set-overrides/test.toml b/tests/functional2/lang/rec-set-overrides/test.toml index 274d462c4..bc84e3378 100644 --- a/tests/functional2/lang/rec-set-overrides/test.toml +++ b/tests/functional2/lang/rec-set-overrides/test.toml @@ -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]]