Skip to content

Commit 24b3527

Browse files
committed
Revert "Isolate cut in if_/3 subgoals"
This reverts commit 32d8991.
1 parent 32d8991 commit 24b3527

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

src/lib/reif.pl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,7 @@
6666
\+ predicate_property(M:G_0, (meta_predicate _)),
6767
!,
6868
MGx_0 = M:G_0.
69-
goal_expanded(call(if_(A,B,C)), if_(A,B,C)) :-
70-
acyclic_term(if_(A,B,C)),
71-
!.
72-
goal_expanded(call(M:G_0), M:G_0) :-
73-
acyclic_term(G_0),
74-
nonvar(G_0),
75-
atom(M),
76-
!.
77-
goal_expanded(call(G_0), call(Gx_0)) :-
69+
goal_expanded(call(G_0), Gx_0) :-
7870
acyclic_term(G_0),
7971
nonvar(G_0),
8072
% more conditions

src/tests/reif.pl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
)).
2929

3030
test("doesnt modify free variables", (reif:goal_expanded(A,B), A == B, var(A))).
31-
test("doesnt expand call/1", reif:goal_expanded(call(a), call(a))).
32-
test("expands call(if_/3)", reif:goal_expanded(call(if_(A,B,C)), if_(A,B,C))).
31+
test("expands call/1", reif:goal_expanded(call(a), a)).
3332
test("expands call/1 for modules", reif:goal_expanded(call(a:b(1)), a:b(1))).
3433
test("expands call/2 for modules", reif:goal_expanded(call(a:b,c), a:b(c))).
3534
test("doesn't expand call/2", reif:goal_expanded(call(b,c), call(b,c))).
@@ -55,38 +54,38 @@
5554
*/
5655
test("goal_expansion (=)", (
5756
subsumes_full_expansion(if_(1=2,a,b), (
58-
1 \= 2 -> call(b)
59-
; 1 == 2 -> call(a)
60-
; 1 = 2, call(a)
61-
; dif(1,2), call(b))))).
57+
1 \= 2 -> b
58+
; 1 == 2 -> a
59+
; 1 = 2, a
60+
; dif(1,2), b)))).
6261

6362
test("goal_expansion (;)", (
6463
subsumes_full_expansion(if_((1=2;3=3),a,b), (
6564
1 \= 2 -> if_(3=3,a,b)
66-
; 1 == 2 -> call(a)
67-
; 1 = 2, call(a)
65+
; 1 == 2 -> a
66+
; 1 = 2, a
6867
; dif(1,2), if_(3=3,a,b))))).
6968

7069
test("goal_expansion (,)", (
7170
subsumes_full_expansion(if_((1=2,3=3),a,b), (
72-
1 \= 2 -> call(b)
71+
1 \= 2 -> b
7372
; 1 == 2 -> if_(3=3,a,b)
7473
; 1 = 2, if_(3=3,a,b)
75-
; dif(1,2), call(b))))).
74+
; dif(1,2), b)))).
7675

7776
test("goal_expansion memberd_t", (
7877
subsumes_full_expansion(if_(memberd_t(f,"abcdefgh"),t,f), (
7978
call(memberd_t(f,"abcdefgh"),A),
80-
( A == true -> call(t)
81-
; A == false -> call(f)
79+
( A == true -> t
80+
; A == false -> f
8281
; nonvar(A) -> throw(error(type_error(boolean,A),_))
8382
; throw(error(instantiation_error,_))))))).
8483

8584
test("goal_expansion cond_t", (
8685
subsumes_full_expansion(if_(cond_t(a,b),t,f), (
8786
call(cond_t(a,b),A),
88-
( A == true -> call(t)
89-
; A == false -> call(f)
87+
( A == true -> t
88+
; A == false -> f
9089
; nonvar(A) -> throw(error(type_error(boolean,A),_))
9190
; throw(error(instantiation_error,_))))))).
9291

0 commit comments

Comments
 (0)