Opened 3 months ago

Closed 2 months ago

#13625 closed bug (fixed)

GHC internal error: ‘Y’ is not in scope during type checking, but it passed the renamer

Reported by: mpickering Owned by:
Priority: normal Milestone: 8.2.1
Component: Compiler Version: 8.0.1
Keywords: TypeInType Cc: mietek
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: polykinds/T13625
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

{-# LANGUAGE TypeInType #-}
data X :: Y where Y :: X

The error message is:

Bug.hs:2:11: error: …
    • GHC internal error: ‘Y’ is not in scope during type checking, but it passed the renamer
      tcl_env of environment: [r1cR :-> APromotionErr TyConPE]
    • In the kind ‘Y’

Originally reported by @mietek in #11821

Change History (4)

comment:1 Changed 3 months ago by goldfire

Keywords: TypeInType added

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

In 2501fb70/ghc:

Fix scoping of data cons during kind checking

Trac #13625 pointed out that in

   data X :: Y where Y :: X

we need 'Y' to be in scope (as APromotionErr) when dealing with
X's kind signature.  Previously we got a crash.

This patch simplifies the code as well as making it work.

comment:3 Changed 2 months ago by simonpj

Status: newmerge
Test Case: polykinds/T13625

Thanks for reporting. Perhaps worth merging, but it only affects incorrect programs.

comment:4 Changed 2 months ago by bgamari

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