]> Repositorios git - scryer-prolog.git/commitdiff
check for correct domain of integers in reifiable expressions also in the expanded...
authorMarkus Triska <[email protected]>
Thu, 3 Jun 2021 20:56:08 +0000 (22:56 +0200)
committerMarkus Triska <[email protected]>
Thu, 3 Jun 2021 20:57:58 +0000 (22:57 +0200)
This is to preserve domain errors instead of failing silently. Example:

   ?- 5 #> 3 #<==> 2.
   %@ caught: error(domain_error(clpz_reifiable_expression,2),unknown(2)-1)

src/lib/clpz.pl

index ee4174b3ab66c3b449c65f7b54f760af9ff07b2c..6be3a1102c8ad42c0ad2ecce22f851bc6c63e2cf 100644 (file)
@@ -2982,7 +2982,7 @@ clpz_expansion(A #<==> B, Reif) :-
         phrase(expr_conds(Y0, Y), Cs),
         list_goal(Cs0, Cond),
         Expr =.. [F,X,Y],
-        expansion_simpler(( Cond, ( var(B) ; integer(B) ) ->
+        expansion_simpler(( Cond, ( var(B) ; integer(B), clpz:between(0, 1, B) ) ->
                             (   Expr ->
                                 B = 1
                             ;   B = 0