[GHC] #14033: Invalid newtype causes GHC to panic rather than fail to compile

#14033: Invalid newtype causes GHC to panic rather than fail to compile -------------------------------------+------------------------------------- Reporter: | Owner: (none) InThisStyle10s6p | Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Linux Architecture: x86_64 | Type of failure: Compile-time (amd64) | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This code: {{{#!hs {-# LANGUAGE TypeFamilies #-} newtype Zero = Zero newtype Succ a = Succ a type family Add n m :: * where Add Zero m = m Add (Succ n) m = Succ (Add n m) }}} causes the following GHC error: {{{ $ ghc foo.hs [1 of 1] Compiling Main ( foo.hs, foo.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): isInjectiveTyCon sees a TcTyCon Zero }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14033 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14033: Invalid newtype causes GHC to panic rather than fail to compile -------------------------------------+------------------------------------- Reporter: InThisStyle10s6p | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Happily it's ok in HEAD {{{ T14033.hs:5:16: error: • The constructor of a newtype must have exactly one field but ‘Zero’ has none • In the definition of data constructor ‘Zero’ In the newtype declaration for ‘Zero’ | 5 | newtype Zero = Zero | ^ }}} I think a dup of #13271. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14033#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14033: Invalid newtype causes GHC to panic rather than fail to compile
-------------------------------------+-------------------------------------
Reporter: InThisStyle10s6p | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: Compile-time | (amd64)
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#14033: Invalid newtype causes GHC to panic rather than fail to compile -------------------------------------+------------------------------------- Reporter: InThisStyle10s6p | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: x86_64 | (amd64) Type of failure: Compile-time | Test Case: indexed- crash or panic | types/should_fail/T14033 Blocked By: | Blocking: Related Tickets: #13271 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * testcase: => indexed-types/should_fail/T14033 * resolution: => duplicate * related: => #13271 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14033#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC