[GHC] #10255: API Annotations : ExprWithTySig processing discards annotated spans

GHC ghc-devs at haskell.org
Tue Apr 7 13:11:17 UTC 2015


#10255: API Annotations : ExprWithTySig processing discards annotated spans
-------------------------------------+-------------------------------------
              Reporter:  alanz       |             Owner:  alanz
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:  7.10.2
             Component:  Compiler    |           Version:  7.10.1
  (Parser)                           |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  Other
  ApiAnnotations                     |        Blocked By:
          Architecture:              |   Related Tickets:
  Unknown/Multiple                   |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 In `RdrHsSyn.checkAPat` the processing for `ExprWithTySig` is defined as

 {{{#!hs
    ExprWithTySig e t _ -> do e <- checkLPat msg e
                              -- Pattern signatures are parsed as sigtypes,
                              -- but they aren't explicit forall points.
 Hence
                              -- we have to remove the implicit forall
 here.
                              let t' = case t of
                                         L _ (HsForAllTy Implicit _ _
                                              (L _ []) ty) -> ty
                                         other -> other
                              return (SigPatIn e (mkHsWithBndrs t'))
 }}}

 The `t'` variable ends up losing its original SrcSpan in the first case
 branch. This results in annotations becoming detached from the AST.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10255>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list