Opened 16 months ago

Closed 11 months ago

Last modified 11 months ago

#12174 closed bug (fixed)

Recursive use of type-in-type results in infinite loop

Reported by: ezyang Owned by: goldfire
Priority: highest Milestone: 8.2.1
Component: Compiler (Type checker) Version: 8.0.1
Keywords: TypeInType Cc: goldfire
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: dependent/should_fail/T12174
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Typechecking this module results in an infinite loop:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeInType #-}
module X where

data V a
data T = forall (a :: S). MkT (V a)
data S = forall (a :: T). MkS (V a)

There's a mutually recursive reference so it should be rejected but maybe the check is not happening early enough (or the existing check is only for self-reference.)

Change History (9)

comment:1 Changed 16 months ago by ezyang

Keywords: TypeInType added

comment:2 Changed 15 months ago by fumieval

Probably a similar issue:

{-# LANGUAGE TypeInType #-}

import Data.Proxy

data A a = A (Proxy (a :: A))

results in *** Exception: stack overflow

comment:3 Changed 13 months ago by bgamari

Cc: goldfire added

CCing goldfire who will hopefully have some ideas.

comment:4 Changed 13 months ago by goldfire

Yes -- I expect to take a look at this in my bug sweep, which will hopefully start next week or so.

comment:5 Changed 13 months ago by simonpj

c.f #12386

comment:6 Changed 13 months ago by bgamari

Milestone: 8.2.1
Priority: normalhighest

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

In 03b0b8e4/ghc:

Test Trac #12174

comment:8 Changed 11 months ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: dependent/should_fail/T12714

Works in HEAD. I doubt it's worth trying to track the fix down for the 8.0 branch.

comment:9 Changed 11 months ago by simonpj

Test Case: dependent/should_fail/T12714dependent/should_fail/T12174
Note: See TracTickets for help on using tickets.