[GHC] #16260: Use of plugins causes -XSafe to fail

GHC ghc-devs at haskell.org
Thu Jan 31 07:50:57 UTC 2019


#16260: Use of plugins causes -XSafe to fail
-------------------------------------+-------------------------------------
           Reporter:  watashi        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.7
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Use of plugins will mark safe inference as failed, even when the plugin
 does not modify anything. This can result in compile error when -XSafe is
 used. For example:

 {{{
 $ cat DefaultPlugin.hs
 module DefaultPlugin (plugin) where
 import GhcPlugins
 plugin = defaultPlugin

 $ cat B.hs
 {-# OPTIONS_GHC -fplugin DefaultPlugin #-}
 module B (answer) where
 answer = 42

 $ cat A.hs
 {-# LANGUAGE Safe #-}
 module A (main) where
 import B
 main = print answer

 $ ...
 A.hs:4:1: error:
     B: Can't be safely imported! The module itself isn't safe.
 }}}

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


More information about the ghc-tickets mailing list