[GHC] #15428: GHC 8.6+ panics (piResultTys2), older GHCs don't

#15428: GHC 8.6+ panics (piResultTys2), older GHCs don't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Keywords: TypeInType, | Operating System: Unknown/Multiple TypeFamilies | Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following program panics when compiled with GHC 8.6.1 or HEAD: {{{#!hs {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} module Bug where import Data.Kind import Data.Proxy import Data.Type.Equality type family Flurmp :: k type family Pure (x :: a) :: f a wat :: forall (f :: Type -> Type) (p :: Type). Proxy (f p) -> () wat _ = let s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p) s = undefined in () }}} {{{ $ /opt/ghc/8.6.1/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.6.0.20180714 for x86_64-unknown-linux): piResultTys2 f_aAT a_aAU [(->) p_a1uI[sk:1], p_a1uI[sk:1] -> p_a1uI[sk:1], Flurmp, Flurmp] [Flurmp] Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable pprPanic, called at compiler/types/Type.hs:1041:9 in ghc:Type }}} On GHC 8.4 and earlier, this simply gives an error message: {{{ $ /opt/ghc/8.4.3/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:18:16: error: • Expecting one more argument to ‘Pure (Flurmp :: p -> p)’ Expected kind ‘p -> f p’, but ‘Pure (Flurmp :: p -> p)’ has kind ‘p -> p -> p’ • In the second argument of ‘(:~:)’, namely ‘Pure (Flurmp :: p -> p) (Flurmp :: p)’ In the type signature: s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p) In the expression: let s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p) s = undefined in () • Relevant bindings include wat :: Proxy (f p) -> () (bound at Bug.hs:16:1) | 18 | :~: Pure (Flurmp :: p -> p) (Flurmp :: p) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15428 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15428: GHC 8.6+ panics (piResultTys2), older GHCs don't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: TypeInType, | TypeFamilies 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 monoidal): Simpler version, also panicks 8.4: {{{ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeInType #-} module Bug where data Flurmp type family Pure (x :: a) :: f a type T = Pure Flurmp Flurmp }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15428#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15428: Oversaturated type family application panicks GHC (piResultTys2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: TypeInType, | TypeFamilies 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 RyanGlScott): Nice find. I've changed the title accordingly, since this affects all GHCs back to 8.0.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15428#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15428: Oversaturated type family application panicks GHC (piResultTys2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: TypeInType, | TypeFamilies 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 simonpj): I'm on this -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15428#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15428: Oversaturated type family application panicks GHC (piResultTys2)
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: high | Milestone: 8.6.1
Component: Compiler | Version: 8.5
Resolution: | Keywords: TypeInType,
| TypeFamilies
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 Simon Peyton Jones

#15428: Oversaturated type family application panicks GHC (piResultTys2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: merge Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: TypeInType, | TypeFamilies Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash or panic | typecheck/should_compile/T15428 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => typecheck/should_compile/T15428 * status: new => merge Comment: Thanks for the nice test case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15428#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15428: Oversaturated type family application panicks GHC (piResultTys2) -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: TypeInType, | TypeFamilies Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash or panic | typecheck/should_compile/T15428 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged in a107cced37cb95c661b7c7cca1171b33eedf18a9. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15428#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC