Opened 17 months ago

Closed 5 months ago

#11964 closed bug (fixed)

Without TypeInType, inconsistently accepts Data.Kind.Type but not type synonym

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

Description (last modified by ezyang)

For convenience, I'll use GHCi to demonstrate flag behavior. First, we define a file:

{-# LANGUAGE TypeInType #-}
import Data.Kind
type Star = Type
newtype T k (t :: k) = T ()

Next, we load it up in GHCi, WITHOUT -XTypeInType. Now we observe strange behavior:

ezyang@sabre:~$ ghc-8.0 --interactive C.hs 
GHCi, version  :? for help
[1 of 1] Compiling Main             ( C.hs, interpreted )
Ok, modules loaded: Main.
*Main> :k T Type Int
T Type Int :: *
*Main> :k T Star Int

<interactive>:1:3: error:
    • Data constructor ‘Star’ cannot be used here
        (Perhaps you intended to use DataKinds)
    • In the first argument of ‘T’, namely ‘Star’
      In the type ‘T Star Int’

Of course, if we pass -TypeInType to GHCi that fixes the problem (BTW, DataKinds does NOT solve the problem.)

Change History (5)

comment:1 Changed 17 months ago by ezyang

Description: modified (diff)

comment:2 Changed 17 months ago by goldfire

Keywords: TypeInType added

comment:3 Changed 5 months ago by RyanGlScott

Interestingly, I can't reproduce this issue on GHC 8.0.1 or later, so perhaps this issue only existed in the GHC 8.0.1 release candidates?

comment:4 Changed 5 months ago by Ryan Scott <…>

In a13adcf8/ghc:

Add regression test for #11964

This issue was only ever present in the GHC 8.0.1 release candidates, but
let's add a regression test for it just to be safe.

comment:5 Changed 5 months ago by RyanGlScott

Resolution: fixed
Status: newclosed
Test Case: dependent/should_run/T11964
Note: See TracTickets for help on using tickets.