[GHC] #14772: Keep Role Annotations in the renamed syntax tree
GHC
ghc-devs at haskell.org
Wed Feb 7 01:36:45 UTC 2018
#14772: Keep Role Annotations in the renamed syntax tree
-------------------------------------+-------------------------------------
Reporter: lazac | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
(Type checker) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Currently role annotations are present in the parsed representation, but
missing from the renamed version of the syntax tree. GHC should keep them
instead. I found no evidence that this would be intended, we even have
`rnRoleAnnots` that should return the renamed annotations.
Keeping role annotations would help tooling to be consistent. For example,
renaming the datatype should also rename its occurrence in the role
annotation.
Minimal example:
A.hs
{{{#!hs
module A where
import B
data A x = A B
}}}
B.hs
{{{#!hs
module B where
import {-# SOURCE #-} A
data B = B (A ())
}}}
A.hs-boot
{{{#!hs
{-# LANGUAGE RoleAnnotations #-}
module A where
type role A phantom -- the role annotation is needed here
data A x
}}}
When inspecting the representation using the GHC API, the role is present
in the parsed representation:
{{{
module A where -- Parsed module
type role A phantom
data A x
}}}
But missing from the renamed one:
{{{
(data A x, [import (implicit) Prelude], Nothing, Nothing) -- RenamedSource
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14772>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list