ocaml: phase 4 polymorphic variants confirmation (+3 tests, 506 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Tokenizer already classified backtick-uppercase as a ctor identical
to a nominal one, but it had never been exercised by the suite. This
commit adds three smoke tests confirming that nullary, n-ary, and
list-of-polyvariant patterns all match:
let x = polyvar(Foo) in match x with polyvar(Foo) -> 1 | polyvar(Bar) -> 2
let x = polyvar(Pair) (5, 7) in
match x with polyvar(Pair) (a, b) -> a + b | _ -> 0
List.map (fun x -> match x with polyvar(On) -> 1 | polyvar(Off) -> 0)
[polyvar(On); polyvar(Off); polyvar(On)]
(In the actual SX, polyvar(X) is the literal backtick-X — backticks
in this commit message are escaped to avoid shell interpretation.)
Since OCaml-on-SX is dynamic, there's no structural row inference,
but matching by tag works.
This commit is contained in:
@@ -407,6 +407,13 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-09 Phase 4 — polymorphic variants confirmation (+3 tests,
|
||||
506 total). The tokenizer was already classifying `` `Tag `` as a
|
||||
ctor identical to a nominal one, but it had never been exercised by
|
||||
tests. Now verified that nullary, n-ary, and list-of-polyvariants
|
||||
patterns all match: `` `Foo``, `` `Pair (5, 7)``, `[`On; `Off]`.
|
||||
Effectively free since OCaml-on-SX is dynamic — there's no
|
||||
structural row inference, but matching by tag works.
|
||||
- 2026-05-09 Phase 6 — List.sort_uniq / List.find_map (+2 tests, 503
|
||||
total). sort_uniq sorts then dedups consecutive equals. find_map
|
||||
walks until the user fn returns `Some v` and returns it (or `None`
|
||||
|
||||
Reference in New Issue
Block a user