datalog: comparison ops require same-type operands
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
Type-mixed comparisons were silently inconsistent:
<("hello", 5) => no result, no error (silent false)
<(a, 5) => raises "Expected number, got symbol"
Both should fail loudly with a comprehensible message. Added
dl-compare-typeok?: <, <=, >, >= now require both operands to share
a primitive type (both numbers or both strings) and raise a clear
"comparison <op> requires same-type operands" error otherwise.
`!=` is exempted because it's the polymorphic inequality test
built on dl-tuple-equal? — cross-type pairs are legitimately unequal
and the existing semantics for that case match user intuition.
2 new regression tests; conformance 267/267.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"lang": "datalog",
|
||||
"total_passed": 265,
|
||||
"total_passed": 267,
|
||||
"total_failed": 0,
|
||||
"total": 265,
|
||||
"total": 267,
|
||||
"suites": [
|
||||
{"name":"tokenize","passed":30,"failed":0,"total":30},
|
||||
{"name":"parse","passed":22,"failed":0,"total":22},
|
||||
{"name":"unify","passed":29,"failed":0,"total":29},
|
||||
{"name":"eval","passed":40,"failed":0,"total":40},
|
||||
{"name":"builtins","passed":24,"failed":0,"total":24},
|
||||
{"name":"builtins","passed":26,"failed":0,"total":26},
|
||||
{"name":"semi_naive","passed":8,"failed":0,"total":8},
|
||||
{"name":"negation","passed":10,"failed":0,"total":10},
|
||||
{"name":"aggregates","passed":23,"failed":0,"total":23},
|
||||
@@ -16,5 +16,5 @@
|
||||
{"name":"magic","passed":36,"failed":0,"total":36},
|
||||
{"name":"demo","passed":21,"failed":0,"total":21}
|
||||
],
|
||||
"generated": "2026-05-11T08:03:45+00:00"
|
||||
"generated": "2026-05-11T08:07:23+00:00"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user