Commit 3003d06d authored by kristenk's avatar kristenk Committed by Edward Z. Yang

Remove 'Namespace' from qualified constraints.

This commit changes the meaning of constraints like 'pkg > 5'. Previously,
'pkg > 5' only applied to the top-level 'pkg' goal without a 'Namespace', but
now it applies to any top-level goal for 'pkg'. However, the 'Namespace' field is
currently only used by --independent-goals, so this change has no effect on
behavior.
parent 5cb0408e
......@@ -731,9 +731,7 @@ userConstraintPackageName (UserConstraint _ name _) = name
userToPackageConstraint :: UserConstraint -> PackageConstraint
userToPackageConstraint (UserConstraint qual name prop) =
PackageConstraint (ScopeQualified $ Q path name) prop
where
path = PackagePath DefaultNamespace (fromUserQualifier qual)
PackageConstraint (ScopeQualified (fromUserQualifier qual) name) prop
readUserConstraint :: String -> Either String UserConstraint
readUserConstraint str =
......
......@@ -36,8 +36,8 @@ import qualified Text.PrettyPrint as Disp
-- | Determines to what packages and in what contexts a
-- constraint applies.
data ConstraintScope
-- | The package with the specified qualified name.
= ScopeQualified QPN
-- | The package with the specified name and qualifier.
= ScopeQualified Qualifier PackageName
-- | The package with the specified name regardless of
-- qualifier.
| ScopeAnyQualifier PackageName
......@@ -47,16 +47,16 @@ data ConstraintScope
-- the package with the specified name when that package is a
-- top-level dependency in the default namespace.
scopeToplevel :: PackageName -> ConstraintScope
scopeToplevel = ScopeQualified . Q (PackagePath DefaultNamespace QualToplevel)
scopeToplevel = ScopeQualified QualToplevel
-- | Returns the package name associated with a constraint scope.
scopeToPackageName :: ConstraintScope -> PackageName
scopeToPackageName (ScopeQualified (Q _ pn)) = pn
scopeToPackageName (ScopeQualified _ pn) = pn
scopeToPackageName (ScopeAnyQualifier pn) = pn
-- | Pretty-prints a constraint scope.
dispConstraintScope :: ConstraintScope -> Disp.Doc
dispConstraintScope (ScopeQualified qpn) = dispQPN qpn
dispConstraintScope (ScopeQualified q pn) = dispQualifier q <<>> disp pn
dispConstraintScope (ScopeAnyQualifier pn) = Disp.text "any." <<>> disp pn
-- | A package property is a logical predicate on packages.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment