Opened 20 months ago

Closed 2 months ago

#11560 closed bug (fixed)

panic: isInjectiveTyCon sees a TcTyCon

Reported by: rwbarton Owned by: goldfire
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 8.1
Keywords: TypeInType Cc: jstolarek
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I typed this into ghci and it panicked. Not sure whether the declaration is really valid anyways, but ghci shouldn't panic on it.

rwbarton@morphism:~/ghc-newest$ ./inplace/bin/ghc-stage2 --interactive
GHCi, version 8.1.20160201: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XTypeFamilies -XTypeInType
Prelude> :m +Data.Kind
Prelude Data.Kind> type family T (l :: *) (k :: l) :: * where { T * Int = * }
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.1.20160201 for x86_64-unknown-linux):
	isInjectiveTyCon sees a TcTyCon T

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Change History (9)

comment:1 Changed 20 months ago by rwbarton

The panic is also present in version 8.0.0.20160123. (Note both these versions are slightly out of date so it's possible this is fixed already.)

comment:2 Changed 20 months ago by rwbarton

Keywords: TypeInType added

I'll mark this as a TypeInType ticket since I don't know how to cause the panic without TypeInType, though of course it may really be an issue with injective type families.

comment:3 Changed 19 months ago by rwbarton

Apparently I was supposed to write

... where { T (*) Int = * }

or

... where { T Type Int = * }

Some bad interaction with TypeOperators perhaps?

comment:4 Changed 19 months ago by jstolarek

Cc: jstolarek added

comment:5 Changed 10 months ago by RyanGlScott

I can't reproduce this with GHC 8.1.20161125:

$ /opt/ghc/head/bin/ghci
GHCi, version 8.1.20161125: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
λ> :set -XTypeFamilies -XTypeInType
λ> :m +Data.Kind
λ> type family T (l :: *) (k :: l) :: * where { T * Int = * }

<interactive>:3:46: error:
    • Mismatched type name in type family instance.
        Expected: T
          Actual: *
    • In the type family declaration for ‘T’

comment:6 Changed 10 months ago by goldfire

Owner: set to goldfire

This panic is gone (even in 8.0.1), but the code should be accepted. It's indeed a TypeInType error, and I imagine has nothing at all to do with injective type families.

comment:7 Changed 10 months ago by RyanGlScott

I take it the fix for this would be the same as the fix needed for #11307 and #11400?

comment:8 Changed 2 months ago by Richard Eisenberg <rae@…>

In c9667d3/ghc:

Fix #11400, #11560 by documenting an infelicity.

Really, the fix for both of these is #11307.

comment:9 Changed 2 months ago by goldfire

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.