diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/ConfiguredConversion.hs b/cabal-install-solver/src/Distribution/Solver/Modular/ConfiguredConversion.hs index 31e11e90947..1b9d357fdd1 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/ConfiguredConversion.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/ConfiguredConversion.hs @@ -75,7 +75,7 @@ convConfId parent (PI (Q (PackagePath ns qn) pn) (I v loc)) = -- As below, we need to identify where `AliasPkg` applies. This is -- needed to qualify `solverPkgLibDeps` since we may have multiple -- instances of the same package qualified. - | QualAlias pn' _ alias <- qn + | QualAlias pn' alias <- qn , parent == Just pn' -> AliasPkg (PreExistingId sourceId pi) alias | otherwise @@ -84,7 +84,7 @@ convConfId parent (PI (Q (PackagePath ns qn) pn) (I v loc)) = -- Same reasoning as for exes, the "top" qualified goal is the one -- which is private and needs to be aliased, but there might be other goals underneath which -- are solved in the same scope (but are not private) - | QualAlias pn' _ alias <- qn + | QualAlias pn' alias <- qn , parent == Just pn' -> AliasPkg (PlannedId sourceId) alias | IndependentBuildTool _ pn' <- ns diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Dependency.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Dependency.hs index 91fb6715fcf..cca47f92bb1 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Dependency.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Dependency.hs @@ -204,7 +204,7 @@ qualifyDeps QO{..} rdm (Q pp@(PackagePath ns q) pn) = go goD (Dep dep@(PkgComponent qpn (ExposedExe _)) is_private ci) _ = Dep (Q (PackagePath (IndependentBuildTool pn qpn) QualToplevel) <$> dep) is_private ci goD (Dep dep@(PkgComponent qpn (ExposedLib _)) is_private ci) comp - | Private pq <- is_private = Dep (Q (PackagePath ns (QualAlias pn comp pq)) <$> dep) is_private ci + | Private pq <- is_private = Dep (Q (PackagePath ns (QualAlias pn pq)) <$> dep) is_private ci | qBase qpn = Dep (Q (PackagePath ns (QualBase pn)) <$> dep) is_private ci | qSetup comp = Dep (Q (PackagePath (IndependentComponent pn ComponentSetup) QualToplevel) <$> dep) is_private ci | otherwise = Dep (Q (PackagePath ns (inheritedQ qpn) ) <$> dep) is_private ci diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs b/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs index 74d1add7668..4e91fd70d36 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/PrivateScopeClosure.hs @@ -235,7 +235,7 @@ findBadPrivClosures pkg rdm = -- -- * If it is not the same private scope, but in one nonetheless, -- we've reached an end and none of the packages accumulated. - | Q (PackagePath _ ps@(QualAlias _ _ _)) _ <- next + | Q (PackagePath _ ps@(QualAlias _ _)) _ <- next = if ps == bad_scope_qual then assert (not $ null acc) acc else [] diff --git a/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs b/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs index e8efe91dbe8..caa028e873e 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs @@ -87,7 +87,7 @@ constraintScopeMatches (ScopeTarget pn) (Q (PackagePath ns q) pn') = namespaceMatches (IndependentBuildTool {}) = False in namespaceMatches ns && q == QualToplevel && pn == pn' constraintScopeMatches (ScopePrivate spn alias c_pn) (Q (PackagePath _qual_ns q) c_pn') = - let qualMatches (QualAlias qual_pn _ qual_alias) = spn == qual_pn && alias == qual_alias + let qualMatches (QualAlias qual_pn qual_alias) = spn == qual_pn && alias == qual_alias qualMatches _ = False -- TODO: Check whether any ns should subsume qual_ns (if private constraint scopes grow namespaces...) in qualMatches q && c_pn == c_pn' diff --git a/cabal-install-solver/src/Distribution/Solver/Types/PackagePath.hs b/cabal-install-solver/src/Distribution/Solver/Types/PackagePath.hs index faa0eddb887..895ea6afba1 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/PackagePath.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/PackagePath.hs @@ -60,7 +60,7 @@ data Qualifier = | QualBase PackageName -- A goal which is solved per-component - | QualAlias PackageName Component PrivateAlias + | QualAlias PackageName PrivateAlias deriving (Eq, Ord, Show) @@ -75,7 +75,7 @@ data Qualifier = dispQualifier :: Qualifier -> Disp.Doc dispQualifier QualToplevel = Disp.empty dispQualifier (QualBase pn) = pretty pn <<>> Disp.text ".bb." -dispQualifier (QualAlias pn c alias) = pretty pn <<>> Disp.text ":" <<>> pretty c <<>> Disp.text ":" <<>> pretty alias <<>> Disp.text "." +dispQualifier (QualAlias pn alias) = pretty pn <<>> Disp.text ":" <<>> pretty alias <<>> Disp.text "." instance Pretty Qualifier where pretty = dispQualifier diff --git a/cabal-testsuite/PackageTests/PrivateDeps/same-scope-name/cabal.test.hs b/cabal-testsuite/PackageTests/PrivateDeps/same-scope-name/cabal.test.hs index 8128995e676..aa32d62b765 100644 --- a/cabal-testsuite/PackageTests/PrivateDeps/same-scope-name/cabal.test.hs +++ b/cabal-testsuite/PackageTests/PrivateDeps/same-scope-name/cabal.test.hs @@ -17,13 +17,21 @@ because of the conflict too main = cabalTest $ recordMode DoNotRecord $ do -- withProjectFile "cabal.project.scenea" $ -- For some reason this doesn't work... + withRepo "repo" $ do -- Succeeds because SameName from pkgA and SameName from pkgB do not collide. - cabal "build" ["pkgA", "--project-file=cabal.project.scenea"] + out <- cabal' "build" ["pkgA", "--project-file=cabal.project.scenea"] + -- We build the two versions, one for each package's private deps. + assertOutputContains "- libA-0.1.0.0 (lib) (requires build)" out + assertOutputContains "- libA-0.2.0.0 (lib) (requires build)" out + withRepo "repo" $ do -- Fails because SameName from pkgC in its two separate components - cabal "build" ["pkgC", "--project-file=cabal.project.sceneb"] + fails (cabal' "build" ["pkgC", "--project-file=cabal.project.sceneb"]) + >>= assertOutputContains "rejecting: pkgC:SameName.libA-0.2.0.0 (conflict: pkgC => pkgC:SameName.libA==0.1.0.0)" + withRepo "repo" $ do -- Fails because SameName from pkgD in the same component - cabal "build" ["pkgD", "--project-file=cabal.project.scenec"] + fails (cabal' "build" ["pkgD", "--project-file=cabal.project.scenec"]) + >>= assertOutputContains "rejecting: pkgD:SameName.libA-0.2.0.0 (conflict: pkgD => pkgD:SameName.libA==0.1.0.0)"