summaryrefslogtreecommitdiff
path: root/compiler/iface/MkIface.hs
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2016-01-19 14:56:59 -0500
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2016-01-19 14:57:43 -0500
commit952eda2ec98e6fde27d25a8c6f398674062e398e (patch)
tree705e03cda003dd6d423bac058d5e58b15640064a /compiler/iface/MkIface.hs
parent713aa90d3c4fde18d58c321520611892ed426d38 (diff)
downloadhaskell-952eda2ec98e6fde27d25a8c6f398674062e398e.tar.gz
Fix IfaceType generation for TyCons without TyVars
- This is only used for printing purposes (in :browse etc.). - Fixes #11266. Reviewers: goldfire, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1799 GHC Trac Issues: #11266
Diffstat (limited to 'compiler/iface/MkIface.hs')
-rw-r--r--compiler/iface/MkIface.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs
index 1db02bd314..8548eb3031 100644
--- a/compiler/iface/MkIface.hs
+++ b/compiler/iface/MkIface.hs
@@ -1410,16 +1410,22 @@ tyConToIfaceDecl env tycon
-- For pretty printing purposes only.
= ( env
, IfaceData { ifName = getOccName tycon,
+ ifKind =
+ -- These don't have `tyConTyVars`, so we use an empty
+ -- environment here, instead of `tc_env1` defined below.
+ tidyToIfaceType emptyTidyEnv (tyConKind tycon),
ifCType = Nothing,
ifTyVars = funAndPrimTyVars,
ifRoles = tyConRoles tycon,
- ifKind = if_kind,
ifCtxt = [],
ifCons = IfDataTyCon [] False [],
ifRec = boolToRecFlag False,
ifGadtSyntax = False,
ifParent = IfNoParent })
where
+ -- NOTE: Not all TyCons have `tyConTyVars` field. Forcing this when `tycon`
+ -- is one of these TyCons (FunTyCon, PrimTyCon, PromotedDataCon) will cause
+ -- an error.
(tc_env1, tc_tyvars) = tidyTyClTyCoVarBndrs env (tyConTyVars tycon)
if_tc_tyvars = toIfaceTvBndrs tc_tyvars
if_kind = tidyToIfaceType tc_env1 (tyConKind tycon)