aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpiegames <lix@piegames.de>2024-08-21 11:22:48 +0000
committerGerrit Code Review <gerrit@localhost>2024-08-21 11:22:48 +0000
commite38410799b5b78b2fc2b0c9e4b1dc0dfc5801097 (patch)
tree4580a97efd288115ab0f73d7f154d82f8771efa7 /src
parent3cbbe22fab8ba35484e7ca5a93c33a9767bec174 (diff)
parent0edfea450b90ab5843c1fb898bd9343c881bc4ad (diff)
Merge "libexpr: Soft-deprecate ancient let syntax" into main
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/parser/parser.cc10
-rw-r--r--src/libutil/deprecated-features.cc9
-rw-r--r--src/libutil/deprecated-features.hh1
3 files changed, 20 insertions, 0 deletions
diff --git a/src/libexpr/parser/parser.cc b/src/libexpr/parser/parser.cc
index 6e8ab2fe4..17463056c 100644
--- a/src/libexpr/parser/parser.cc
+++ b/src/libexpr/parser/parser.cc
@@ -668,6 +668,16 @@ template<> struct BuildAST<grammar::expr::uri> {
template<> struct BuildAST<grammar::expr::ancient_let> : change_head<BindingsState> {
static void success(const auto & in, BindingsState & b, ExprState & s, State & ps) {
+ // Added 2024-09-18. Turn into an error at some point in the future.
+ // See the documentation on deprecated features for more details.
+ if (!ps.featureSettings.isEnabled(Dep::AncientLet))
+ warn(
+ "%s found at %s. This feature is deprecated and will be removed in the future. Use %s to silence this warning.",
+ "let {",
+ ps.positions[ps.at(in)],
+ "--extra-deprecated-features ancient-let"
+ );
+
b.attrs.pos = ps.at(in);
b.attrs.recursive = true;
s.pushExpr<ExprSelect>(b.attrs.pos, b.attrs.pos, std::make_unique<ExprAttrs>(std::move(b.attrs)), ps.s.body);
diff --git a/src/libutil/deprecated-features.cc b/src/libutil/deprecated-features.cc
index de4efd93b..4de4c8ec7 100644
--- a/src/libutil/deprecated-features.cc
+++ b/src/libutil/deprecated-features.cc
@@ -37,6 +37,15 @@ constexpr std::array<DeprecatedFeatureDetails, numDepFeatures> depFeatureDetails
)",
},
{
+ .tag = Dep::AncientLet,
+ .name = "ancient-let",
+ .description = R"(
+ Allow the ancient `let { body = …; … }` syntax.
+
+ Use the `let … in` syntax instead.
+ )",
+ },
+ {
.tag = Dep::UrlLiterals,
.name = "url-literals",
.description = R"(
diff --git a/src/libutil/deprecated-features.hh b/src/libutil/deprecated-features.hh
index d4d8a57a9..bdff1bcdb 100644
--- a/src/libutil/deprecated-features.hh
+++ b/src/libutil/deprecated-features.hh
@@ -19,6 +19,7 @@ namespace nix {
enum struct DeprecatedFeature
{
RecSetOverrides,
+ AncientLet,
UrlLiterals,
};