datalog: dl-walk handles circular substitutions without infinite loop (257/257)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
Bug: dl-walk would infinite-loop on a circular substitution (e.g. A→B and B→A simultaneously). The walk endlessly chased the cycle. This couldn't be produced through dl-unify (which has cycle-safe behavior via existing bindings), but raw dl-bind calls or external manipulation of the subst dict could create it. Fix: dl-walk now threads a visited-names list through the recursion. If a variable name is already in the list, the walk stops and returns the current term unchanged. Normal chained walks are unaffected (A→B→C→42 still resolves to 42). 1 new unify test verifies circular substitutions don't hang.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"lang": "datalog",
|
||||
"total_passed": 256,
|
||||
"total_passed": 257,
|
||||
"total_failed": 0,
|
||||
"total": 256,
|
||||
"total": 257,
|
||||
"suites": [
|
||||
{"name":"tokenize","passed":30,"failed":0,"total":30},
|
||||
{"name":"parse","passed":22,"failed":0,"total":22},
|
||||
{"name":"unify","passed":28,"failed":0,"total":28},
|
||||
{"name":"unify","passed":29,"failed":0,"total":29},
|
||||
{"name":"eval","passed":38,"failed":0,"total":38},
|
||||
{"name":"builtins","passed":23,"failed":0,"total":23},
|
||||
{"name":"semi_naive","passed":8,"failed":0,"total":8},
|
||||
@@ -16,5 +16,5 @@
|
||||
{"name":"magic","passed":36,"failed":0,"total":36},
|
||||
{"name":"demo","passed":21,"failed":0,"total":21}
|
||||
],
|
||||
"generated": "2026-05-10T21:16:53+00:00"
|
||||
"generated": "2026-05-11T07:20:07+00:00"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user