Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10363 closed bug (duplicate)

ApiAnnotations : HsForAllTy discards parens

Reported by: alanz Owned by: alanz
Priority: normal Milestone: 7.10.2
Component: Compiler Version: 7.10.1
Keywords: ApiAnnotations Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #10315,#10354,#10278 Differential Rev(s): Phab:D836
Wiki Page:


The annotations for the following code

pTokenCostStr :: forall a .((Show a) => [a] -> Int -> String)

have detached annotations for the parens around (Show a)... String.

Change History (3)

comment:1 Changed 5 years ago by alanz

Differential Rev(s): Phab:D836

comment:2 Changed 5 years ago by alanz

Resolution: duplicate
Status: newclosed

comment:3 Changed 5 years ago by Alan Zimmerman <alan.zimm@…>

In c553e980e4a5d149af13bb705ec02819a15937ee/ghc:

ApiAnnotations : AST version of nested forall loses forall annotation

When parsing

    {-# LANGUAGE ScopedTypeVariables #-}

    extremumNewton :: forall tag. forall tag1.
                       tag -> tag1 -> Int
    extremumNewton = undefined

the parser creates nested HsForAllTy's for the two forall statements.

These get flattened into a single one in `HsTypes.mk_forall_ty`

This patch removes the flattening, so that API Annotations are not lost in the

Test Plan: ./validate

Reviewers: goldfire, austin, simonpj

Reviewed By: simonpj

Subscribers: bgamari, mpickering, thomie, goldfire

Differential Revision:

GHC Trac Issues: #10278, #10315, #10354, #10363
Note: See TracTickets for help on using tickets.