Commit d5f1d21c authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺 Committed by GitHub
Browse files

Merge pull request #4778 from hvr/pr/case-sens-cli

Don't automatically case-correct mispelled package-names
parents 1e1ed457 7e895377
......@@ -614,10 +614,13 @@ reportPackageTargetProblems verbosity problems = do
case [ (pkg, matches) | PackageNameAmbiguous pkg matches _ <- problems ] of
[] -> return ()
ambiguities -> die' verbosity $ unlines
[ "The package name '" ++ display name
++ "' is ambiguous. It could be: "
++ intercalate ", " (map display matches)
| (name, matches) <- ambiguities ]
[ "There is no package named '" ++ display name ++ "'. "
++ (if length matches > 1
then "However, the following package names exist: "
else "However, the following package name exists: ")
++ intercalate ", " [ "'" ++ display m ++ "'" | m <- matches]
++ "."
| (name, matches) <- ambiguities ]
case [ pkg | PackageNameUnknown pkg UserTargetWorld <- problems ] of
[] -> return ()
......@@ -636,11 +639,15 @@ reportPackageTargetProblems verbosity problems = do
data MaybeAmbiguous a = None | Unambiguous a | Ambiguous [a]
-- | Given a package name and a list of matching names, figure out which one it
-- might be referring to. If there is an exact case-sensitive match then that's
-- ok. If it matches just one package case-insensitively then that's also ok.
-- The only problem is if it matches multiple packages case-insensitively, in
-- that case it is ambiguous.
-- | Given a package name and a list of matching names, figure out
-- which one it might be referring to. If there is an exact
-- case-sensitive match then that's ok (i.e. returned via
-- 'Unambiguous'). If it matches just one package case-insensitively
-- or if it matches multiple packages case-insensitively, in that case
-- the result is 'Ambiguous'.
--
-- Note: Before cabal 2.2, when only a single package matched
-- case-insensitively it would be considered 'Unambigious'.
--
disambiguatePackageName :: PackageNameEnv
-> PackageName
......@@ -648,7 +655,6 @@ disambiguatePackageName :: PackageNameEnv
disambiguatePackageName (PackageNameEnv pkgNameLookup) name =
case nub (pkgNameLookup name) of
[] -> None
[name'] -> Unambiguous name'
names -> case find (name==) names of
Just name' -> Unambiguous name'
Nothing -> Ambiguous names
......
......@@ -3,6 +3,8 @@
2.2.0.0 (current development version)
* 'cabal configure' now supports '--enable-static' which can be
used to build static libaries with GHC via GHC's `-staticlib` flag.
* Don't automatically/silently case-correct mispelled package-names
on CLI (#4778)
* 'cabal update' now supports '--index-state' which can be used to
roll back the index to an earlier state.
* 'cabal new-configure' now backs up the old 'cabal.project.local'
......
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