Commit 952eda2e authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan

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
parent 713aa90d
......@@ -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)
......
:m + GHC.Prim
:browse GHC.Prim
......@@ -239,3 +239,4 @@ test('T10576a', expect_broken(10576), ghci_script, ['T10576a.script'])
test('T10576b', expect_broken(10576), ghci_script, ['T10576b.script'])
test('T11051a', normal, ghci_script, ['T11051a.script'])
test('T11051b', normal, ghci_script, ['T11051b.script'])
test('T11266', check_stdout(lambda *args: 1), ghci_script, ['T11266.script'])
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