[GHC] #16189: ParsedSource (especially module name source span) not available from Source Plugin

GHC ghc-devs at haskell.org
Wed Jan 16 08:14:33 UTC 2019


#16189: ParsedSource (especially module name source span) not available from Source
Plugin
-------------------------------------+-------------------------------------
           Reporter:  literon        |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  low            |         Milestone:
          Component:  GHC API        |           Version:  8.6.1
           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:
-------------------------------------+-------------------------------------
 As discovered in https://github.com/google/haskell-
 indexer/pull/89#discussion_r248081268, the `TcGblEnv` received by a Source
 Plugin doesn't seem to have a way of accessing the SrcSpan of the module
 name.

 When having access to the ParsedModule, it contains ParsedSource, which is
 `Located (HsModule GhcPs)`, whose inner datatype contains `Maybe (Located
 ModuleName)`, with the location's span pointing to the module name span.

 From `TcGblEnv` one can access the `ModSummary`, which has a `Maybe
 HsParsedModule`, but seems to be `Nothing` practically.

 I know this is a minor nit, but all other declarations are accessible by
 the source plugin so far, just this bit seems missing. Without this,
 haskell-indexer has to resort to source-code heuristics to get the module
 name span.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16189>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list