From 851050e85c07f68ce0a0290fa53f6ed884751a6b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 26 Jun 2020 21:47:50 +0200 Subject: [PATCH] Solver: multiconflict analyze handles positive decision same as regular literal --- src/Composer/DependencyResolver/Solver.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index 772d022d8..c00beef65 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -471,8 +471,20 @@ class Solver if ($rule instanceof MultiConflictRule) { // there is only ever exactly one positive decision in a multiconflict rule foreach ($rule->getLiterals() as $literal) { - if (!isset($seen[abs($literal)]) && !$this->decisions->satisfy($literal)) { - $num++; + if (!isset($seen[abs($literal)]) && $this->decisions->satisfy(-$literal)) { + $l = $this->decisions->decisionLevel($literal); + if (1 === $l) { + $l1num++; + } elseif ($level === $l) { + $num++; + } else { + // not level1 or conflict level, add to new rule + $learnedLiterals[] = $literal; + + if ($l > $ruleLevel) { + $ruleLevel = $l; + } + } $seen[abs($literal)] = true; break; }