summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-05-01 15:06:00 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-05-01 15:06:24 +0100
commitde5d022e1543283effd67c2a03598e2bcaf49930 (patch)
tree46d2330d8d6ae0464ae9aca08b899295df985c30 /compiler
parentb626cb08b6b97965eec1ab63a890f8cbcfbcaa5b (diff)
downloadhaskell-de5d022e1543283effd67c2a03598e2bcaf49930.tar.gz
Kill off the default types in ghc-prim
We were trying to load the type for Integer to do defaulting in ghc-prim, but it's simply not available at that time.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcRnMonad.hs16
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs
index f3c16cb555..f576e335e5 100644
--- a/compiler/typecheck/TcRnMonad.hs
+++ b/compiler/typecheck/TcRnMonad.hs
@@ -125,7 +125,9 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this
tcg_rdr_env = emptyGlobalRdrEnv,
tcg_fix_env = emptyNameEnv,
tcg_field_env = RecFields emptyNameEnv emptyNameSet,
- tcg_default = Nothing,
+ tcg_default = if modulePackageKey mod == primPackageKey
+ then Just [] -- See Note [Default types]
+ else Nothing,
tcg_type_env = emptyNameEnv,
tcg_type_env_var = type_env_var,
tcg_inst_env = emptyInstEnv,
@@ -225,7 +227,17 @@ initTcForLookup hsc_env thing_inside
Nothing -> throwIO $ mkSrcErr $ snd msgs
Just x -> return x }
-{-
+{- Note [Default types]
+~~~~~~~~~~~~~~~~~~~~~~~
+The Integer type is simply not available in package ghc-prim (it is
+declared in integer-gmp). So we set the defaulting types to (Just
+[]), meaning there are no default types, rather then Nothing, which
+means "use the default default types of Integer, Double".
+
+If you don't do this, attempted defaulting in package ghc-prim causes
+an actual crash (attempting to look up the Integer type).
+
+
************************************************************************
* *
Initialisation