#15859 closed bug (fixed)

Dependent quantification, GHC panic

Reported by: Iceland_jack Owned by:
Priority: normal Milestone: 8.6.3
Component: Compiler Version: 8.6.1
Keywords: TypeInType Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: dependent/should_fail/T15859
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

While exploring Ryan's gist for term-level f :: forall a -> a -> Type.

{-# Language PolyKinds          #-}
{-# Language TypeApplications   #-}
{-# Language ImpredicativeTypes #-}

import Data.Kind

data A k :: k -> Type

f :: KindOf A
f a = undefined

type KindOf (a :: k) = k

a = f @Int

gives

$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 630_bug.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( 630_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.7.20181029 for x86_64-unknown-linux):
        ASSERT failed!
  KindOf A
  forall k -> k -> *
  k_a1xQ[sk:0]
  k_a1xQ[sk:0] -> *
  k_a1xQ[sk:0]
  [req]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
        pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable
        assertPprPanic, called at compiler/typecheck/TcExpr.hs:1336:94 in ghc:TcExpr

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

>

Change History (7)

comment:1 Changed 11 months ago by Iceland_jack

minimized

{-# Language PolyKinds          #-}
{-# Language TypeApplications   #-}
{-# Language ImpredicativeTypes #-}

import Data.Kind

data A k :: k -> Type

type KindOf (a :: k) = k

a = (undefind :: KindOf A) @Int

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

In 72b82343/ghc:

Fix #15859 by checking, not assuming, an ArgFlag

We thought that visible dependent quantification was impossible
in terms, but Iceland Jack discovered otherwise in #15859. This fixes an
ASSERT failure that arose.

test case: dependent/should_fail/T15859

comment:3 Changed 11 months ago by goldfire

Status: newmerge
Test Case: dependent/should_fail/T15859

No reason not to merge, if we're still working on 8.6.

comment:4 Changed 11 months ago by RyanGlScott

Milestone: 8.6.3

comment:5 Changed 11 months ago by Richard Eisenberg <rae@…>

In 5693ddd0/ghc:

Actually add test for #15859.

Oops. Forgot to `git add`.

comment:6 Changed 10 months ago by Simon Peyton Jones <simonpj@…>

In 0ce66be9/ghc:

Comments adding to the fix for Trac #15859

comment:7 Changed 10 months ago by bgamari

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