-
kristenk authored
This commit simplifies the solver's internal representation of package conditionals by removing branches that are unreachable. For example, the solver now simplifies if flag(A) if flag(A) build-depends: package-a else build-depends: package-b to if flag(A) build-depends: package-a because A must be true for the second conditional to be relevant to the finalized PackageDescription. This change probably won't improve performance by simplifying real packages. However, it fixes a bug in the solver's handling of a certain edge case. Before this change, it was possible for the solver to create DependencyReasons with conflicting flag values. The conflicting values could cause a problem when one was FlagBoth, the value used when the same dependency appears on both sides of a conditional. Here is an example: if flag(A) if flag(A) build-depends: unknown-package else build-depends: unknown-package Previously, the solver inserted both A=FlagTrue and A=FlagBoth into the DependencyReason for the dependency on unknown-package. When the previous commit changed the association list of flag values into a map, FlagBoth replaced FlagTrue and prevented the solver from trying -A. This commit simplifies the conditionals to: if flag(A) build-depends: unknown-package It also adds some unit tests for dependencies occurring on both sides of conditionals. "testBackjumpingWithCommonDependency" tests the example above.
d239a60f