Skip to content

Commit

Permalink
Merge pull request #10488 from AndreasPK/selector_fix
Browse files Browse the repository at this point in the history
Fix a incomplete selector warning
  • Loading branch information
mergify[bot] authored Oct 31, 2024
2 parents de03759 + 419890c commit 0fbb0db
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cabal/src/Distribution/Simple/Build/Macros.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ generateCabalMacrosHeader pkg_descr lbi clbi =
, let (major1, major2, minor) = majorMinor ver
]
, Z.zPackageKey = case clbi of
LibComponentLocalBuildInfo{} -> componentCompatPackageKey clbi
LibComponentLocalBuildInfo{componentCompatPackageKey = compatPackageKey} -> compatPackageKey
_ -> ""
, Z.zComponentId = prettyShow (componentComponentId clbi)
, Z.zPackageVersion = pkgVersion (package pkg_descr)
Expand Down
8 changes: 5 additions & 3 deletions Cabal/src/Distribution/Simple/Register.hs
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
{ IPI.sourcePackageId = packageId pkg
, IPI.installedUnitId = componentUnitId clbi
, IPI.installedComponentId_ = componentComponentId clbi
, IPI.instantiatedWith = componentInstantiatedWith clbi
, IPI.instantiatedWith = expectLibraryComponent (maybeComponentInstantiatedWith clbi)
, IPI.sourceLibName = libName lib
, IPI.compatPackageKey = componentCompatPackageKey clbi
, IPI.compatPackageKey = expectLibraryComponent (maybeComponentCompatPackageKey clbi)
, -- If GHC >= 8.4 we register with SDPX, otherwise with legacy license
IPI.license =
if ghc84
Expand All @@ -518,7 +518,7 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
, IPI.indefinite = componentIsIndefinite clbi
, IPI.exposed = libExposed lib
, IPI.exposedModules =
componentExposedModules clbi
expectLibraryComponent (maybeComponentExposedModules clbi)
-- add virtual modules into the list of exposed modules for the
-- package database as well.
++ map (\name -> IPI.ExposedModule name Nothing) (virtualModules bi)
Expand Down Expand Up @@ -601,6 +601,8 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
)
| otherwise =
(libdir installDirs : dynlibdir installDirs : extraLibDirs', [])
expectLibraryComponent (Just attribute) = attribute
expectLibraryComponent Nothing = (error "generalInstalledPackageInfo: Expected a library component, got something else.")

-- the compiler doesn't understand the dynamic-library-dirs field so we
-- add the dyn directory to the "normal" list in the library-dirs field
Expand Down
12 changes: 12 additions & 0 deletions Cabal/src/Distribution/Types/ComponentLocalBuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module Distribution.Types.ComponentLocalBuildInfo
( ComponentLocalBuildInfo (..)
, componentIsIndefinite
, maybeComponentInstantiatedWith
, maybeComponentCompatPackageKey
, maybeComponentExposedModules
) where

import Distribution.Compat.Prelude
Expand Down Expand Up @@ -126,3 +128,13 @@ maybeComponentInstantiatedWith :: ComponentLocalBuildInfo -> Maybe [(ModuleName,
maybeComponentInstantiatedWith
LibComponentLocalBuildInfo{componentInstantiatedWith = insts} = Just insts
maybeComponentInstantiatedWith _ = Nothing

maybeComponentCompatPackageKey :: ComponentLocalBuildInfo -> Maybe String
maybeComponentCompatPackageKey
LibComponentLocalBuildInfo{componentCompatPackageKey = key} = Just key
maybeComponentCompatPackageKey _ = Nothing

maybeComponentExposedModules :: ComponentLocalBuildInfo -> Maybe [Installed.ExposedModule]
maybeComponentExposedModules
LibComponentLocalBuildInfo{componentExposedModules = exposed} = Just exposed
maybeComponentExposedModules _ = Nothing

0 comments on commit 0fbb0db

Please sign in to comment.