Opened 8 months ago

Last modified 8 months ago

#16245 new bug

GHC panic (No skolem info) with QuantifiedConstraints and strange scoping

Reported by: RyanGlScott Owned by:
Priority: normal Milestone: 8.10.1
Component: Compiler (Type checker) Version: 8.6.3
Keywords: TypeInType, QuantifiedConstraints Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash or panic Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

The following program panics with GHC 8.6.3 and HEAD:

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
module Bug where

import Data.Kind

type Const a b = a
type SameKind (a :: k) (b :: k) = (() :: Constraint)
class (forall (b :: k). SameKind a b) => C (k :: Const Type a)
$ /opt/ghc/8.6.3/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:11:36: error:ghc: panic! (the 'impossible' happened)
  (GHC version 8.6.3 for x86_64-unknown-linux):
        No skolem info:
  [k1_a1X4[sk:1]]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcErrors.hs:2891:5 in ghc:TcErrors

As with #16244, I imagine that the real culprit is that SameKind a b would force a :: k, which would be ill-scoped.

Change History (1)

comment:1 Changed 8 months ago by RyanGlScott

Milestone: 8.10.1
Note: See TracTickets for help on using tickets.