Public repository: timo / feel

Reader

An interpreter of FEEL, written in Rust, with integrations for PostgreSQL, WASM, Lua, and Python.

fix(feel-core): member probe tells a lazy host list from a list-valued member

draft feat/name-resolution-v2

fix(feel-core): member probe tells a lazy host list from a list-valued member

A lazy host list answers `get(key)` with the per-element selections
(§10.3.2.5), a lazy object with the member's value, which may itself be a
list. Only in that ambiguous case force one level to tell them apart.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Changeset9e21c3bb6d58782650a97bca226a7801554910ea
Author (claimed)Timo Stolz <timo.stolz@gmail.com>,
Parentscfa46ffe229e
Children
Pushlog
by timo via ssh

modified crates/feel-core/src/lib.rs +12 −1

@@ -133,7 +133,18 @@
133133
         (Value::Context(map), Some((seg, more))) => {
134134
             map.get(*seg).is_some_and(|next| has_member(next, more, name))
135135
         }
136
-        (Value::Foreign(f), None) => !matches!(f.0.get(name), Value::Null),
136
+        (Value::Foreign(f), None) => match f.0.get(name) {
137
+            Value::Null => false,
138
+            // A lazy host *list* answers a key with the per-element selections
139
+            // (§10.3.2.5), a lazy *object* with the member's value — which may
140
+            // itself be a list. Only in that ambiguous case force one level to
141
+            // tell them apart.
142
+            Value::List(selected) => match f.0.force() {
143
+                Value::List(_) => selected.iter().any(|v| !matches!(v, Value::Null)),
144
+                _ => true,
145
+            },
146
+            _ => true,
147
+        },
137148
         (Value::Foreign(f), Some((seg, more))) => has_member(&f.0.get(seg), more, name),
138149
         _ => false,
139150
     }