[GHC] #11136: Associated type family: panic due to mismatch in arity of default instances

#11136: Associated type family: panic due to mismatch in arity of default instances -------------------------------------+------------------------------------- Reporter: airini | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 (Type checker) | 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: -------------------------------------+------------------------------------- Having extra type parameters in the definition of default instances for an associated type family causes a ghc panic error (should be detected as a not valid instance). Smallest case example: {{{#!hs class C a where type D a type instance D a x = x }}} It produces the error: {{{ [1 of 1] Compiling Main ( SplitKindFun.hs, interpreted ) ghc: panic! (the 'impossible' happened) (GHC version 7.10.2 for x86_64-apple-darwin): splitKindFunTysN 1 * Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} Crashes similarly for additional parameters in the default instance: {{{#!hs class C a where type D a type instance D a x y = x }}} {{{ [1 of 1] Compiling Main ( SplitKindFun.hs, interpreted ) ghc: panic! (the 'impossible' happened) (GHC version 7.10.2 for x86_64-apple-darwin): splitKindFunTysN 2 * Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} Presumably the arity is not compared correctly to that of the family declaration when the kind is default `*` since the following (and equivalent) causes the panic crash: {{{#!hs class C a where type D a :: * type instance D a x = x }}} but increasing the arity of the family's kind {{{#!hs class C a where type D a :: * -> * type instance D a x = x }}} raises the appropriate error: {{{ [1 of 1] Compiling Main ( SplitKindFun.hs, interpreted ) SplitKindFun.hs:6:3: Number of parameters must match family declaration; expected 1 In the default type instance declaration for ‘D’ In the class declaration for ‘C’ Failed, modules loaded: none. }}} Longer verbose compiler output of the original error: {{{ $ ghc -v SplitKindFun.hs Glasgow Haskell Compiler, Version 7.10.2, stage 2 booted by GHC version 7.10.1.20150612 Using binary package database: /Library/Frameworks/GHC.framework/Versions/7.10.2-x86_64/usr/lib/ghc-7.10.2/package.conf.d/package.cache Using binary package database: /Users/uu/.ghc/x86_64-darwin-7.10.2/package.conf.d/package.cache wired-in package ghc-prim mapped to ghc- prim-0.4.0.0-af16264bc80979d06e37ac63e3ba9a21 wired-in package integer-gmp mapped to integer- gmp-1.0.0.0-8e0f14d0262184533b417ca1f8b44482 wired-in package base mapped to base-4.8.1.0-075aa0db10075facc5aaa59a7991ca2f wired-in package rts mapped to builtin_rts wired-in package template-haskell mapped to template- haskell-2.10.0.0-161ca39a5ae657ff216d049e722e60ea wired-in package ghc mapped to ghc-7.10.2-5c2381785a7b22838c6eda985bc898cf wired-in package dph-seq not found. wired-in package dph-par not found. Hsc static flags: wired-in package ghc-prim mapped to ghc- prim-0.4.0.0-af16264bc80979d06e37ac63e3ba9a21 wired-in package integer-gmp mapped to integer- gmp-1.0.0.0-8e0f14d0262184533b417ca1f8b44482 wired-in package base mapped to base-4.8.1.0-075aa0db10075facc5aaa59a7991ca2f wired-in package rts mapped to builtin_rts wired-in package template-haskell mapped to template- haskell-2.10.0.0-161ca39a5ae657ff216d049e722e60ea wired-in package ghc mapped to ghc-7.10.2-5c2381785a7b22838c6eda985bc898cf wired-in package dph-seq not found. wired-in package dph-par not found. *** Chasing dependencies: Chasing modules from: *SplitKindFun.hs Stable obj: [] Stable BCO: [] Ready for upsweep [NONREC ModSummary { ms_hs_date = 2015-11-26 15:20:15 UTC ms_mod = Main, ms_textual_imps = [import (implicit) Prelude] ms_srcimps = [] }] *** Deleting temp files: Deleting: compile: input file SplitKindFun.hs Created temporary directory: /var/folders/m3/cx6_zbks6qq2xtwx92njp8w40000gn/T/ghc755_0 *** Checking old interface for Main: [1 of 1] Compiling Main ( SplitKindFun.hs, SplitKindFun.o ) *** Parser: *** Renamer/typechecker: *** Deleting temp files: Deleting: /var/folders/m3/cx6_zbks6qq2xtwx92njp8w40000gn/T/ghc755_0/ghc_1.s Warning: deleting non-existent /var/folders/m3/cx6_zbks6qq2xtwx92njp8w40000gn/T/ghc755_0/ghc_1.s *** Deleting temp dirs: Deleting: /var/folders/m3/cx6_zbks6qq2xtwx92njp8w40000gn/T/ghc755_0 ghc: panic! (the 'impossible' happened) (GHC version 7.10.2 for x86_64-apple-darwin): splitKindFunTysN 1 * Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11136 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11136: Associated type family: panic due to mismatch in arity of default instances -------------------------------------+------------------------------------- Reporter: airini | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.10.2 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 simonpj): * owner: => simonpj Comment: I'm on this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11136#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11136: Associated type family: panic due to mismatch in arity of default instances
-------------------------------------+-------------------------------------
Reporter: airini | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 7.10.2
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 Simon Peyton Jones

#11136: Associated type family: panic due to mismatch in arity of default instances -------------------------------------+------------------------------------- Reporter: airini | Owner: simonpj Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 7.10.2 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: indexed- crash | types/should_fail/T11136 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => indexed-types/should_fail/T11136 * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11136#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC