Fix #11311
authorRichard Eisenberg <eir@cis.upenn.edu>
Mon, 11 Jan 2016 22:03:47 +0000 (17:03 -0500)
committerRichard Eisenberg <eir@cis.upenn.edu>
Fri, 15 Jan 2016 20:43:43 +0000 (15:43 -0500)
All things of kind *, including * itself, need to have a PtrRep.

Test: dependent/should_compile/T11311

compiler/types/TyCon.hs
testsuite/tests/dependent/should_compile/T11311.hs [new file with mode: 0644]
testsuite/tests/dependent/should_compile/all.T
testsuite/tests/dependent/should_run/Makefile [new file with mode: 0644]
testsuite/tests/dependent/should_run/T11311.hs [new file with mode: 0644]
testsuite/tests/dependent/should_run/all.T [new file with mode: 0755]

index 356e2ea..0f64cf9 100644 (file)
@@ -568,7 +568,7 @@ data TyCon
         primTyConRep  :: PrimRep,-- ^ Many primitive tycons are unboxed, but
                                  -- some are boxed (represented by
                                  -- pointers). This 'PrimRep' holds that
-                                 -- information.  Only relevant if tyConKind = *
+                                 -- information.  Only relevant if tyConKind = #
 
         isUnLifted   :: Bool,    -- ^ Most primitive tycons are unlifted (may
                                  -- not contain bottom) but other are lifted,
@@ -1203,7 +1203,8 @@ mkKindTyCon :: Name -> Kind -> [Role] -> Name -> TyCon
 mkKindTyCon name kind roles rep_nm
   = tc
   where
-    tc = mkPrimTyCon' name kind roles VoidRep False (Just rep_nm)
+    tc = mkPrimTyCon' name kind roles PtrRep False (Just rep_nm)
+      -- PtrRep because kinds have kind *.
 
 -- | Create a lifted primitive 'TyCon' such as @RealWorld@
 mkLiftedPrimTyCon :: Name  -> Kind -> [Role] -> PrimRep -> TyCon
diff --git a/testsuite/tests/dependent/should_compile/T11311.hs b/testsuite/tests/dependent/should_compile/T11311.hs
new file mode 100644 (file)
index 0000000..88f0e45
--- /dev/null
@@ -0,0 +1,8 @@
+module T11311 where
+
+import Data.Kind
+
+foo :: ()
+foo = (id :: * -> *) undefined `seq` ()
+
+main = print foo
index 1063b6e..ef6dde9 100644 (file)
@@ -11,3 +11,4 @@ test('mkGADTVars', normal, compile, [''])
 test('TypeLevelVec',normal,compile, [''])
 test('T9632', normal, compile, [''])
 test('dynamic-paper', normal, compile, [''])
+test('T11311', normal, compile, [''])
diff --git a/testsuite/tests/dependent/should_run/Makefile b/testsuite/tests/dependent/should_run/Makefile
new file mode 100644 (file)
index 0000000..9101fbd
--- /dev/null
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/dependent/should_run/T11311.hs b/testsuite/tests/dependent/should_run/T11311.hs
new file mode 100644 (file)
index 0000000..88f0e45
--- /dev/null
@@ -0,0 +1,8 @@
+module T11311 where
+
+import Data.Kind
+
+foo :: ()
+foo = (id :: * -> *) undefined `seq` ()
+
+main = print foo
diff --git a/testsuite/tests/dependent/should_run/all.T b/testsuite/tests/dependent/should_run/all.T
new file mode 100755 (executable)
index 0000000..c3b18c1
--- /dev/null
@@ -0,0 +1,4 @@
+
+
+# test('T11311', normal, compile_and_run, [''])
+