diff --git a/src/common.js b/src/common.js index edb15e9ee9..74f8ee0aa1 100644 --- a/src/common.js +++ b/src/common.js @@ -2551,6 +2551,9 @@ if (part instanceof DomainInversion.And) { var part_inversion = part.inverse(symbol, context); var evaluated = typeof part_inversion == 'boolean'; + if (!~part.variables.indexOf(symbol)) { + continue; + } if (!evaluated) { result.push(part_inversion); } else if (part_inversion) { @@ -2602,7 +2605,7 @@ if (part instanceof DomainInversion.And) { var part_inversion = part.inverse(symbol, context); var evaluated = typeof part_inversion == 'boolean'; - if (!~this.variables.indexOf(symbol)) { + if (!~part.variables.indexOf(symbol)) { if (evaluated && part_inversion) { return true; } diff --git a/tests/sao.js b/tests/sao.js index 67ce759f95..71cc2a9cf3 100644 --- a/tests/sao.js +++ b/tests/sao.js @@ -2290,7 +2290,8 @@ 'domain_inversion(' + JSON.stringify(domain) + ', \'z\', ' + JSON.stringify(context) + ')'); context = {x: 5, y: 5}; - QUnit.strictEqual(domain_inversion(domain, 'z', context), false, + QUnit.ok(compare(domain_inversion(domain, 'z', context), + [['z', '=', 3]]), 'domain_inversion(' + JSON.stringify(domain) + ', \'z\', ' + JSON.stringify(context) + ')'); context = {x: 5, y: 7}; @@ -2315,7 +2316,8 @@ 'domain_inversion(' + JSON.stringify(domain) + ', \'z\', ' + JSON.stringify(context) + ')'); context = {y: 5}; - QUnit.strictEqual(domain_inversion(domain, 'z', context), false, + QUnit.ok(compare(domain_inversion(domain, 'z', context), + [['z', '=', 3]]), 'domain_inversion(' + JSON.stringify(domain) + ', \'z\', ' + JSON.stringify(context) + ')'); context = {x: 4, y: 7};