fix dif:vars_remove_goal/2 (#2175), untabify forms.rs to appease format check
This commit is contained in:
10
src/forms.rs
10
src/forms.rs
@@ -744,11 +744,11 @@ impl Number {
|
|||||||
Number::Float(f) => Number::Float(OrderedFloat(f.signum())),
|
Number::Float(f) => Number::Float(OrderedFloat(f.signum())),
|
||||||
_ => {
|
_ => {
|
||||||
if self.is_positive() {
|
if self.is_positive() {
|
||||||
if self.is_zero() {
|
if self.is_zero() {
|
||||||
Number::Fixnum(Fixnum::build_with(0))
|
Number::Fixnum(Fixnum::build_with(0))
|
||||||
} else {
|
} else {
|
||||||
Number::Fixnum(Fixnum::build_with(1))
|
Number::Fixnum(Fixnum::build_with(1))
|
||||||
}
|
}
|
||||||
} else if self.is_negative() {
|
} else if self.is_negative() {
|
||||||
Number::Fixnum(Fixnum::build_with(-1))
|
Number::Fixnum(Fixnum::build_with(-1))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -33,11 +33,13 @@ remove_goal([G0|G0s], Goal0, Goals) :-
|
|||||||
|
|
||||||
vars_remove_goal([], _).
|
vars_remove_goal([], _).
|
||||||
vars_remove_goal([Var|Vars], Goal0) :-
|
vars_remove_goal([Var|Vars], Goal0) :-
|
||||||
get_atts(Var, +dif(Goals0)),
|
( get_atts(Var, +dif(Goals0)) ->
|
||||||
remove_goal(Goals0, Goal0, Goals),
|
remove_goal(Goals0, Goal0, Goals),
|
||||||
( Goals = [] ->
|
( Goals = [] ->
|
||||||
put_atts(Var, -dif(_))
|
put_atts(Var, -dif(_))
|
||||||
; put_atts(Var, +dif(Goals))
|
; put_atts(Var, +dif(Goals))
|
||||||
|
)
|
||||||
|
; true
|
||||||
),
|
),
|
||||||
vars_remove_goal(Vars, Goal0).
|
vars_remove_goal(Vars, Goal0).
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,13 @@ test("scryer-prolog#2056",(
|
|||||||
\+ E=[]
|
\+ E=[]
|
||||||
)).
|
)).
|
||||||
|
|
||||||
|
% https://github.com/mthom/scryer-prolog/issues/2175
|
||||||
|
test("scryer-prolog#2175",(
|
||||||
|
dif(A,B),
|
||||||
|
A=_C*[],
|
||||||
|
A=[]*D*B,D=[]
|
||||||
|
)).
|
||||||
|
|
||||||
main :-
|
main :-
|
||||||
findall(test(Name, Goal), test(Name, Goal), Tests),
|
findall(test(Name, Goal), test(Name, Goal), Tests),
|
||||||
run_tests(Tests, Failed),
|
run_tests(Tests, Failed),
|
||||||
|
|||||||
Reference in New Issue
Block a user