[commit: ghc] master: testsuite: Add testcase for T13658 (efd113f)

git at git.haskell.org git at git.haskell.org
Tue May 16 01:08:45 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/efd113f72f07908e57c62cbce71f8d4a1e1d2819/ghc

>---------------------------------------------------------------

commit efd113f72f07908e57c62cbce71f8d4a1e1d2819
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon May 15 20:15:11 2017 -0400

    testsuite: Add testcase for T13658


>---------------------------------------------------------------

efd113f72f07908e57c62cbce71f8d4a1e1d2819
 testsuite/tests/simplCore/should_compile/T13658.hs | 39 ++++++++++++++++++++++
 testsuite/tests/simplCore/should_compile/all.T     |  1 +
 2 files changed, 40 insertions(+)

diff --git a/testsuite/tests/simplCore/should_compile/T13658.hs b/testsuite/tests/simplCore/should_compile/T13658.hs
new file mode 100644
index 0000000..0890e89
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T13658.hs
@@ -0,0 +1,39 @@
+{-# LANGUAGE TypeInType #-}
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE BangPatterns #-}
+
+{- # OPTIONS_GHC -Werror #-}
+{-# OPTIONS_GHC -g -O2 #-}
+
+module Bug (bug) where
+
+-- import GHC.Base (seq)
+import Unsafe.Coerce (unsafeCoerce)
+
+undefined :: a
+undefined = undefined
+
+data TypeRep (a :: k) where
+    TrTyCon :: TypeRep (a :: k)
+    TrApp   :: forall k1 k2 (a :: k1 -> k2) (b :: k1).
+               TypeRep (a b)
+
+data SomeTypeRep where
+    SomeTypeRep :: forall k (a :: k).
+                   TypeRep a
+                -> SomeTypeRep
+
+mkTrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1).
+           TypeRep (a :: k1 -> k2)
+        -> TypeRep (a b)
+mkTrApp TrTyCon = undefined
+mkTrApp TrApp   = undefined
+
+bug :: SomeTypeRep
+-- bug = f x -- this works
+bug = f (f x)
+  where x = SomeTypeRep TrTyCon
+        f :: SomeTypeRep -> SomeTypeRep
+        f (SomeTypeRep acc) = SomeTypeRep (mkTrApp (unsafeCoerce acc))
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index b8a0c66..5ed520d 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -268,3 +268,4 @@ test('T12600',
      normal,
      run_command,
      ['$MAKE -s --no-print-directory T12600'])
+test('T13658', normal, compile, ['-dcore-lint'])



More information about the ghc-commits mailing list