[GHC] #11681: ghc panic with TypeError

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When playing around with `TypeError` I got a ghc panic with the following code: {{{#!hs {-# LANGUAGE DataKinds, FlexibleContexts, TypeOperators, FlexibleInstances, UndecidableInstances #-} import GHC.TypeLits class C t where instance (TypeError (Text "A" :<>: {- Text -} "B")) => C t where main :: IO () main = return () }}} Compiling this results in {{{ ghc: panic! (the 'impossible' happened) (GHC version 8.0.0.20160204 for x86_64-unknown-linux): fvProv falls into a hole {a1bh} }}} Commenting "in" the second `Text` removes the panic. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * failure: None/Unknown => Compile-time crash * version: 7.10.3 => 8.0.1-rc2 * component: Compiler => Compiler (Type checker) * milestone: => 8.0.1 Comment: What GHC version were you attempting to compile with? I don't believe it could have been 7.10.3 given that `TypeError` was only introduced in 8.0.1. Unfortunately, I'm having trouble reproducing this with any of the 8.0.1 release candidates. In all cases I get, {{{#!hs $ ghc Test.hs [1 of 1] Compiling Main ( Test.hs, Test.o ) Test.hs:8:42: error: • Expected kind ‘ErrorMessage’, but ‘"B"’ has kind ‘Symbol’ • In the second argument of ‘:<>:’, namely ‘"B"’ In the first argument of ‘TypeError’, namely ‘Text "A" :<>: "B"’ In the instance declaration for ‘C t’ }}} which appears to be the correct error. There have been a number of similar tickets which have been recently closed (e.g. #11563) with, [changeset:"b565830dda0994d5d67617039db3310f81e831c8/ghc" b565830d/ghc]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): Sorry, I forgot to change the version field! I am testing with the latest ghc version available in fedora, it is tagged as `8.0.0.20160204` (so around one month old version, seems like). If it doesn't happen with the release candidates it is probably safe to assume that it got fixed in the meantime. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Ahh, yes, I should have noticed that in the GHC output in your description. That is -rc2. I am quite confused in that case as I can't seem to reproduce this with -rc2. Very perplexing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): Replying to [comment:3 bgamari]:
Ahh, yes, I should have noticed that in the GHC output in your description. That is -rc2.
I am quite confused in that case as I can't seem to reproduce this with -rc2. Very perplexing. Weird. I will keep an eye on this then, as soon as there is a new version available in fedora I will check and report whether it works or not.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by aavogt): I can't reproduce the original problem with -rc2 either, but I get the original error message with this file: {{{#!hs {-# LANGUAGE FlexibleInstances #-} class C x where m :: x () class B x instance B x => C x }}} {{{ ghc: panic! (the 'impossible' happened) (GHC version 8.0.0.20160204 for x86_64-unknown-linux): fvProv falls into a hole {a1eE} }}} Interestingly the kind error is in there if we're missing FlexibleInstances {{{ kind_error_fvprov.hs:12:17: error: ? Illegal instance declaration for ?C x? (All instance types must be of the form (T a1 ... an) where a1 ... an are *distinct type variables*, and each type variable appears at most once in the instance head. Use FlexibleInstances if you want to disable this.) ? In the instance declaration for ?C x? kind_error_fvprov.hs:12:19: error: ? Expected kind ?* -> *?, but ?x? has kind ?*? ? In the first argument of ?C?, namely ?x? In the instance declaration for ?C x? }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

I can't reproduce the original problem with -rc2 either This is very bizarre: I just updated to the latest build in fedora (which still identifies itself with the same version) and couldn't reproduce the crash either. But the example by aavogt above also crashes for me. And
#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): Replying to [comment:5 aavogt]: playing around with my original example, the following **does** crash: {{{#!hs {-# LANGUAGE DataKinds, FlexibleContexts, TypeOperators, FlexibleInstances #-} import GHC.TypeLits class C t where instance (TypeError (Text "A" :<>: {- Text -} "B")) => C t where main :: IO () main = return () }}} Notice the absence of the `UndecidableInstances` extension, the content is otherwise identical. It is not impossible I made a mistake when copying the original example for the crash, apologies if this was the case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I dunno about RC2, but HEAD says (on the program in in comment:6): {{{ T11681.hs:11:42: error: • Expected kind ‘ErrorMessage’, but ‘"B"’ has kind ‘Symbol’ • In the second argument of ‘:<>:’, namely ‘"B"’ In the first argument of ‘TypeError’, namely ‘Text "A" :<>: "B"’ In the instance declaration for ‘C t’ }}} which seems pretty plausible. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11681: ghc panic with TypeError -------------------------------------+------------------------------------- Reporter: inaki | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: I observe the same error as simonpj describes in comment:7 on the `ghc-8.0` branch. I'm fairly confident that this is fixed; if you find that it is still reproducible with the next release candidate (which will likely come in the next week or so) feel free to re-open this ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11681#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC