Api Annotations: RdrHsSyn.mkAtDefault causes annotations to be disconnected.
authorAlan Zimmerman <alan.zimm@gmail.com>
Mon, 11 May 2015 07:34:27 +0000 (09:34 +0200)
committerAlan Zimmerman <alan.zimm@gmail.com>
Mon, 11 May 2015 07:34:27 +0000 (09:34 +0200)
commit811b72adedcd12149783eac19ebccff1dd72bc1c
tree2c9a959649ff7d927ea5602384ccdef6f325d21c
parent5c459eefcb17ff97beebdc08ccfca21bd8fa5201
Api Annotations: RdrHsSyn.mkAtDefault causes annotations to be disconnected.

Summary:
The code for mkAtDefault is as follows.

    mkATDefault (L loc (TyFamInstDecl { tfid_eqn = L _ e }))
          | TyFamEqn { tfe_tycon = tc, tfe_pats = pats, tfe_rhs = rhs } <- e
          = do { tvs <- checkTyVars (ptext (sLit "default")) equalsDots tc (hswb_cts pats)
               ; return (L loc (TyFamEqn { tfe_tycon = tc
                                         , tfe_pats = tvs
                                         , tfe_rhs = rhs })) }

An associated type in a class of the form

    type FoldableConstraint t x = ()

has an AnnEqual attached to the location in tfid_eqn. Since the location
is discarded, this annotation is then disconnected from the AST.

Test Plan: ./validate

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: bgamari, thomie, mpickering

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

GHC Trac Issues: #10307
compiler/parser/Parser.y
testsuite/tests/ghc-api/annotations/.gitignore
testsuite/tests/ghc-api/annotations/Makefile
testsuite/tests/ghc-api/annotations/T10307.stdout [new file with mode: 0644]
testsuite/tests/ghc-api/annotations/Test10307.hs [new file with mode: 0644]
testsuite/tests/ghc-api/annotations/all.T
testsuite/tests/ghc-api/annotations/t10307.hs [new file with mode: 0644]