Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests don't build with GHCJS 8.4 #53

Closed
ElvishJerricco opened this issue Jul 16, 2018 · 5 comments
Closed

Tests don't build with GHCJS 8.4 #53

ElvishJerricco opened this issue Jul 16, 2018 · 5 comments

Comments

@ElvishJerricco
Copy link

Full log: https://gist.github.com/ElvishJerricco/c3c649de21c10942b7439d0cc63dd5ff

I would not be surprised if this were a GHCJS bug. @luite, you might want to take a look.

@RyanGlScott
Copy link
Collaborator

I also suspect that this is a GHCJS bug, since I am unable to reproduce the issue when using the cabal flags presented in that log (excluding the Nix/GHCJS-specific ones).

@angerman
Copy link

angerman commented Aug 6, 2018

I'm getting something very similar:

test/Main.hs:332:5: error:
    • The exact Name ‘MkT43Plain_ah7K’ 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
    • In the untyped splice:
        $(do [decPlain] <- [d| data T43Plain
                                 where MkT43Plain :: T43Plain |]
             infoPlain <- normalizeDec decPlain
             validateDI
               infoPlain
               DatatypeInfo
                 {datatypeName = mkName "T43Plain", datatypeContext = [],
                  datatypeVars = [], datatypeVariant = Datatype,
                  datatypeCons = [ConstructorInfo
                                    {constructorName = mkName "MkT43Plain", constructorVars = [],
                                     constructorContext = [], constructorFields = [],
                                     constructorStrictness = [],
                                     constructorVariant = NormalConstructor}]}
             [decFam] <- [d| data instance T43Fam where MkT43Fam :: T43Fam |]
             ....)
    |
332 |   $(do [decPlain] <- [d| data T43Plain where MkT43Plain :: T43Plain |]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

test/Main.hs:332:5: error:
    • The exact Name ‘MkT43Plain_ah7K’ 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
    • In the untyped splice:
        $(do [decPlain] <- [d| data T43Plain
                                 where MkT43Plain :: T43Plain |]
             infoPlain <- normalizeDec decPlain
             validateDI
               infoPlain
               DatatypeInfo
                 {datatypeName = mkName "T43Plain", datatypeContext = [],
                  datatypeVars = [], datatypeVariant = Datatype,
                  datatypeCons = [ConstructorInfo
                                    {constructorName = mkName "MkT43Plain", constructorVars = [],
                                     constructorContext = [], constructorFields = [],
                                     constructorStrictness = [],
                                     constructorVariant = NormalConstructor}]}
             [decFam] <- [d| data instance T43Fam where MkT43Fam :: T43Fam |]
             ....)
    |
332 |   $(do [decPlain] <- [d| data T43Plain where MkT43Plain :: T43Plain |]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

test/Main.hs:332:5: error:
    • The exact Name ‘MkT43Fam_ah7L’ 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
    • In the untyped splice:
        $(do [decPlain] <- [d| data T43Plain
                                 where MkT43Plain :: T43Plain |]
             infoPlain <- normalizeDec decPlain
             validateDI
               infoPlain
               DatatypeInfo
                 {datatypeName = mkName "T43Plain", datatypeContext = [],
                  datatypeVars = [], datatypeVariant = Datatype,
                  datatypeCons = [ConstructorInfo
                                    {constructorName = mkName "MkT43Plain", constructorVars = [],
                                     constructorContext = [], constructorFields = [],
                                     constructorStrictness = [],
                                     constructorVariant = NormalConstructor}]}
             [decFam] <- [d| data instance T43Fam where MkT43Fam :: T43Fam |]
             ....)
    |
332 |   $(do [decPlain] <- [d| data T43Plain where MkT43Plain :: T43Plain |]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

test/Main.hs:332:5: error:
    • The exact Name ‘MkT43Fam_ah7L’ 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
    • In the untyped splice:
        $(do [decPlain] <- [d| data T43Plain
                                 where MkT43Plain :: T43Plain |]
             infoPlain <- normalizeDec decPlain
             validateDI
               infoPlain
               DatatypeInfo
                 {datatypeName = mkName "T43Plain", datatypeContext = [],
                  datatypeVars = [], datatypeVariant = Datatype,
                  datatypeCons = [ConstructorInfo
                                    {constructorName = mkName "MkT43Plain", constructorVars = [],
                                     constructorContext = [], constructorFields = [],
                                     constructorStrictness = [],
                                     constructorVariant = NormalConstructor}]}
             [decFam] <- [d| data instance T43Fam where MkT43Fam :: T43Fam |]
             ....)
    |
332 |   $(do [decPlain] <- [d| data T43Plain where MkT43Plain :: T43Plain |]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
[iserv-proxy] Proxy done
builder for '/nix/store/m1kq4jy3lr0jg71c12ssrm0rla6663hf-th-abstraction-0.2.8.0-x86_64-pc-mingw32.drv' failed with exit code 1

This is not GHCJS though. This is using ghc-8.4.3 + -fexternal-interpreter. That however is pretty close to how GHCJS does TH.

@RyanGlScott you might be able to reproduce this by simply building the package with -fexternal-interpreter passed to ghc.

@RyanGlScott
Copy link
Collaborator

Thanks @angerman, -fexternal-interpreter was indeed sufficient to trigger this bug. I've reduced the issue to the following minimal example:

{-# LANGUAGE TemplateHaskell #-}
module Bug where

import Language.Haskell.TH

main :: IO ()
main = putStrLn $(recover (stringE "reifyFixity failed")
                          (do foo <- newName "foo"
                              _ <- reifyFixity foo
                              stringE "reifyFixity successful"))
$ /opt/ghc/8.4.3/bin/ghc Bug.hs -fforce-recomp
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )
$ /opt/ghc/8.4.3/bin/ghc Bug.hs -fforce-recomp -fexternal-interpreter
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:7:19: error:
    • The exact Name ‘foo_a3MT’ 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
    • In the untyped splice:
        $(recover
            (stringE "reifyFixity failed")
            (do foo <- newName "foo"
                _ <- reifyFixity foo
                stringE "reifyFixity successful"))
  |
7 | main = putStrLn $(recover (stringE "reifyFixity failed")
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

Bug.hs:7:19: error:
    • The exact Name ‘foo_a3MT’ 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
    • In the untyped splice:
        $(recover
            (stringE "reifyFixity failed")
            (do foo <- newName "foo"
                _ <- reifyFixity foo
                stringE "reifyFixity successful"))
  |
7 | main = putStrLn $(recover (stringE "reifyFixity failed")
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

I've opened GHC Trac #15481 for this.

@ElvishJerricco
Copy link
Author

Should we close this issue now, seeing as this is a GHC issue, not a th-abstraction issue?

@RyanGlScott
Copy link
Collaborator

That sounds reasonable to me.

matthewbauer added a commit to matthewbauer/reflex-platform that referenced this issue May 31, 2019
Adds a fix for a bad th issue seen in the wild in:

- goldfirere/th-desugar#119
- glguy/th-abstraction#53

Upstream pr: ghcjs/ghcjs#753
matthewbauer added a commit to matthewbauer/reflex-platform that referenced this issue May 31, 2019
Adds a fix for a bad th issue seen in the wild in:

- goldfirere/th-desugar#119
- glguy/th-abstraction#53

Upstream pr: ghcjs/ghcjs#753
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants