Opened 2 years ago

Closed 2 years ago

#14209 closed bug (fixed)

GHC 8.2.1 regression involving telescoping kind signature

Reported by: RyanGlScott Owned by:
Priority: high Milestone: 8.4.1
Component: Compiler (Type checker) Version: 8.2.1
Keywords: TypeInType Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case: polykinds/T14209
Blocked By: Blocking:
Related Tickets: #13738 Differential Rev(s): Phab:D3936
Wiki Page:


The following program typechecks in GHC 8.0.1 and 8.0.2:

{-# LANGUAGE TypeInType #-}
module Bug where

data MyProxy k (a :: k) = MyProxy
data Foo (z :: MyProxy k (a :: k))

But in GHC 8.2.1, it's rejected:

GHCi, version 8.2.1:  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )

Bug.hs:6:1: error:
    Kind variable ‘k’ is implicitly bound in datatype
    ‘Foo’, but does not appear as the kind of any
    of its type variables. Perhaps you meant
    to bind it explicitly somewhere?
    Type variables with inferred kinds:
      (k :: *) (a :: k) (z :: MyProxy k a)
6 | data Foo (z :: MyProxy k (a :: k))
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Change History (5)

comment:1 Changed 2 years ago by RyanGlScott

Actually, it turns out that this typechecks once again on GHC HEAD due to commit 0257dacf228024d0cc6ba247c707130637a25580 (Refactor bindHsQTyVars and friends).

I can certainly add a test case, but this makes me wonder: should we merge 0257dacf228024d0cc6ba247c707130637a25580 into GHC 8.2.2?

comment:2 Changed 2 years ago by RyanGlScott

Differential Rev(s): Phab:D3936
Status: newpatch

comment:3 Changed 2 years ago by bgamari


As discussed in ticket:13738#comment:20 we won't be merging the patch for 8.2.2.

comment:4 Changed 2 years ago by Ryan Scott <…>

In dafa0128/ghc:

Add regression test for #14209

Commit 0257dacf228024d0cc6ba247c707130637a25580
(`Refactor bindHsQTyVars and friends`) ended up fixing #14209. Let's
add a regression test so that it stays fixed.

Test Plan: make test TEST=T14209

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14209

Differential Revision:

comment:5 Changed 2 years ago by RyanGlScott

Resolution: fixed
Status: patchclosed
Test Case: polykinds/T14209
Note: See TracTickets for help on using tickets.