1. 06 Jul, 2018 1 commit
    • Michael Sloan's avatar
      Add a broken test for lingering state from TH unique names #9693 · fbe162f5
      Michael Sloan authored
      The stderr output is
      
      ```
      Loading with T9693_initial.hs
      
      T9693_main.hs:4:1:
          Same exact name in multiple name-spaces:
            type constructor or class ‘X’, declared at: T9693_main.hs:4:1
            data constructor ‘X’, declared at: T9693_main.hs:4:1
            Probable cause: you bound a unique Template Haskell name (NameU),
            perhaps via newName, in different name-spaces.
            If that's it, then -ddump-splices might be useful
      Reloading with T9693_modified.hs
      
      T9693_main.hs:1:1:
          Data constructor ‘X’ used as a type constructor
      ```
      
      The strange thing is that the modified version uses (mkName "X"), which should
      be fine for simultaneous use in both a data constructor and type constructor.
      Indeed, on a fresh load, the modified version works fine. So there is some sort
      of state left over from the prior load when (newName "X") was used.
      
      Test Plan: testsuite/tests/th/T9693.script
      
      Reviewers: bgamari, sighingnow, RyanGlScott
      
      Reviewed By: sighingnow, RyanGlScott
      
      Subscribers: RyanGlScott, sighingnow, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4926
      fbe162f5
  2. 20 May, 2017 1 commit
    • Douglas Wilson's avatar
      Compile modules that are needed by template haskell, even with -fno-code. · 53c78be0
      Douglas Wilson authored
      This patch relates to Trac #8025
      
      The goal here is to enable typechecking of packages that contain some
      template haskell. Prior to this patch, compilation of a package with
      -fno-code would fail if any functions in the package were called from
      within a splice.
      
      downsweep is changed to do an additional pass over the modules,
      targetting any ModSummaries transitively depended on by a module that
      has LangExt.TemplateHaskell enabled. Those targeted modules have
      hscTarget changed from HscNothing to the default target of the platform.
      
      There is a small change to the prevailing_target logic to enable this.
      
      A simple test is added.
      
      I have benchmarked with and without a patched haddock
      (available:https://github.com/duog/haddock/tree/wip-no-explicit-th-compi
      lation).  Running cabal haddock on the wreq package results in a 25%
      speedup on my machine:
      
      time output from patched cabal haddock:
      
      real    0m5.780s
      user    0m5.304s
      sys     0m0.496s
      time output from unpatched cabal haddock:
      
      real    0m7.712s
      user    0m6.888s
      sys     0m0.736s
      
      Reviewers: austin, bgamari, ezyang
      
      Reviewed By: bgamari
      
      Subscribers: bgamari, DanielG, rwbarton, thomie
      
      GHC Trac Issues: #8025
      
      Differential Revision: https://phabricator.haskell.org/D3441
      53c78be0
  3. 20 Jul, 2011 2 commits