Add a broken test for lingering state from TH unique names #9693
ClosedPublic

Authored by mgsloan on Jul 2 2018, 9:13 PM.

Details

Summary

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

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mgsloan created this revision.Jul 2 2018, 9:13 PM
mgsloan updated this revision to Diff 17161.Jul 2 2018, 9:15 PM

Update commit message

mgsloan retitled this revision from Add a broken test for #9693 to Add a broken test for lingering state from TH unique names #9693.Jul 2 2018, 9:16 PM
sighingnow requested changes to this revision.Jul 2 2018, 9:45 PM
sighingnow added a subscriber: sighingnow.

Let's add two separate test cases, T9693a for newName and T9693b for mkName, rather than doing so complex logic in T9693.script.

This revision now requires changes to proceed.Jul 2 2018, 9:45 PM
mgsloan added a comment.EditedJul 2 2018, 9:47 PM

@sighingnow Thanks for reviewing. Please take a look at https://ghc.haskell.org/trac/ghc/ticket/9693 . Reproducing this problem requires modifying the code and reloading into ghci. Note that the symptoms no longer involves panic-ing. However, the reload of modified code behaves differently than a fresh load.

I see. Thanks for the clarification. Besides, seems that the th-parse-notes.md was added unintentionally.

mgsloan updated this revision to Diff 17164.Jul 3 2018, 1:06 AM

Remove unintentionally added file "th-parse-notes.md"

@sighingnow Ah, good catch! Not sure how that snuck in there. Some notes while I was poking around the code trying to figure out how to easily add some functions like parseExp :: String -> Q Exp :)

RyanGlScott accepted this revision.Jul 3 2018, 4:01 AM
RyanGlScott added a subscriber: RyanGlScott.

LGTM, assuming it validates.

sighingnow accepted this revision.Jul 3 2018, 6:56 AM
This revision is now accepted and ready to land.Jul 3 2018, 6:56 AM
This revision was automatically updated to reflect the committed changes.