[commit: ghc] master: -package P was loading all versions of P in GHCi (#7030) (62164cf)
Simon Marlow
marlowsd at gmail.com
Tue Jul 3 09:30:07 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/62164cf56bd91ddd9449d345f8d710fbbdbf4827
>---------------------------------------------------------------
commit 62164cf56bd91ddd9449d345f8d710fbbdbf4827
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.
>---------------------------------------------------------------
compiler/main/Packages.lhs | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs
index 9831367..5bea131 100644
--- a/compiler/main/Packages.lhs
+++ b/compiler/main/Packages.lhs
@@ -767,7 +767,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 Cvs-ghc
mailing list