Skip to content

Commit

Permalink
Fix check for when combined domain is empty
Browse files Browse the repository at this point in the history
Fixes #765
  • Loading branch information
cyderize committed Dec 14, 2023
1 parent 3a9bc6d commit f35c8a0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ Bug fixes:
- Fix definition of ``array_intersect`` so that it can be used in non-positive
contexts.
- Fix standards definitions of ``increasing`` variants to correct be ignored
when the argument array is empty (:bugref:`762`).\
when the argument array is empty (:bugref:`762`).
- Fix a problem where exceptions thrown for undefined expressions were not
caught during the aggregation of linear expressions, breaking relational
semantics (:bugref:`760`).
- Fix crash when calculating computed domain of a declaration (:bugref:`765`).

Changes:
^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion lib/flatten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2850,7 +2850,7 @@ KeepAlive compute_combined_domain(EnvI& env, TypeInst* ti, Expression* cur) {
Ranges::Inter<IntVal, IntSetRanges, IntSetRanges> i(dr, ibr);
combinedDomain = IntSetVal::ai(i);
if (combinedDomain->card() == 0 && !Expression::type(cur).isSet() &&
(!Expression::type(cur).isOpt() && !Expression::type(ident->decl()).isOpt())) {
!Expression::type(cur).isOpt()) {
env.fail();
}
}
Expand Down
8 changes: 8 additions & 0 deletions tests/spec/unit/regression/github_765.mzn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/***
!Test
expected: !Result
status: UNSATISFIABLE
solvers: [gecode]
***/
var 1..1: x;
var 1..1: y :: output = if false then x else 0 endif;

0 comments on commit f35c8a0

Please sign in to comment.