Skip to content

Commit 61ee29b

Browse files
committed
Satisfy build and lint
1 parent 6c19b98 commit 61ee29b

File tree

14 files changed

+28
-32
lines changed

14 files changed

+28
-32
lines changed

Cabal-described/src/Distribution/Described.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import Distribution.Types.AbiDependency (AbiDependency)
7676
import Distribution.Types.AbiHash (AbiHash)
7777
import Distribution.Types.BenchmarkType (BenchmarkType)
7878
import Distribution.Types.BuildType (BuildType)
79-
import Distribution.Types.Dependency (Dependency)
79+
import Distribution.Types.Dependency (Dependency, PrivateAlias(..))
8080
import Distribution.Types.ExecutableScope (ExecutableScope)
8181
import Distribution.Types.ExeDependency (ExeDependency)
8282
import Distribution.Types.ExposedModule (ExposedModule)
@@ -446,6 +446,9 @@ instance Described ModuleName where
446446
describe _ = REMunch1 (reChar '.') component where
447447
component = RECharSet csUpper <> REMunch reEps (REUnion [RECharSet csAlphaNum, RECharSet (fromString "_'")])
448448

449+
instance Described PrivateAlias where
450+
describe _ = describe (Proxy :: Proxy ModuleName)
451+
449452
instance Described ModuleReexport where
450453
describe _ = RETodo
451454

@@ -591,4 +594,4 @@ instance Described CompatLicenseFile where
591594
describe _ = describe ([] :: [Token])
592595

593596
instance Described CompatFilePath where
594-
describe _ = describe ([] :: [Token])
597+
describe _ = describe ([] :: [Token])

Cabal-tests/tests/CheckTests.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module Main
33
) where
44

55
import Test.Tasty
6-
import Test.Tasty.ExpectedFailure
76
import Test.Tasty.Golden.Advanced (goldenTest)
87

98
import Data.Algorithm.Diff (PolyDiff (..), getGroupedDiff)

Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module UnitTests.Distribution.PackageDescription.Check (tests) where
22

3-
import Distribution.Compat.Prelude.Internal
3+
import Distribution.Compat.Prelude
44
import Prelude ()
55

66
import Distribution.PackageDescription.Check

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,9 @@ computeLocalBuildConfig cfg comp programDb = do
696696

697697
data PackageInfo = PackageInfo
698698
{ internalPackageSet :: Set LibraryName
699-
, promisedDepsSet :: Map (PackageName, ComponentName) ComponentId
699+
, promisedDepsSet :: Map (PackageName, ComponentName, Maybe PrivateAlias) ComponentId
700700
, installedPackageSet :: InstalledPackageIndex
701-
, requiredDepsMap :: Map (PackageName, ComponentName) InstalledPackageInfo
701+
, requiredDepsMap :: Map (PackageName, ComponentName, Maybe PrivateAlias) InstalledPackageInfo
702702
}
703703

704704
configurePackage

Cabal/src/Distribution/Types/LocalBuildInfo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pattern LocalBuildInfo
151151
-> Maybe FilePath
152152
-> Graph ComponentLocalBuildInfo
153153
-> Map ComponentName [ComponentLocalBuildInfo]
154-
-> Map (PackageName, ComponentName) ComponentId
154+
-> Map (PackageName, ComponentName, Maybe PrivateAlias) ComponentId
155155
-> InstalledPackageIndex
156156
-> PackageDescription
157157
-> ProgramDb

cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ convLibDepsAs :: DependencyReason PN -> PrivateDependency -> [LDep PN]
561561
convLibDepsAs dr (PrivateDependency alias deps) =
562562
[ LDep dr $ Dep (PkgComponent pn (ExposedLib lib)) (Private alias) (Constrained vr)
563563
| Dependency pn vr libs <- deps, lib <- NonEmptySet.toList libs ]
564-
where
565-
566564

567565
-- | Convert a Cabal dependency on an executable (build-tools) to a solver-specific dependency.
568566
convExeDep :: DependencyReason PN -> ExeDependency -> LDep PN

cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ instance IsNode NonSetupLibDepSolverPlanPackage where
176176
nodeKey spkg
177177

178178
nodeNeighbors (NonSetupLibDepSolverPlanPackage spkg) =
179-
ordNub $ (map fst $ CD.nonSetupDeps (resolverPackageLibDeps spkg))
179+
ordNub $ map fst (CD.nonSetupDeps (resolverPackageLibDeps spkg))
180180

181181
-- | Work out which version of the Cabal we will be using to talk to the
182182
-- Setup.hs interface for this package.

cabal-install/tests/UnitTests/Distribution/Client/ScriptUtils.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ testScriptPath (ShortPath p) = withMaxSuccess 10000 $ ioProperty $ do
2929
hashed_path <- getScriptCacheDirectory p
3030
script_build_dir <- defaultScriptBuildsDir
3131
return $
32-
and
33-
-- 1. Is it a valid path at all
34-
[ isValid hashed_path
35-
, -- 2. Is the computed hashed path in the expected directory?
36-
(script_build_dir </> takeFileName hashed_path) `equalFilePath` hashed_path
37-
]
32+
-- 1. Is it a valid path at all
33+
isValid hashed_path
34+
&&
35+
-- 2. Is the computed hashed path in the expected directory?
36+
(script_build_dir </> takeFileName hashed_path) `equalFilePath` hashed_path

cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ import Distribution.Solver.Types.Settings
9797
import Distribution.Solver.Types.SolverPackage
9898
import Distribution.Solver.Types.SourcePackage
9999
import Distribution.Solver.Types.Variable
100-
import Distribution.Types.Dependency (PrivateAlias)
101100

102101
{-------------------------------------------------------------------------------
103102
Example package database DSL
@@ -293,12 +292,10 @@ data ExampleQualifier
293292
= QualNone
294293
| QualIndep ExamplePkgName
295294
| QualSetup ExamplePkgName
296-
| -- The two package names are the build target and the package containing the
297-
-- setup script.
298-
QualIndepSetup ExamplePkgName ExamplePkgName
299295
| -- The two package names are the package depending on the exe and the
300296
-- package containing the exe.
301297
QualExe ExamplePkgName ExamplePkgName
298+
-- ROMES:TODO: Add QualPrivateAlias?
302299

303300
-- | Whether to enable tests in all packages in a test case.
304301
newtype EnableAllTests = EnableAllTests Bool
@@ -680,6 +677,7 @@ exAvSrcPkg ex =
680677

681678
mkDirectD :: (ExamplePkgName, C.LibraryName, C.VersionRange, Maybe ExamplePrivateAlias) -> C.PrivateDependency
682679
mkDirectD (dep, name, vr, Just alias) = C.PrivateDependency (C.PrivateAlias (fromString alias)) [C.Dependency (C.mkPackageName dep) vr (NonEmptySet.singleton name)]
680+
mkDirectD (_, _, _, Nothing) = error "mkDirectD: private deps are never Nothing since we partition them by 'isJust' above"
683681

684682
mkFlagged
685683
:: (C.LibraryVisibility -> C.BuildInfo -> a)

cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,6 @@ runTest SolverTest{..} = askOption $ \(OptionShowSolverLog showSolverLog) ->
321321
P.PackagePath
322322
(P.IndependentComponent (C.mkPackageName s) C.ComponentSetup)
323323
(P.QualToplevel)
324-
{-
325-
QualIndepSetup p s ->
326-
P.PackagePath
327-
(P.Independent $ C.mkPackageName p)
328-
(P.QualSetup (C.mkPackageName s))
329-
-}
330324
QualExe p1 p2 ->
331325
P.PackagePath
332326
(P.IndependentBuildTool (C.mkPackageName p1) (C.mkPackageName p2))

cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import Distribution.Utils.ShortText (ShortText)
2424

2525
import Distribution.Client.Setup (defaultMaxBackjumps)
2626

27+
import Distribution.Types.Dependency (PrivateAlias(..))
28+
import Distribution.ModuleName
2729
import Distribution.Types.LibraryVisibility
2830
import Distribution.Types.PackageName
2931
import Distribution.Types.UnqualComponentName
@@ -626,6 +628,9 @@ instance Hashable OptionalStanza
626628
instance Hashable FlagName
627629
instance Hashable PackageName
628630
instance Hashable ShortText
631+
instance Hashable ModuleName
632+
instance Hashable PrivateAlias
633+
629634

630635
deriving instance Generic (Variable pn)
631636
deriving instance Generic (P.Qualified a)

cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-exe/app/Main.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ main = do
2525
"show" -> do
2626
s <- getContents
2727
let a1 :: A = decode s
28-
res <- return $ show a1
28+
res = show a1
2929
putStr (encode res)
3030
"inc" -> do
3131
s <- getContents
3232
let a1 :: A = decode s
33-
res <- return $ inc a1
33+
res = inc a1
3434
putStr (encode res)
3535
_ -> error "Hook not yet implemented"

cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-lib/src/HooksLib.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ revertA2 L2.B = L.B
6868

6969
hooks_show :: L.A -> HooksM String
7070
hooks_show a = do
71-
ver <- hooksVersion <$> ask
71+
ver <- asks hooksVersion
7272
case ver of
7373
V01 -> readHooksExe "show" (convertA1 a)
7474
V02 -> readHooksExe "show" (convertA2 a)
7575

7676
hooks_inc :: L.A -> HooksM L.A
7777
hooks_inc a = do
78-
ver <- hooksVersion <$> ask
78+
ver <- asks hooksVersion
7979
case ver of
8080
V01 -> revertA1 <$> (readHooksExe "inc" (convertA1 a))
8181
V02 -> revertA2 <$> (readHooksExe "inc" (convertA2 a))
@@ -88,7 +88,7 @@ hooks_inc a = do
8888

8989
readHooksExe :: (Binary a, Binary b) => String -> a -> HooksM b
9090
readHooksExe hook args = do
91-
exe <- hooksExe <$> ask
91+
exe <- asks hooksExe
9292
liftIO $ readHooksExe_ exe hook args
9393

9494
withForkWait :: IO () -> (IO () -> IO a) -> IO a

cabal-testsuite/src/Test/Cabal/Prelude.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ findDependencyInStore :: String -- ^package name prefix
11741174
findDependencyInStore pkgName = do
11751175
storeDir <- testStoreDir <$> getTestEnv
11761176
liftIO $ do
1177-
storeDirForGhcVersion <- head <$> listDirectory storeDir
1177+
(storeDirForGhcVersion:_) <- listDirectory storeDir
11781178
packageDirs <- listDirectory (storeDir </> storeDirForGhcVersion)
11791179
-- Ideally, we should call 'hashedInstalledPackageId' from 'Distribution.Client.PackageHash'.
11801180
-- But 'PackageHashInputs', especially 'PackageHashConfigInputs', is too hard to construct.

0 commit comments

Comments
 (0)