Solver: analyze multi conflict rules in conflict resolution correctly
parent
bee91155a1
commit
2631210493
|
@ -189,4 +189,15 @@ class Pool implements \Countable
|
|||
{
|
||||
return \in_array($package, $this->unacceptableFixedPackages, true);
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$str = "Pool:\n";
|
||||
|
||||
foreach ($this->packages as $package) {
|
||||
$str .= '- '.str_pad($package->id, 6, ' ', STR_PAD_LEFT).': '.$package->getName()."\n";
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Composer\DependencyResolver;
|
|||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Semver\Constraint\MultiConstraint;
|
||||
|
||||
/**
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
|
@ -385,6 +386,10 @@ class Solver
|
|||
$this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
|
||||
|
||||
foreach ($rule->getLiterals() as $literal) {
|
||||
if (!$this->decisions->decided($literal)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip the one true literal
|
||||
if ($this->decisions->satisfy($literal)) {
|
||||
continue;
|
||||
|
@ -412,6 +417,16 @@ class Solver
|
|||
}
|
||||
unset($literal);
|
||||
|
||||
$decision = $this->decisions->atOffset($decisionId-1);
|
||||
if ($rule !== $decision[Decisions::DECISION_REASON] && $decision[Decisions::DECISION_REASON] instanceof MultiConflictRule) {
|
||||
$num++;
|
||||
foreach ($decision[Decisions::DECISION_REASON]->getLiterals() as $literal) {
|
||||
if (!$this->decisions->satisfy($literal)) {
|
||||
$seen[abs($literal)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$l1retry = true;
|
||||
while ($l1retry) {
|
||||
$l1retry = false;
|
||||
|
@ -459,6 +474,13 @@ class Solver
|
|||
$l1num++;
|
||||
$l1retry = true;
|
||||
}
|
||||
|
||||
$decision = $this->decisions->atOffset($decisionId);
|
||||
$rule = $decision[Decisions::DECISION_REASON];
|
||||
|
||||
if ($rule instanceof MultiConflictRule) {
|
||||
$l1retry = true;
|
||||
}
|
||||
}
|
||||
|
||||
$decision = $this->decisions->atOffset($decisionId);
|
||||
|
|
Loading…
Reference in New Issue