feat(tvix/eval): track span of first force in a thunk blackhole

This is step 1 towards being able to use all 4 spans that we know when
dealing with infinite recursion. It tracks the span at which the
force of a thunk was first requested when constructing a blackhole, so
that we can highlight the spans of the first and second forces.

These are actually the least relevant spans, but the easiest to put in
place, more coming soon.

Change-Id: I4c7e82f6211b98756439d4148a4191457cc46807
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8269
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2023-03-13 00:30:27 +03:00 committed by clbot
parent 5095e4f269
commit 3fa6b13c1e
5 changed files with 48 additions and 17 deletions

View file

@ -22,6 +22,7 @@ mod thunk;
use crate::errors::ErrorKind;
use crate::opcode::StackIdx;
use crate::spans::LightSpan;
use crate::vm::generators::{self, GenCo};
use crate::AddContext;
pub use attrs::NixAttrs;
@ -611,9 +612,9 @@ impl Value {
}
// TODO(amjoseph): de-asyncify this (when called directly by the VM)
pub async fn force(self, co: GenCo) -> Result<Value, ErrorKind> {
pub async fn force(self, co: GenCo, span: LightSpan) -> Result<Value, ErrorKind> {
if let Value::Thunk(thunk) = self {
return thunk.force(co).await;
return thunk.force(co, span).await;
}
Ok(self)