[GHC] #12559: Don't ignore addTopDecls in addModFinalizer

#12559: Don't ignore addTopDecls in addModFinalizer -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Keywords: template- | Operating System: Unknown/Multiple haskell | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #11832 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following program fails to compile because `f` is not found. {{{ -- main.hs import M main = print (f 0) }}} {{{ -- M.hs {-# LANGUAGE TemplateHaskell #-} module M where import Language.Haskell.TH.Syntax g :: IO () g = $(do addModFinalizer (do d <- [d| f x = (2 :: Int) |]; addTopDecls d) [| return ()|] ) }}} {{{ $ runghc main.hs main.hs:3:15: Not in scope: ‘f’ }}} This bug is problematic to produce top-level declarations which depend on the output of `reify` for local variables, which can only run in `addModFinalizer`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12559 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12559: Don't ignore addTopDecls in addModFinalizer -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: patch Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: template- | haskell Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11832 | Differential Rev(s): Phab:D2505 Wiki Page: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * status: new => patch * differential: => Phab:D2505 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12559#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12559: Don't ignore addTopDecls in module finalizers -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: patch Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: template- | haskell Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11832 | Differential Rev(s): Phab:D2505 Wiki Page: | -------------------------------------+------------------------------------- Description changed by facundo.dominguez: @@ -29,2 +29,2 @@ - the output of `reify` for local variables, which can only run in - `addModFinalizer`. + the output of `reify` for local variables, which can only run in a + finalizer. New description: The following program fails to compile because `f` is not found. {{{ -- main.hs import M main = print (f 0) }}} {{{ -- M.hs {-# LANGUAGE TemplateHaskell #-} module M where import Language.Haskell.TH.Syntax g :: IO () g = $(do addModFinalizer (do d <- [d| f x = (2 :: Int) |]; addTopDecls d) [| return ()|] ) }}} {{{ $ runghc main.hs main.hs:3:15: Not in scope: ‘f’ }}} This bug is problematic to produce top-level declarations which depend on the output of `reify` for local variables, which can only run in a finalizer. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12559#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12559: Don't ignore addTopDecls in module finalizers
-------------------------------------+-------------------------------------
Reporter: | Owner:
facundo.dominguez | facundo.dominguez
Type: bug | Status: patch
Priority: normal | Milestone: 8.0.2
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: template-
| haskell
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #11832 | Differential Rev(s): Phab:D2505
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Facundo Domínguez

#12559: Don't ignore addTopDecls in module finalizers -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | facundo.dominguez Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: template- | haskell Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11832 | Differential Rev(s): Phab:D2505 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: This was merged to `ghc-8.0` as a77bbb8b8c15ef21eab4357248d5d6964c542150. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12559#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC