summaryrefslogtreecommitdiff
path: root/testsuite/tests/quantified-constraints/T17267c.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/quantified-constraints/T17267c.hs')
-rw-r--r--testsuite/tests/quantified-constraints/T17267c.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/quantified-constraints/T17267c.hs b/testsuite/tests/quantified-constraints/T17267c.hs
new file mode 100644
index 0000000000..caa93e8234
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T17267c.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE QuantifiedConstraints #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module T17267c where
+
+-- Now rejected
+class C a b where
+ op :: a -> b
+
+class C a b => Thing a b
+instance C a b => Thing a b
+
+unsafeCoerce :: forall a b. a -> b
+unsafeCoerce a = oops (op a :: Thing a b => b)
+ where
+ oops :: (C a b => Thing a b) => (Thing a b => x) -> x
+ oops r = r
+