[GHC] #12158: ghc: panic! (the 'impossible' happened) translateConPatVec: lookup

GHC ghc-devs at haskell.org
Thu Jun 9 01:31:50 UTC 2016


#12158: ghc: panic! (the 'impossible' happened)  translateConPatVec: lookup
-------------------------------------+-------------------------------------
        Reporter:  wozgonon          |                Owner:  gkaracha
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Windows           |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  crash                              |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by gkaracha):

 Actually, the more I look at it, there is something wrong with the
 example:
 {{{
 Prelude> data Stock = Stock {name :: String, ric :: String, price ::
 Float}
 Prelude> price Stock{name=name,ric=ric,price=price} = price
 }}}
 One should not even be allowed to define function `price` because it
 overlaps with the record field with the same name, so this must fail much
 earlier than desugaring (where the checker lives). Indeed, when I put the
 example in a file and load it I get:
 {{{
 T12158.hs:7:1: error:
     Multiple declarations of ‘price’
     Declared at: T12158.hs:5:53
                  T12158.hs:7:1
 }}}
 which is correct. The only way to make this crash is if I type these two
 in ghci, which means that there is another bug (ghci accepting the program
 is the bug, it should fail during renaming).

 Additionally, the checker is perfectly happy with this:
 {{{
 Prelude> data Stock = Stock {name :: String, ric :: String, price ::
 Float}
 Prelude> price2 Stock{name=name,ric=ric,price=price} = price
 }}}

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


More information about the ghc-tickets mailing list