about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index f96a5dcbddaf..d050fa807106 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -192,9 +192,15 @@ impl VM {
 
                 OpCode::OpAttrsIsSet => {
                     let key = self.pop().to_string()?;
-                    let attrs = self.pop().to_attrs()?;
-                    let result = Value::Bool(attrs.select(key.as_str()).is_some());
-                    self.push(result);
+                    let result = match self.pop() {
+                        Value::Attrs(attrs) => attrs.select(key.as_str()).is_some(),
+
+                        // Nix allows use of `?` on non-set types, but
+                        // always returns false in those cases.
+                        _ => false,
+                    };
+
+                    self.push(Value::Bool(result));
                 }
 
                 OpCode::OpList(count) => {