[GHC] #11809: Template Haskell record splices are not renamer-resolved correctly.

#11809: Template Haskell record splices are not renamer-resolved correctly. -------------------------------------+------------------------------------- Reporter: bollmann | Owner: bollmann Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 8.0.1 Haskell | Keywords: Template | Operating System: Unknown/Multiple Haskell Renamer Records | Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- While working on ticket #8761, I noticed that splicing in record selectors with Template Haskell seems to cause renamer issues in GHC HEAD. Consider the following TH splice: {{{#!hs {- Test splicing in a data type with records -} [d| data D a = MkD { unD :: a } someD = MkD "Hello" getD = unD someD -- unD should resolve to the record selector above! |] getD' = unD someD -- dito here outside of the splice! }}} While GHC 7.10.3 accepts this splice and renames it correctly, GHC HEAD fails with the following error message (with `-ddump-splices` enabled): {{{ [1 of 1] Compiling Error ( Error.hs, Error.o ) Error.hs:(6,1)-(11,3): Splicing declarations [d| someD_apF = MkD_apD "Hello" getD_apG = unD someD_apF data D_apC a_apH = MkD_apD {unD :: a_apH} |] ======> data D_a4SA a_a4SD = MkD_a4SB {unD_a4SC :: a_a4SD} someD_a4Sy = MkD_a4SB "Hello" getD_a4Sz = unD_a4SC someD_a4Sy Error.hs:6:1: error: The exact Name ‘unD_a4SC’ is not in scope Probable cause: you used a unique Template Haskell name (NameU), perhaps via newName, but did not bind it If that's it, then -ddump-splices might be useful }}} I'm not sure as to what introduced this bug, but investigating it I found that the notes - `NOTE [Binders in Template Haskell] in Convert.hs`, and - `NOTE [Looking up Exact RdrNames] in RnEnv.hs` are not respected by function `newRecordSelector` in `rename/RnNames.hs`. I've fixed this function accordingly in Phab:D1940 for #8761, but since that patch is not going to be part of 8.0.1, Richard suggested to fix it separately in this ticket. I'm submitting a patch in due course. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11809 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11809: Template Haskell record splices are not renamer-resolved correctly. -------------------------------------+------------------------------------- Reporter: bollmann | Owner: bollmann Type: bug | Status: patch Priority: normal | Milestone: Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: Template | Haskell Renamer Records Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2091 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bollmann): * status: new => patch * differential: => Phab:D2091 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11809#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11809: Template Haskell record splices are not renamer-resolved correctly. -------------------------------------+------------------------------------- Reporter: bollmann | Owner: bollmann Type: bug | Status: merge Priority: normal | Milestone: Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: Template | Haskell Renamer Records Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2091 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11809#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11809: Template Haskell record splices are not renamer-resolved correctly. -------------------------------------+------------------------------------- Reporter: bollmann | Owner: bollmann Type: bug | Status: merge Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: Template | Haskell Renamer Records Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2091 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11809#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11809: Template Haskell record splices are not renamer-resolved correctly.
-------------------------------------+-------------------------------------
Reporter: bollmann | Owner: bollmann
Type: bug | Status: merge
Priority: normal | Milestone: 8.0.1
Component: Template Haskell | Version: 8.0.1
Resolution: | Keywords: Template
| Haskell Renamer Records
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2091
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11809: Template Haskell record splices are not renamer-resolved correctly. -------------------------------------+------------------------------------- Reporter: bollmann | Owner: bollmann Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 8.0.1 Resolution: fixed | Keywords: Template | Haskell Renamer Records Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2091 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as e4650932ce18e04a24aba2c8de71fe19d691f5fe. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11809#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC