[GHC] #10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy

#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy -------------------------------------+------------------------------------- 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: None/Unknown ApiAnnotations | Blocked By: Architecture: | Related Tickets: Unknown/Multiple | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- When `mkGadtDecl` is presented wih a `HsFunTy` it discards the SrcSpan, thus disconnecting any annotations on the `HsFunTy`. {{{#!hs mkGadtDecl names (L ls (HsForAllTy imp Nothing qvars cxt tau)) = return $ mk_gadt_con names where (details, res_ty) -- See Note [Sorting out the result type] = case tau of L _ (HsFunTy (L l (HsRecTy flds)) res_ty) -> (RecCon (L l flds), res_ty) _other -> (PrefixCon [], tau) ... }}} This can be triggered by the following {{{#!hs {-# LANGUAGE GADTs #-} module GADTRecords2 (H1(..)) where -- | h1 data H1 a b where C3 :: (Num a) => { field :: a -- ^ hello docs } -> H1 Int Int }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10309 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy -------------------------------------+------------------------------------- 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: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by alanz): This occurs for the `HsFunTy` which loses its SrcSpan. The only annotation at this level is an `AnnRarrow`. {{{ | btype '->' ctype {% ams (sLL $1 $> $ HsFunTy $1 $3) [mj AnnRarrow $2] } }}} One potential solution is the keep the annotation where it is, but also add it to `$1`, which will then only be used in tooling for the GADT case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10309#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy -------------------------------------+------------------------------------- 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: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D848 -------------------------------------+------------------------------------- Changes (by alanz): * differential: => Phab:D848 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10309#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy -------------------------------------+------------------------------------- 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: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D848 -------------------------------------+------------------------------------- Changes (by alanz): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10309#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy
-------------------------------------+-------------------------------------
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: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D848
-------------------------------------+-------------------------------------
Comment (by Alan Zimmerman

#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy -------------------------------------+------------------------------------- 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: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D848 -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Merged to `ghc-7.10`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10309#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC