Opened 18 months ago

Last modified 8 months ago

#11560 new bug

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:


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:  :? 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:

Change History (7)

comment:1 Changed 18 months ago by rwbarton

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

comment:2 Changed 18 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 17 months ago by rwbarton

Apparently I was supposed to write

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


... where { T Type Int = * }

Some bad interaction with TypeOperators perhaps?

comment:4 Changed 17 months ago by jstolarek

Cc: jstolarek added

comment:5 Changed 8 months ago by RyanGlScott

I can't reproduce this with GHC 8.1.20161125:

$ /opt/ghc/head/bin/ghci
GHCi, version 8.1.20161125:  :? 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 8 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 8 months ago by RyanGlScott

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

Note: See TracTickets for help on using tickets.