[commit: ghc] ghc-7.4: -package P was loading all versions of P in GHCi (#7030) (73bde5b)

git at git.haskell.org git at git.haskell.org
Mon Jul 6 08:48:19 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.4
Link       : http://ghc.haskell.org/trac/ghc/changeset/73bde5b1a70ce02373ac73885b7260194f30fb44/ghc

>---------------------------------------------------------------

commit 73bde5b1a70ce02373ac73885b7260194f30fb44
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Mon Jul 2 15:04:05 2012 +0100

    -package P was loading all versions of P in GHCi (#7030)
    
    -package P means "the latest version of P" if multiple versions are
    installed.  It was working as advertised, but we were
    eagerly *linking* all versions of P, which might cause an error if the
    package has some C code, because we can't link multiple instances of
    the same symbol.
    
    MERGED from commit 62164cf56bd91ddd9449d345f8d710fbbdbf4827


>---------------------------------------------------------------

73bde5b1a70ce02373ac73885b7260194f30fb44
 compiler/main/Packages.lhs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs
index d7dc6bc..f8bac59 100644
--- a/compiler/main/Packages.lhs
+++ b/compiler/main/Packages.lhs
@@ -776,7 +776,9 @@ mkPackageState dflags pkgs0 preload0 this_package = do
   --
   let preload1 = [ installedPackageId p | f <- flags, p <- get_exposed f ]
 
-      get_exposed (ExposePackage   s) = filter (matchingStr s) pkgs2
+      get_exposed (ExposePackage   s)
+         = take 1 $ sortByVersion (filter (matchingStr s) pkgs2)
+         --  -package P means "the latest version of P" (#7030)
       get_exposed (ExposePackageId s) = filter (matchingId  s) pkgs2
       get_exposed _                   = []
 



More information about the ghc-commits mailing list