Commit e587217b authored by Alan Zimmerman's avatar Alan Zimmerman

Add the rest of the notes for Located RdrName

parent 70efb629
......@@ -129,6 +129,8 @@ is Less Cool because
data HsExpr id
= HsVar (Located id) -- ^ Variable
-- See Note [Located RdrNames]
| HsUnboundVar OccName -- ^ Unbound variable; also used for "holes" _, or _x.
-- Turned from HsVar to HsUnboundVar by the renamer, when
-- it finds an out-of-scope variable
......@@ -592,6 +594,16 @@ P x = P False
hence we need to provide the correct dictionaries to P on the RHS so that we can
build the expression.
Note [Located RdrNames]
~~~~~~~~~~~~~~~~~~~~~~~
A number of syntax elements have seemingly redundant locations attached to them.
This is deliberate, to allow transformations making use of the API Annotations
to easily correlate a Located Name in the RenamedSource with a Located RdrName
in the ParsedSource.
There are unfortunately enough differences between the ParsedSource and the
RenamedSource that the API Annotations cannot be used directly with
RenamedSource, so this allows a simple mapping to be used based on the location.
-}
instance OutputableBndr id => Outputable (HsExpr id) where
......
......@@ -141,11 +141,13 @@ data IE name
-- 'ApiAnnotation.AnnType'
-- For details on above see note [Api annotations] in ApiAnnotation
-- See Note [Located RdrNames] in HsExpr
| IEThingAbs (Located name) -- ^ Class/Type (can't tell)
-- - 'ApiAnnotation.AnnKeywordId's : 'ApiAnnotation.AnnPattern',
-- 'ApiAnnotation.AnnType','ApiAnnotation.AnnVal'
-- For details on above see note [Api annotations] in ApiAnnotation
-- See Note [Located RdrNames] in HsExpr
| IEThingAll (Located name) -- ^ Class/Type plus all methods/constructors
--
-- - 'ApiAnnotation.AnnKeywordId's : 'ApiAnnotation.AnnOpen',
......
......@@ -74,7 +74,8 @@ data Pat id
-- The sole reason for a type on a WildPat is to
-- support hsPatType :: Pat Id -> Type
| VarPat (Located id) -- Variable
| VarPat (Located id) -- Variable
-- See Note [Located RdrNames] in HsExpr
| LazyPat (LPat id) -- Lazy pattern
-- ^ - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnTilde'
......
......@@ -226,7 +226,7 @@ instance OutputableBndr HsIPName where
data HsTyVarBndr name
= UserTyVar -- no explicit kinding
(Located name)
-- See Note [Located RdrNames] in HsExpr
| KindedTyVar
(Located name)
(LHsKind name) -- The user-supplied kind signature
......@@ -268,6 +268,7 @@ data HsType name
| HsTyVar (Located name)
-- Type variable, type constructor, or data constructor
-- see Note [Promotions (HsTyVar)]
-- See Note [Located RdrNames] in HsExpr
-- ^ - 'ApiAnnotation.AnnKeywordId' : None
-- For details on above see note [Api annotations] in ApiAnnotation
......
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