parser : the API annotation on opt_sig is being discarded
authorAlan Zimmerman <alan.zimm@gmail.com>
Tue, 14 Apr 2015 06:17:58 +0000 (01:17 -0500)
committerAustin Seipp <austin@well-typed.com>
Tue, 14 Apr 2015 06:20:06 +0000 (01:20 -0500)
commit919b51174163907d2bc3bb41aadf56aa8bb42e9b
tree1c905ca6cd84cda9ff99ce26bf7c5dd385e2d35c
parent9eab6feed44ad8beb6703d2e27ce47a8f79d0f49
parser : the API annotation on opt_sig is being discarded

The opt_sig production is defined as

  opt_sig :: { ([AddAnn],Maybe (LHsType RdrName)) }
          : {- empty -}                   { ([],Nothing) }
          | '::' sigtype                  { ([mj AnnDcolon $1],Just $2) }

It is used in the alt and decl_no_th productions, but neither of them
add the returned annotations.

This commit captures the annotations in the calling productions.

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D822

GHC Trac Issues: #10254
compiler/parser/Parser.y
testsuite/tests/ghc-api/annotations/AnnotationTuple.hs
testsuite/tests/ghc-api/annotations/exampleTest.stdout
testsuite/tests/ghc-api/annotations/parseTree.stdout