summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-05-15 20:15:11 -0400
committerBen Gamari <ben@smart-cactus.org>2017-05-15 21:07:56 -0400
commitefd113f72f07908e57c62cbce71f8d4a1e1d2819 (patch)
tree8a6f5adce6e9b0989bc9e41c21d3cc76a09d6fca
parent49012ebc9ed44a0b1f8de3781e15c8115d3074f8 (diff)
downloadhaskell-efd113f72f07908e57c62cbce71f8d4a1e1d2819.tar.gz
testsuite: Add testcase for T13658
-rw-r--r--testsuite/tests/simplCore/should_compile/T13658.hs39
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
2 files changed, 40 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T13658.hs b/testsuite/tests/simplCore/should_compile/T13658.hs
new file mode 100644
index 0000000000..0890e89b7f
--- /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 b8a0c66d7f..5ed520d597 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'])