[GHC] #14627: qAddTopDecls: can't convert top-level declarations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
           Reporter:  tianxiaogu     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.2
           Keywords:                 |  Operating System:  Linux
       Architecture:  x86_64         |   Type of failure:  Compile-time
  (amd64)                            |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The following program crashes 8.2.2 and HEAD (8.5.20171228).
 {{{#!hs
 {-# LANGUAGE TemplateHaskell #-}
 import           Language.Haskell.TH.Syntax         (addTopDecls)
 $(do
     ds <- [d| f = Bool
             |]
     addTopDecls ds
     [d| g = cab
       |])
 }}}
 Output:
 {{{
     Exception when trying to run compile-time code:
       ghc: panic! (the 'impossible' happened)
   (GHC version 8.5.20171228 for x86_64-unknown-linux):
         qAddTopDecls: can't convert top-level declarations

 Illegal variable name: ‘Bool’
 When splicing a TH declaration: f_0 = Bool
 Call stack:
     CallStack (from HasCallStack):
       callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in
 ghc:Outputable
       pprPanic, called at compiler/typecheck/TcSplice.hs:886:27 in
 ghc:TcSplice

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * os:  Linux => Unknown/Multiple
 * component:  Compiler => Template Haskell
 * architecture:  x86_64 (amd64) => Unknown/Multiple


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mgsloan):

 * owner:  (none) => mgsloan


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mgsloan):

 I've put up a patch that makes addTopDelcs no longer panic for conversion
 errors: https://phabricator.haskell.org/D4914 .  Instead they are reported
 as normal errors like this:


 {{{
 T14627.hs:3:3: error:
     qAddTopDecls: can't convert declarations:
       Illegal variable name: ‘Bool’
       When splicing a TH declaration: f_0 = Bool
   |
 3 | $(do
   |   ^^...
 }}}

 Atop this, the error "Illegal variable name: 'Bool'" is quite poor,
 instead it should just say there's an out of scope constructor.  I have a
 patch that fixes this and adds documentation to `UnboundVarE` clarifying
 this case.  Can't push it to phabricator yet, though, because it appears
 to be down.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4914
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by goldfire):

 * differential:   => Phab:D4914


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4914
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mgsloan):

 In addition to D4914, which changes this from panic-ing to just a regular
 error, I've also published https://phabricator.haskell.org/D4923 which
 improves the error for this specific case.  Instead it says "Data
 constructor not in scope: Bool"

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4914
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mgsloan):

 * status:  new => patch
 * cc: th/T14627 (added)


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:  th/T14627
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4914
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mgsloan):

 * cc: th/T14627 (removed)
 * testcase:   => th/T14627


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:  th/T14627
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4914
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"0f79b0ef140e086a48d1aa5b945ad5a3754ccdd1/ghc" 0f79b0e/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="0f79b0ef140e086a48d1aa5b945ad5a3754ccdd1"
 Fix handling of unbound constructor names in TH #14627

 Also adds a comment to UnboundVarE clarifying that it also is used for
 unbound constructor identifiers, since that isn't very clear from the
 name.

 Test Plan: testsuite/tests/th/T14627.hs

 Reviewers: goldfire, bgamari

 Reviewed By: goldfire

 Subscribers: rwbarton, thomie, carter

 Differential Revision: https://phabricator.haskell.org/D4923
 }}}

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:  th/T14627
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4914
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * status:  patch => closed
 * resolution:   => fixed
 * milestone:   => 8.6.1


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #14627: qAddTopDecls: can't convert top-level declarations

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#14627: qAddTopDecls: can't convert top-level declarations
-------------------------------------+-------------------------------------
        Reporter:  tianxiaogu        |                Owner:  mgsloan
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:  th/T14627
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4914
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * milestone:  8.6.1 => 8.8.1


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets