[GHC] #14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType -------------------------------------+------------------------------------- Reporter: Toricon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Windows Architecture: x86_64 | Type of failure: Compile-time (amd64) | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- ghc.exe: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-mingw32): isInjectiveTyCon sees a TcTyCon KLN {{{#!hs {-# LANGUAGE RankNTypes, GADTs, TypeOperators, PolyKinds, DataKinds, TypeFamilies, AllowAmbiguousTypes, UndecidableInstances, TypeInType #-} module MCS.Function where import MCS.Core --import MCS.Value import Data.Kind -- necessary for * type family KLN (n :: k) :: Nat where KLN (f :: v -> k) = S (KLN (forall t. f t)) KLN (f :: *) = Z type family Reveal (n :: k) (l :: Vect (KLN n) L) :: * where Reveal (f :: v -> k) (Cons (Label (t :: v)) l) = Reveal (f t) l Reveal (a :: *) Nil = a }}} The problem *has* to be somewhere in the KLN / Reveal interaction, so I removed everything else for this. Every other weird area is commented out or unused, and the bug vanished when KLN / Reveal was commented out. KLN shouldn't even work. If it _could_ be interaction with the rest of the document, I'll put that back in. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14246 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType -------------------------------------+------------------------------------- Reporter: Toricon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13271 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #13271 Comment: I don't know what `MCS.Core` is, so I have no way to test this code. That being said, this error message is identical to that of #13271, which has been fixed as of GHC 8.2.1. Can you test your code on 8.2.1 and see if you still experience the same error? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14246#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType -------------------------------------+------------------------------------- Reporter: Toricon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13271 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * os: Windows => Unknown/Multiple -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14246#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType -------------------------------------+------------------------------------- Reporter: Toricon | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13271 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => infoneeded -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14246#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType -------------------------------------+------------------------------------- Reporter: Toricon | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13271 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * cc: Iceland_jack (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14246#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType -------------------------------------+------------------------------------- Reporter: Toricon | Owner: (none) Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13271 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I was able to reverse engineer this. Here is a program which panics on GHC 8.0.2: {{{#!hs {-# LANGUAGE RankNTypes, GADTs, TypeOperators, PolyKinds, DataKinds, TypeFamilies, AllowAmbiguousTypes, UndecidableInstances, TypeInType #-} module MCS.Function where -- import MCS.Core --import MCS.Value import Data.Kind -- necessary for * data Nat = Z | S Nat data Vect :: Nat -> Type -> Type where Nil :: Vect Z a Cons :: a -> Vect n a -> Vect (S n) a data Label a = Label a data L type family KLN (n :: k) :: Nat where KLN (f :: v -> k) = S (KLN (forall t. f t)) KLN (f :: *) = Z type family Reveal (n :: k) (l :: Vect (KLN n) L) :: * where Reveal (f :: v -> k) (Cons (Label (t :: v)) l) = Reveal (f t) l Reveal (a :: *) Nil = a }}} {{{ $ /opt/ghc/8.0.2/bin/ghc Bug.hs [1 of 1] Compiling MCS.Function ( Bug.hs, Bug.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): isInjectiveTyCon sees a TcTyCon KLN }}} However, this does //not// panic on GHC 8.2.2 and later, so I believe that this has a symptom in common with #13271. It's different enough that it warrants its own test case, I believe, so I'll commit that shortly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14246#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType
-------------------------------------+-------------------------------------
Reporter: Toricon | Owner: (none)
Type: bug | Status: infoneeded
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: x86_64
Type of failure: Compile-time | (amd64)
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: #13271 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType -------------------------------------+------------------------------------- Reporter: Toricon | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 | (amd64) Type of failure: Compile-time | Test Case: indexed- crash or panic | types/should_fail/T14246 Blocked By: | Blocking: Related Tickets: #13271 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: infoneeded => closed * testcase: => indexed-types/should_fail/T14246 * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14246#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC