refactor(tvix/eval): remove todo!() calls in compiler
It is impossible for tvixbolt to recover from panics, so the user experience of typing an expression using an unsupported feature was that it would get sad and stop responding to input. Instead, raise a normal value-level error of a new variant and continue where possible. Change-Id: Ibe016c92cacb87b85095c0f83758eddc6468053e Reviewed-on: https://cl.tvl.fyi/c/depot/+/6528 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
0dc2b19ebe
commit
1844c788f5
4 changed files with 29 additions and 5 deletions
|
|
@ -187,7 +187,10 @@ impl Compiler<'_, '_> {
|
|||
// their value on the stack.
|
||||
ast::Expr::Paren(paren) => self.compile(slot, paren.expr().unwrap()),
|
||||
|
||||
ast::Expr::LegacyLet(_) => todo!("legacy let"),
|
||||
ast::Expr::LegacyLet(_) => {
|
||||
let span = self.span_for(&expr);
|
||||
self.emit_error(span, ErrorKind::NotImplemented("legacy let syntax"));
|
||||
}
|
||||
|
||||
ast::Expr::Root(_) => unreachable!("there cannot be more than one root"),
|
||||
ast::Expr::Error(_) => unreachable!("compile is only called on validated trees"),
|
||||
|
|
@ -238,7 +241,14 @@ impl Compiler<'_, '_> {
|
|||
buf
|
||||
} else {
|
||||
// TODO: decide what to do with findFile
|
||||
todo!("other path types (e.g. <...> lookups) not yet implemented")
|
||||
let span = self.span_for(&node);
|
||||
self.emit_error(
|
||||
span,
|
||||
ErrorKind::NotImplemented(
|
||||
"other path types (e.g. <...> lookups) not yet implemented",
|
||||
),
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rfcs/issues/2208
|
||||
|
|
@ -622,7 +632,12 @@ impl Compiler<'_, '_> {
|
|||
};
|
||||
|
||||
if path.len() != 1 {
|
||||
todo!("nested bindings in let expressions :(")
|
||||
let span = self.span_for(&entry);
|
||||
self.emit_error(
|
||||
span,
|
||||
ErrorKind::NotImplemented("nested bindings in let expressions :("),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
let idx = self.declare_local(&entry.attrpath().unwrap(), path.pop().unwrap());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue