summaryrefslogtreecommitdiff
path: root/testsuite/tests/rep-poly/T12709.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rep-poly/T12709.hs')
-rw-r--r--testsuite/tests/rep-poly/T12709.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/rep-poly/T12709.hs b/testsuite/tests/rep-poly/T12709.hs
new file mode 100644
index 0000000000..6a7e37a5d2
--- /dev/null
+++ b/testsuite/tests/rep-poly/T12709.hs
@@ -0,0 +1,30 @@
+{-# Language PolyKinds, ViewPatterns, RebindableSyntax,
+ MagicHash, NoImplicitPrelude #-}
+
+module T12709 where
+
+import GHC.Types
+import Prelude hiding (Num (..))
+import qualified Prelude as P
+import GHC.Prim
+
+data BoxUnbox = BUB Int Int#
+
+class Num (a :: TYPE rep) where
+ (+) :: a -> a -> a
+
+ fromInteger :: Integer -> a
+
+instance Num Int where
+ (+) = (P.+)
+ fromInteger = P.fromInteger
+
+instance Num Int# where
+ (+) = (+#)
+ fromInteger (fromInteger -> I# n) = n
+
+a :: BoxUnbox
+a = let u :: Num (a :: TYPE rep) => a
+ u = 1 + 2 + 3 + 4
+ in
+ BUB u u