[GHC] #9066: Template Haskell cannot splice an infix declaration for a data constructor
GHC
ghc-devs at haskell.org
Sun Nov 2 19:33:35 UTC 2014
#9066: Template Haskell cannot splice an infix declaration for a data constructor
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone:
Component: Template | Version: 7.8.2
Haskell | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by goldfire):
Harrumph. In that second case, {{{[d| infix 5 `Foo` |]}}} produces an
`Exact` `RdrName` for `Foo` that names a ''data'' constructor, not a
''type'' constructor, even when only the type constructor is in scope.
Then, according to `Note [dataTcOccs and Exact Names]` in !RnEnv, the
`Exact` `RdrName`s are trusted to have the right namespace and, so a naive
fix for this bug fails the `Foo` case.
There are two possible ways forward that I see:
1. Don't trust `Exact` `RdrName`s in `dataTcOccs`. That is, when we have
an `Exact` constructor name, also look for the type with same spelling.
2. Duplicate the `dataTcOccs` logic in !DsMeta.
I favor (2), because code that consumes the TH AST will want the
`TH.Name`s to have the right namespaces. It's really a bug that the fixity
declaration above refers to a data constructor `Foo`.
Going to implement (2).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9066#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list