Opened 4 years ago

Closed 4 years ago

#10307 closed bug (fixed)

Api Annotations: RdrHsSyn.mkAtDefault causes annotations to be disconnected.

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: Differential Rev(s): Phab:D842
Wiki Page:

Description

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.

Change History (4)

comment:1 Changed 4 years ago by alanz

Differential Rev(s): Phab:D842

comment:2 Changed 4 years ago by alanz

Status: newpatch

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

In 811b72adedcd12149783eac19ebccff1dd72bc1c/ghc:

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

comment:4 Changed 4 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

Merged to ghc-7.10.

Note: See TracTickets for help on using tickets.