From c2aaa68c2c88de686e4c1608b31e2c0aaeae205e Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Tue, 10 Jun 2025 13:19:03 +0000 Subject: [PATCH 1/3] libexpr: Use `primOp` getter --- src/libexpr/eval.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 92516db3b..752938339 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -128,7 +128,7 @@ std::string showType(const Value & v) switch (v.internalType) { case tString: return v.payload.string.context ? "a string with context" : "a string"; case tPrimOp: - return fmt("the built-in function '%s'", std::string(v.payload.primOp->name)); + return fmt("the built-in function '%s'", std::string(v.primOp()->name)); case tPrimOpApp: return fmt("the partially applied built-in function '%s'", v.primOpAppPrimOp()->name); case tExternal: return v.external()->showType(); From 77f5f50ec2378c75fddfaa33c45e3b885df465e6 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Tue, 10 Jun 2025 13:22:20 +0000 Subject: [PATCH 2/3] libexpr: Use `context` getter --- src/libexpr/eval.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 752938339..7346a7651 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -126,7 +126,7 @@ std::string showType(const Value & v) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wswitch-enum" switch (v.internalType) { - case tString: return v.payload.string.context ? "a string with context" : "a string"; + case tString: return v.context() ? "a string with context" : "a string"; case tPrimOp: return fmt("the built-in function '%s'", std::string(v.primOp()->name)); case tPrimOpApp: @@ -2297,8 +2297,8 @@ std::string_view EvalState::forceString(Value & v, const PosIdx pos, std::string void copyContext(const Value & v, NixStringContext & context, const ExperimentalFeatureSettings & xpSettings) { - if (v.payload.string.context) - for (const char * * p = v.payload.string.context; *p; ++p) + if (v.context()) + for (const char * * p = v.context(); *p; ++p) context.insert(NixStringContextElem::parse(*p, xpSettings)); } From 408873c2f7e92063d380b9ed36334de6547e887e Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Tue, 10 Jun 2025 13:23:12 +0000 Subject: [PATCH 3/3] libexpr: Use `c_str` getter --- src/libexpr/include/nix/expr/symbol-table.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libexpr/include/nix/expr/symbol-table.hh b/src/libexpr/include/nix/expr/symbol-table.hh index 1bf5b5543..20a05a09d 100644 --- a/src/libexpr/include/nix/expr/symbol-table.hh +++ b/src/libexpr/include/nix/expr/symbol-table.hh @@ -29,7 +29,7 @@ class SymbolValue : protected Value public: operator std::string_view() const noexcept { - return {payload.string.c_str, size_}; + return {c_str(), size_}; } }; @@ -122,7 +122,7 @@ public: [[gnu::always_inline]] const char * c_str() const noexcept { - return s->payload.string.c_str; + return s->c_str(); } [[gnu::always_inline]]