[commit: ghc] master: Fix Trac #8448 (dc9961f)
git at git.haskell.org
git at git.haskell.org
Wed Oct 23 11:17:54 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/dc9961f9da0831fe3bc5b55722dac638635f8b5e/ghc
>---------------------------------------------------------------
commit dc9961f9da0831fe3bc5b55722dac638635f8b5e
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Oct 23 12:10:48 2013 +0100
Fix Trac #8448
We weren't dealing with built-in syntax; data constructors
that are built-in syntax (only [] actually) don't appear
in the GlobalRdrEnv
>---------------------------------------------------------------
dc9961f9da0831fe3bc5b55722dac638635f8b5e
compiler/rename/RnPat.lhs | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/compiler/rename/RnPat.lhs b/compiler/rename/RnPat.lhs
index 76b7d90..16f94fe 100644
--- a/compiler/rename/RnPat.lhs
+++ b/compiler/rename/RnPat.lhs
@@ -53,6 +53,9 @@ import RnEnv
import RnTypes
import DynFlags
import PrelNames
+import TyCon ( tyConName )
+import DataCon ( dataConTyCon )
+import TypeRep ( TyThing(..) )
import Name
import NameSet
import RdrName
@@ -609,9 +612,14 @@ rnHsRecFields1 ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot }
-- That is, the parent of the data constructor.
-- That's the parent to use for looking up record fields.
find_tycon env con
- = case lookupGRE_Name env con of
- [GRE { gre_par = ParentIs p }] -> p
- gres -> pprPanic "find_tycon" (ppr con $$ ppr gres)
+ | Just (ADataCon dc) <- wiredInNameTyThing_maybe con
+ = tyConName (dataConTyCon dc) -- Special case for [], which is built-in syntax
+ -- and not in the GlobalRdrEnv (Trac #8448)
+ | [GRE { gre_par = ParentIs p }] <- lookupGRE_Name env con
+ = p
+
+ | otherwise
+ = pprPanic "find_tycon" (ppr con $$ ppr (lookupGRE_Name env con))
dup_flds :: [[RdrName]]
-- Each list represents a RdrName that occurred more than once
More information about the ghc-commits
mailing list