datalog: aggregates work as top-level query goals (183/183)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 40s

Bug: dl-match-lit (the naive matcher used by dl-find-bindings)
was missing dl-aggregate? dispatch — it was only present in
dl-fbs-aux (semi-naive). Symptom:
  (dl-query db '(count N X (p X)))
silently returned ().

Two fixes:
- Add aggregate branch to dl-match-lit before the positive case.
- dl-query-user-vars now projects only the result var (first arg)
  of an aggregate goal — the aggregated var and inner-goal vars
  are existentials and should not leak into substitutions.

2 new aggregate tests cover count and findall as direct query goals.
This commit is contained in:
2026-05-08 09:45:15 +00:00
parent f33a8d69f5
commit d66ddc614b
5 changed files with 60 additions and 15 deletions

View File

@@ -1,8 +1,8 @@
{
"lang": "datalog",
"total_passed": 181,
"total_passed": 183,
"total_failed": 0,
"total": 181,
"total": 183,
"suites": [
{"name":"tokenize","passed":26,"failed":0,"total":26},
{"name":"parse","passed":18,"failed":0,"total":18},
@@ -11,9 +11,9 @@
{"name":"builtins","passed":19,"failed":0,"total":19},
{"name":"semi_naive","passed":8,"failed":0,"total":8},
{"name":"negation","passed":10,"failed":0,"total":10},
{"name":"aggregates","passed":16,"failed":0,"total":16},
{"name":"aggregates","passed":18,"failed":0,"total":18},
{"name":"api","passed":13,"failed":0,"total":13},
{"name":"demo","passed":18,"failed":0,"total":18}
],
"generated": "2026-05-08T09:40:51+00:00"
"generated": "2026-05-08T09:45:03+00:00"
}