Public repository: timo / feel

Reader

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

test(core): ingest 0074 range_006-011 + range_properties unit test

public

test(core): ingest 0074 range_006-011 + range_properties unit test

The five comparison-test-value property decisions (`(<10).start` etc.) that
ADR-29's proviso had parked in `OUT_OF_SCOPE_EXPR_SKIPS` are now in scope, so
remove the skip and re-ingest. `0074-feel-properties` 48 → 53; suite 2872 →
2877. Extend the `range_properties` unit test with the six-operator property
table, the unknown-property null, and the `instance of range<T>` conformance
(incl. a wrong-endpoint-type `false`).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changeseta419e41739311b0086345db59204a7eab962ced4
Author (claimed)Timo Stolz <timo.stolz@gmail.com>,
Parentsa7972edc7c10
Children
Pushlog
by timo via ssh

modified crates/feel-core/src/lib.rs +30 −0

@@ -594,6 +594,36 @@
594594
         assert_eq!(ev(r#"["a".."c"].end"#), Value::String("c".into()));
595595
         // An unknown property of a range is a value-null (a range has properties).
596596
         assert_eq!(ev("[1..10].foo"), Value::Null);
597
+
598
+        // A comparison-test value `(< 10)` (ADR-32, ADR-33) is range-typed for these
599
+        // projections (§10.3.2.7 / Table 42, TCK 0074 range_006-011): the operator's
600
+        // missing endpoint is `null` and never included; the present endpoint's
601
+        // inclusivity follows the operator. Despite identical properties to a range,
602
+        // its equality stays OPAQUE — see `value_position_comparison_test`.
603
+        assert_eq!(ev("(<10).start"), Value::Null); // range_006: (<10)
604
+        assert_eq!(ev("(<10).end"), num(10.0));
605
+        assert_eq!(ev("(<10).start included"), b(false));
606
+        assert_eq!(ev("(<10).end included"), b(false));
607
+        assert_eq!(ev("(<=10).end included"), b(true)); // range_007: (<=10)
608
+        assert_eq!(ev("(>10).start"), num(10.0)); // range_009: (>10)
609
+        assert_eq!(ev("(>10).end"), Value::Null);
610
+        assert_eq!(ev("(>10).start included"), b(false));
611
+        assert_eq!(ev("(>=10).start included"), b(true)); // range_010: (>=10)
612
+        assert_eq!(ev("(=10).start"), num(10.0)); // range_011: (=10) ≡ [10..10] properties
613
+        assert_eq!(ev("(=10).end"), num(10.0));
614
+        assert_eq!(ev("(=10).start included"), b(true));
615
+        assert_eq!(ev("(=10).end included"), b(true));
616
+        assert_eq!(ev("(!=10).start included"), b(false)); // (!=10): bare endpoint, open
617
+        assert_eq!(ev("(!=10).end included"), b(false));
618
+        // An unknown property is still a value-null (it has range properties).
619
+        assert_eq!(ev("(<10).foo"), Value::Null);
620
+
621
+        // `(< 10)` is "a typed instance of the range type" (§10.3.2.7), so it conforms
622
+        // to `range<T>` on its endpoint type — even though it is never *equal* to a range.
623
+        assert_eq!(ev("(<10) instance of range<number>"), b(true));
624
+        assert_eq!(ev("(>=10) instance of range<number>"), b(true));
625
+        assert_eq!(ev(r#"(<"x") instance of range<string>"#), b(true));
626
+        assert_eq!(ev("(<10) instance of range<string>"), b(false)); // wrong endpoint type
597627
     }
598628
 
599629
     #[test]

modified crates/feel-core/tests/fixtures/0074-feel-properties.json +65 −0

@@ -319,6 +319,71 @@
319319
     "deviation": null
320320
   },
321321
   {
322
+    "id": "0074-feel-properties:range_006:range_006",
323
+    "expression": "{start included: (<10).start included, start: (<10).start, end: (<10).end, end included: (<10).end included}",
324
+    "expected": {
325
+      "start included": false,
326
+      "start": null,
327
+      "end": 10.0,
328
+      "end included": false
329
+    },
330
+    "expected_type": "context",
331
+    "comparison": "exact",
332
+    "deviation": null
333
+  },
334
+  {
335
+    "id": "0074-feel-properties:range_007:range_007",
336
+    "expression": "{start included: (<=10).start included, start: (<=10).start, end: (<=10).end, end included: (<=10).end included}",
337
+    "expected": {
338
+      "start included": false,
339
+      "start": null,
340
+      "end": 10.0,
341
+      "end included": true
342
+    },
343
+    "expected_type": "context",
344
+    "comparison": "exact",
345
+    "deviation": null
346
+  },
347
+  {
348
+    "id": "0074-feel-properties:range_009:range_009",
349
+    "expression": "{start included: (>10).start included, start: (>10).start, end: (>10).end, end included: (>10).end included}",
350
+    "expected": {
351
+      "start included": false,
352
+      "start": 10.0,
353
+      "end": null,
354
+      "end included": false
355
+    },
356
+    "expected_type": "context",
357
+    "comparison": "exact",
358
+    "deviation": null
359
+  },
360
+  {
361
+    "id": "0074-feel-properties:range_010:range_010",
362
+    "expression": "{start included: (>=10).start included, start: (>=10).start, end: (>=10).end, end included: (>=10).end included}",
363
+    "expected": {
364
+      "start included": true,
365
+      "start": 10.0,
366
+      "end": null,
367
+      "end included": false
368
+    },
369
+    "expected_type": "context",
370
+    "comparison": "exact",
371
+    "deviation": null
372
+  },
373
+  {
374
+    "id": "0074-feel-properties:range_011:range_011",
375
+    "expression": "{start included: (=10).start included, start: (=10).start, end: (=10).end, end included: (=10).end included}",
376
+    "expected": {
377
+      "start included": true,
378
+      "start": 10.0,
379
+      "end": 10.0,
380
+      "end included": true
381
+    },
382
+    "expected_type": "context",
383
+    "comparison": "exact",
384
+    "deviation": null
385
+  },
386
+  {
322387
     "id": "0074-feel-properties:time_001:time_001",
323388
     "expression": "time(\"10:30:01\").hour",
324389
     "expected": 10.0,

modified tools/ingest_tck.py +0 −12

@@ -669,18 +669,6 @@
669669
     "0021-singleton-list:001:decision4",
670670
     "0021-singleton-list:001:decision5",
671671
     "1131-feel-function-invocation:002:decision002",
672
-    # 0074 range_006-011: these boxed-context decisions express range properties
673
-    # on *opaque comparison-test values* (`(<10)`, `(<=10)`, `(>10)`, `(>=10)`,
674
-    # `(=10)`) — ADR-32 `Value::UnaryTestVal`. feel-core's `member_access` does
675
-    # not yet implement range properties for `UnaryTestVal` (it returns
676
-    # `Value::Error` → null via the lenient view). The interval-range property
677
-    # cases (range_001-005, `[1..10]` etc.) are correctly ingested. Adding
678
-    # `UnaryTestVal` range-property support is a separate feel-core increment.
679
-    "0074-feel-properties:range_006:range_006",
680
-    "0074-feel-properties:range_007:range_007",
681
-    "0074-feel-properties:range_009:range_009",
682
-    "0074-feel-properties:range_010:range_010",
683
-    "0074-feel-properties:range_011:range_011",
684672
 })
685673
 
686674
 # Named-zone literals feel-core's eager `TimeZone::get` validation rejects in the