[GHC] #10255: API Annotations : ExprWithTySig processing discards annotated spans
#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
#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) | Keywords: Resolution: | ApiAnnotations Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by alanz): Potential solution: call `mkHsWithBndrs` with `t'` replaced by `(L l (HsParTy t'))` -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10255#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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) | Keywords: Resolution: | ApiAnnotations Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D823 -------------------------------------+------------------------------------- Changes (by alanz): * differential: => Phab:D823 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10255#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10255: API Annotations : ExprWithTySig processing discards annotated spans -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: patch Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | ApiAnnotations Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D823 -------------------------------------+------------------------------------- Changes (by alanz): * status: new => patch -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10255#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10255: API Annotations : ExprWithTySig processing discards annotated spans -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: patch Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | ApiAnnotations Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D823 -------------------------------------+------------------------------------- Comment (by Austin Seipp <austin@…>): In [changeset:"8dc294487fdaf102349c373c7db4796693573310/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="8dc294487fdaf102349c373c7db4796693573310" API Annotations : ExprWithTySig processing discards annotated spans In RdrHsSyn.checkAPat the processing for ExprWithTySig is defined as 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. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D823 GHC Trac Issues: #10255 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10255#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10255: API Annotations : ExprWithTySig processing discards annotated spans -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: closed Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: fixed | ApiAnnotations Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D823 -------------------------------------+------------------------------------- Changes (by ezyang): * status: patch => closed * resolution: => fixed Comment: Thank you for submitting useful patches fixing subtle mistakes that were made in location handling code! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10255#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC