Fix primop callsite parameter, const primop args - #16213
Merged
Merged
Conversation
roberth
force-pushed
the
feat-primop-callsite
branch
from
July 25, 2026 19:42
bccc046 to
7e2fe1a
Compare
xokdvium
reviewed
Jul 26, 2026
roberth
force-pushed
the
feat-primop-callsite
branch
from
July 29, 2026 19:16
7e2fe1a to
d9a851a
Compare
The primop `pos` was always `noPos`. Give it a purpose again. Since the call pos is already printed by the evaluator, it should not be forwarded everywhere. That would only add noise. Why was it `noPos`? The `PosIdx pos` parameter of `PrimOpFun` was always `noPos` in practice. `Value::determinePos` for `tPrimOp`/`tPrimOpApp` falls through to `default: return pos` with `noPos` as the fallback, so `callFunction`'s `vCur.determinePos(noPos)` unconditionally returned `noPos`. Why `CallSite`? Clean break with the mistaken `pos` parameter that didn't fit the usual pattern. Adds some friction and a place to explain the whole dynamic; see comment. The interesting bits are `eval.cc`, `eval.hh`. The rest is just putting `noPos` and `CallSite` everywhere. Assisted-By: Claude Opus 4.8
A demonstration of how the primop callsite can be used productively; see previous commit. Assisted-By: Claude Opus 4.7, 4.8
builtins.break keeps an (empty) position, because runDebugRepl falls back to the call site when the position is null, which would duplicate it. Equivalent in most cases. Assisted-By: Claude Opus 4.8
These helpers were only ever called with noPos. Useless and not worth filling in because the position is already logged by the caller's caller. See the two preceding commits for context. Assisted-By: Claude Opus 4.8
The value pointers passed to a primop are never reassigned, so express that in the type. This completes the FIXME left on `PrimOpFun` when `callFunction` was tightened to `std::span<Value * const>`, and lets the `const_cast<Value **>` at the primop call site be dropped. Assisted-By: Claude Opus 4.8
roberth
force-pushed
the
feat-primop-callsite
branch
from
July 29, 2026 23:36
d71a64f to
76112d5
Compare
const primop args
xokdvium
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fix a tech debt adjacent to a followup to my STF work.
The tech debt:
poswas alwaysnoPosin primop implsThe change is more of a three parter
eval.cc/eval.hhchanges, see commit messageContext
Last touched by Pass positions when evaluating #9555
vCurhadnoPosall along, so it did not suffer from duplicate position infoUseful for Shallow fetching error in 2.35 #16212
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.