[commit: ghc] master: MkIface: Introduce PatSynId, ReflectionId, DefMethId (f6035bc)
git at git.haskell.org
git at git.haskell.org
Thu Aug 27 07:13:47 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f6035bc004fd004e421355bb88ec1e601c3c0c0c/ghc
>---------------------------------------------------------------
commit f6035bc004fd004e421355bb88ec1e601c3c0c0c
Author: Ben Gamari <ben at smart-cactus.org>
Date: Wed Aug 26 18:14:31 2015 +0200
MkIface: Introduce PatSynId, ReflectionId, DefMethId
Currently we don't persist these three "advisory" IdInfos through
interface files. We easily could if needed.
>---------------------------------------------------------------
f6035bc004fd004e421355bb88ec1e601c3c0c0c
compiler/basicTypes/IdInfo.hs | 19 ++++++++++++++++++-
compiler/iface/MkIface.hs | 13 +++++++++++--
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/compiler/basicTypes/IdInfo.hs b/compiler/basicTypes/IdInfo.hs
index e9fccbe..0291005 100644
--- a/compiler/basicTypes/IdInfo.hs
+++ b/compiler/basicTypes/IdInfo.hs
@@ -122,7 +122,8 @@ data IdDetails
-- b) when desugaring a RecordCon we can get
-- from the Id back to the data con]
- | ClassOpId Class -- ^ The 'Id' is a superclass selector or class operation of a class
+ | ClassOpId Class -- ^ The 'Id' is a superclass selector,
+ -- or class operation of a class
| PrimOpId PrimOp -- ^ The 'Id' is for a primitive operator
| FCallId ForeignCall -- ^ The 'Id' is for a foreign call
@@ -134,6 +135,19 @@ data IdDetails
-- implemented with a newtype, so it might be bad
-- to be strict on this dictionary
+ -- The rest are distinguished only for debugging reasons
+ -- e.g. to suppress them in -ddump-types
+ -- Currently we don't persist these through interface file
+ -- (see MkIface.toIfaceIdDetails), but we easily could if it mattered
+
+ | DefMethId -- ^ A default-method Id, either polymorphic or generic
+
+ | ReflectionId -- ^ A top-level Id to support runtime reflection
+ -- e.g. $trModule, or $tcT
+
+ | PatSynId -- ^ A top-level Id to support pattern synonyms;
+ -- the builder or matcher for the patern synonym
+
coVarDetails :: IdDetails
coVarDetails = VanillaId
@@ -145,6 +159,9 @@ pprIdDetails VanillaId = empty
pprIdDetails other = brackets (pp other)
where
pp VanillaId = panic "pprIdDetails"
+ pp DefMethId = ptext (sLit "DefMethId")
+ pp ReflectionId = ptext (sLit "ReflectionId")
+ pp PatSynId = ptext (sLit "PatSynId")
pp (DataConWorkId _) = ptext (sLit "DataCon")
pp (DataConWrapId _) = ptext (sLit "DataConWrapper")
pp (ClassOpId {}) = ptext (sLit "ClassOp")
diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs
index 714777a..697972a 100644
--- a/compiler/iface/MkIface.hs
+++ b/compiler/iface/MkIface.hs
@@ -1875,8 +1875,17 @@ toIfaceIdDetails VanillaId = IfVanillaId
toIfaceIdDetails (DFunId {}) = IfDFunId
toIfaceIdDetails (RecSelId { sel_naughty = n
, sel_tycon = tc }) = IfRecSelId (toIfaceTyCon tc) n
-toIfaceIdDetails other = pprTrace "toIfaceIdDetails" (ppr other)
- IfVanillaId -- Unexpected
+
+ -- Currently we don't persist these three "advisory" IdInfos
+ -- through interface files. We easily could if it mattered
+toIfaceIdDetails PatSynId = IfVanillaId
+toIfaceIdDetails ReflectionId = IfVanillaId
+toIfaceIdDetails DefMethId = IfVanillaId
+
+ -- The remaining cases are all "implicit Ids" which don't
+ -- appear in interface files at all
+toIfaceIdDetails other = pprTrace "toIfaceIdDetails" (ppr other)
+ IfVanillaId -- Unexpected; the other
toIfaceIdInfo :: IdInfo -> IfaceIdInfo
toIfaceIdInfo id_info
More information about the ghc-commits
mailing list