From 720e80c1f9cd2eaa6c0abf06d1e251548f67d3fb Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 4 Feb 2023 12:06:41 +0300 Subject: fix(tvix/eval): fix the default case for path parsing 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 Reviewed-by: Alyssa Ross Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/eval/src/compiler/mod.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'tvix') diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index 82f1dd5f285d..31e96955f0a5 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 -- cgit 1.4.1