#7525: Compiler panic with ill-typed code using implicit parameters
-------------------------------+--------------------------------------------
Reporter:  parcs               |          Owner:                  
    Type:  bug                 |         Status:  new             
Priority:  normal              |      Component:  Compiler        
 Version:  7.7                 |       Keywords:                  
      Os:  Unknown/Multiple    |   Architecture:  Unknown/Multiple
 Failure:  Compile-time crash  |      Blockedby:                  
Blocking:                      |        Related:                  
-------------------------------+--------------------------------------------
 The following snippet produces a compiler panic with GHC 7.7.20121221:

 {{{
 {-# LANGUAGE ImplicitParams #-}

 hmm :: ()
 hmm = let ?a = True in ?a

 main = print hmm
 }}}

 Which results in the error message:

 {{{
 [1 of 1] Compiling Main             ( bug.hs, bug.o )
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 7.7.20121221 for x86_64-unknown-linux):
         ASSERT failed!
     file compiler/typecheck/TcMType.lhs line 407
     Double update of meta tyvar
       t_ajp{tv} [tau[0]]
       Indirect ghc-prim:GHC.Types.Bool{(w) tc 3c}

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

 Note that the same snippet compiled with GHC 7.6.1 doesn't panic, and
 instead gives a type error:

 {{{
 [1 of 1] Compiling Main             ( bug.hs, bug.o )

 bug.hs:4:24:
     Couldn't match type `Bool' with `()'
     When using functional dependencies to combine
       ?a::Bool,
         arising from the implicit-parameter bindings for ?a
         at bug.hs:4:7-25
       ?a::(),
         arising from a use of implicit parameter `?a' at bug.hs:4:24-25
     In the expression: ?a
     In the expression: let ?a = True in ?a
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to