Commit f6035bc0 authored by Ben Gamari's avatar Ben Gamari 🐢

MkIface: Introduce PatSynId, ReflectionId, DefMethId

Currently we don't persist these three "advisory" IdInfos through
interface files.  We easily could if needed.
parent 70ea94cb
......@@ -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")
......
......@@ -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
......
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