diff --git a/compiler/universe.py b/compiler/universe.py index 3abc201..f9d7e4b 100755 --- a/compiler/universe.py +++ b/compiler/universe.py @@ -642,8 +642,15 @@ def InscribeOrbits(self, rules, depth_map): # satellites. You are responsible for those whom you tamed. master = {} for p, args in depth_map.items(): + satellite_names = [] for s in args.get('satellites', []): master[s['predicate_name']] = p + satellite_names.append(s['predicate_name']) + if stop_predicate := args.get('stop', None): + if stop_predicate['predicate_name'] not in satellite_names: + if 'satellites' not in args: + args['satellites'] = [] + args['satellites'] += [stop_predicate] for r in rules: p = r['head']['predicate_name'] if p in depth_map: diff --git a/integration_tests/duckdb_stop_test.l b/integration_tests/duckdb_stop_test.l index 46fb66a..a91df81 100644 --- a/integration_tests/duckdb_stop_test.l +++ b/integration_tests/duckdb_stop_test.l @@ -15,10 +15,10 @@ @Engine("duckdb"); -@Recursive(N, 100, stop: S); -N() = 0 :- ~S() || true; +@Recursive(N, -1, stop: S); +N() = 0 :- ~N(); N() = N() + 1; S("yes") :- N() > 10; -Test(!~ (N() > 10), !~ (N() < 20)); \ No newline at end of file +Test(!~ (N() > 10), !~ (N() < 20), Array{n -> n :- n = N()}); \ No newline at end of file diff --git a/integration_tests/duckdb_stop_test.txt b/integration_tests/duckdb_stop_test.txt index 63cd574..3057d6f 100644 --- a/integration_tests/duckdb_stop_test.txt +++ b/integration_tests/duckdb_stop_test.txt @@ -1,5 +1,5 @@ -+------+------+ -| col0 | col1 | -+------+------+ -| True | True | -+------+------+ \ No newline at end of file ++------+------+------+ +| col0 | col1 | col2 | ++------+------+------+ +| True | True | [14] | ++------+------+------+ \ No newline at end of file