Commit fdd552e0 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Fix a build problem with integer-simple

We were trying to look up the mkInteger Id before we'd compiled
the Integer modules. I'm not sure why this never showed up with
integer-gmp; possibly we just always got lucky with the build
order.
parent f7e33ca7
......@@ -8,7 +8,8 @@ Core pass to saturate constructors and PrimOps
{-# LANGUAGE BangPatterns #-}
module CorePrep (
corePrepPgm, corePrepExpr, cvtLitInteger
corePrepPgm, corePrepExpr, cvtLitInteger,
lookupMkIntegerName,
) where
#include "HsVersions.h"
......@@ -40,6 +41,7 @@ import TysWiredIn
import DataCon
import PrimOp
import BasicTypes
import Module
import UniqSupply
import Maybes
import OrdList
......@@ -1107,10 +1109,16 @@ data CorePrepEnv = CPE {
cpe_mkIntegerId :: Id
}
lookupMkIntegerName :: DynFlags -> HscEnv -> IO Id
lookupMkIntegerName dflags hsc_env
= if thisPackage dflags == primPackageId
then return $ panic "Can't use Integer in ghc-prim"
else liftM tyThingId
$ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
mkInitialCorePrepEnv :: DynFlags -> HscEnv -> IO CorePrepEnv
mkInitialCorePrepEnv dflags hsc_env
= do mkIntegerId <- liftM tyThingId
$ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
= do mkIntegerId <- lookupMkIntegerName dflags hsc_env
return $ CPE {
cpe_dynFlags = dflags,
cpe_env = emptyVarEnv,
......
......@@ -36,7 +36,6 @@ import Name hiding (varName)
import NameSet
import NameEnv
import Avail
import PrelNames
import IfaceEnv
import TcEnv
import TcRnMonad
......@@ -986,8 +985,7 @@ tidyTopBinds :: HscEnv
-> IO (TidyEnv, CoreProgram)
tidyTopBinds hsc_env this_mod unfold_env init_occ_env binds
= do mkIntegerId <- liftM tyThingId
$ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
= do mkIntegerId <- lookupMkIntegerName dflags hsc_env
return $ tidy mkIntegerId init_env binds
where
dflags = hsc_dflags hsc_env
......
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