about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-02-04T09·06+0300
committertazjin <tazjin@tvl.su>2023-02-04T12·44+0000
commit720e80c1f9cd2eaa6c0abf06d1e251548f67d3fb (patch)
tree21d6146226c70741b544f88e4c16f9785a669c4e
parent26b55f8cdacb491cd6f50a5deb067b07e04fb835 (diff)
fix(tvix/eval): fix the default case for path parsing r/5837
Plain paths like `foo/bar.nix` are also allowed, so we can not
determine this based on the prefix.

The upstream PR that is referenced in a comment here has a
significantly different interface than we expected, so I'm not
touching that comment yet in this CL before I've had more time to
digest it.

Change-Id: Iea33bbb35de9c00a7d7fedf64d02253c75c1cc9e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8032
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: Alyssa Ross <hi@alyssa.is>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
-rw-r--r--tvix/eval/src/compiler/mod.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 82f1dd5f28..31e96955f0 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -335,7 +335,7 @@ impl Compiler<'_> {
             Path::new(&raw_path).to_owned()
         } else if raw_path.starts_with('~') {
             return self.thunk(slot, node, move |c, _| {
-                // We assume that paths that home paths start with ~/ or fail to parse
+                // We assume that home paths start with ~/ or fail to parse
                 // TODO: this should be checked using a parse-fail test.
                 debug_assert!(raw_path.len() > 2 && raw_path.starts_with("~/"));
 
@@ -343,10 +343,6 @@ impl Compiler<'_> {
                 c.emit_constant(Value::UnresolvedPath(home_relative_path.into()), node);
                 c.push_op(OpCode::OpResolveHomePath, node);
             });
-        } else if raw_path.starts_with('.') {
-            let mut buf = self.root_dir.clone();
-            buf.push(&raw_path);
-            buf
         } else if raw_path.starts_with('<') {
             // TODO: decide what to do with findFile
             if raw_path.len() == 2 {
@@ -362,11 +358,9 @@ impl Compiler<'_> {
                 c.push_op(OpCode::OpFindFile, node);
             });
         } else {
-            self.emit_error(
-                node,
-                ErrorKind::NotImplemented("other path types not yet implemented"),
-            );
-            return;
+            let mut buf = self.root_dir.clone();
+            buf.push(&raw_path);
+            buf
         };
 
         // TODO: Use https://github.com/rust-lang/rfcs/issues/2208