fix(tvix/eval): use fake values for __curPos, rather than an error
Have this return the same values as builtins.unsafeGetAttrsPos, rather than returning a CatchableErrorKind, which crashes the CLI if it bubbles up. The environment we're in doesn't allow emitting a warning, as we don't have `co` in scope, but that's probably OK as a stopgap solution. Alternative to cl/11665. Change-Id: I5b2c2530842547c93b6533ed9601ee9b2923b1bf Reviewed-on: https://cl.tvl.fyi/c/depot/+/11685 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
37cebd233f
commit
d4978521b0
1 changed files with 9 additions and 2 deletions
|
@ -1612,10 +1612,16 @@ pub fn pure_builtins() -> Vec<(&'static str, Value)> {
|
||||||
crate::systems::llvm_triple_to_nix_double(CURRENT_PLATFORM).into(),
|
crate::systems::llvm_triple_to_nix_double(CURRENT_PLATFORM).into(),
|
||||||
));
|
));
|
||||||
|
|
||||||
// TODO: implement for nixpkgs compatibility
|
|
||||||
result.push((
|
result.push((
|
||||||
"__curPos",
|
"__curPos",
|
||||||
Value::from(CatchableErrorKind::UnimplementedFeature("__curPos".into())),
|
Value::Thunk(Thunk::new_suspended_native(Box::new(move || {
|
||||||
|
// TODO: implement for nixpkgs compatibility
|
||||||
|
Ok(Value::attrs(NixAttrs::from_iter([
|
||||||
|
("line", 42.into()),
|
||||||
|
("column", 42.into()),
|
||||||
|
("file", Value::String("/deep/thought".into())),
|
||||||
|
])))
|
||||||
|
}))),
|
||||||
));
|
));
|
||||||
|
|
||||||
result
|
result
|
||||||
|
@ -1709,6 +1715,7 @@ mod placeholder_builtins {
|
||||||
_name: Value,
|
_name: Value,
|
||||||
_attrset: Value,
|
_attrset: Value,
|
||||||
) -> Result<Value, ErrorKind> {
|
) -> Result<Value, ErrorKind> {
|
||||||
|
// TODO: implement for nixpkgs compatibility
|
||||||
generators::emit_warning_kind(
|
generators::emit_warning_kind(
|
||||||
&co,
|
&co,
|
||||||
WarningKind::NotImplemented("builtins.unsafeGetAttrsPos"),
|
WarningKind::NotImplemented("builtins.unsafeGetAttrsPos"),
|
||||||
|
|
Loading…
Add table
Reference in a new issue