about summary refs log tree commit diff
path: root/tvix/eval/src/eval.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/eval.rs')
-rw-r--r--tvix/eval/src/eval.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs
index c72e40c75d..1362c0394d 100644
--- a/tvix/eval/src/eval.rs
+++ b/tvix/eval/src/eval.rs
@@ -2,7 +2,7 @@ use std::path::PathBuf;
 
 use crate::{
     builtins::global_builtins,
-    errors::{ErrorKind, EvalResult},
+    errors::{Error, ErrorKind, EvalResult},
     value::Value,
 };
 
@@ -23,7 +23,10 @@ pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
         for err in errors {
             eprintln!("parse error: {}", err);
         }
-        return Err(ErrorKind::ParseErrors(errors.to_vec()).into());
+        return Err(Error {
+            kind: ErrorKind::ParseErrors(errors.to_vec()).into(),
+            span: file.span,
+        });
     }
 
     // If we've reached this point, there are no errors.
@@ -54,8 +57,8 @@ pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
         eprintln!(
             "compiler error: {:?} at `{}`[line {}]",
             error.kind,
-            file.source_slice(error.span.expect("TODO: non-optional")),
-            file.find_line(error.span.unwrap().low()) + 1
+            file.source_slice(error.span),
+            file.find_line(error.span.low()) + 1
         );
     }