diff --git a/lix/libexpr/parser/state.hh b/lix/libexpr/parser/state.hh index f3d1ec2e7..fb038dfb9 100644 --- a/lix/libexpr/parser/state.hh +++ b/lix/libexpr/parser/state.hh @@ -234,7 +234,7 @@ inline void State::recSetMergeFound(const AttrPath & attrPath, const PosIdx pos) // Added 2025-11-24 inline void State::recSetDynamicAttrFound(const PosIdx pos) { - throw ParseError({ + logWarning({ .msg = HintFmt( "dynamic attributes are not allowed within recursive attrsets, because they would be " "evaluated separately from the other recursive attributes. Use %s to disable this " diff --git a/lix/libutil/deprecated-features/rec-set-dynamic-attrs.md b/lix/libutil/deprecated-features/rec-set-dynamic-attrs.md index f1855327d..20d401c05 100644 --- a/lix/libutil/deprecated-features/rec-set-dynamic-attrs.md +++ b/lix/libutil/deprecated-features/rec-set-dynamic-attrs.md @@ -4,8 +4,8 @@ internalName: RecSetDynamicAttrs timeline: - date: 2026-01-30 release: 2.95.0 - cls: [4652] - message: Introduced as a parser error. + cls: [4652, 5067] + message: Introduced as a parser warning. --- Dynamic attrs (attrs with interpolation in the key) are deprecated in `rec` attrsets. This is because the recursive dynamics fundamentally do not work with dynamic attributes, diff --git a/tests/functional2/lang/attrs-dynamic-rec/parse-fail.err.exp b/tests/functional2/lang/attrs-dynamic-rec/parse-fail.err.exp deleted file mode 100644 index e4fc5b43f..000000000 --- a/tests/functional2/lang/attrs-dynamic-rec/parse-fail.err.exp +++ /dev/null @@ -1,6 +0,0 @@ -error: dynamic attributes are not allowed within recursive attrsets, because they would be evaluated separately from the other recursive attributes. Use --extra-deprecated-features rec-set-dynamic-attrs to disable this error. - at /pwd/in.nix:4:5: - 3| foo = yep; - 4| ${foo} = "awa"; - | ^ - 5| } diff --git a/tests/functional2/lang/attrs-dynamic-rec/parse-okay-warn.err.exp b/tests/functional2/lang/attrs-dynamic-rec/parse-okay-warn.err.exp new file mode 100644 index 000000000..10949f5c1 --- /dev/null +++ b/tests/functional2/lang/attrs-dynamic-rec/parse-okay-warn.err.exp @@ -0,0 +1,6 @@ +warning: dynamic attributes are not allowed within recursive attrsets, because they would be evaluated separately from the other recursive attributes. Use --extra-deprecated-features rec-set-dynamic-attrs to disable this error. + at /pwd/in.nix:4:5: + 3| foo = yep; + 4| ${foo} = "awa"; + | ^ + 5| } diff --git a/tests/functional2/lang/attrs-dynamic-rec/parse-okay-warn.out.exp b/tests/functional2/lang/attrs-dynamic-rec/parse-okay-warn.out.exp new file mode 100644 index 000000000..6d4bfc59a --- /dev/null +++ b/tests/functional2/lang/attrs-dynamic-rec/parse-okay-warn.out.exp @@ -0,0 +1,18 @@ +_type: ExprSet +attrs: + foo: + _type: ExprVar + value: yep + yep: + _type: ExprLiteral + value: bar + valueType: String +dynamicAttrs: + - name: + _type: ExprVar + value: foo + value: + _type: ExprLiteral + value: awa + valueType: String +recursive: true diff --git a/tests/functional2/lang/attrs-dynamic-rec/parse-okay.err.exp b/tests/functional2/lang/attrs-dynamic-rec/parse-okay.err.exp new file mode 100644 index 000000000..e69de29bb diff --git a/tests/functional2/lang/attrs-dynamic-rec/test.toml b/tests/functional2/lang/attrs-dynamic-rec/test.toml index fc324f7f8..9eadfba38 100644 --- a/tests/functional2/lang/attrs-dynamic-rec/test.toml +++ b/tests/functional2/lang/attrs-dynamic-rec/test.toml @@ -1,5 +1,6 @@ [[test]] -runner = "parse-fail" +name = "parse-okay-warn" +runner = "parse-okay" matrix = true [[test]]