summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T14333.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T14333.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/T14333.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T14333.hs b/testsuite/tests/typecheck/should_compile/T14333.hs
new file mode 100644
index 0000000000..f4cd3bdf2b
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T14333.hs
@@ -0,0 +1,20 @@
+module T14333 where
+
+import Data.Coerce
+
+bad :: Coercible (a b) (c d) => c d -> a b
+bad = coerce
+
+bad2 :: Coercible (c d) (a b) => c d -> a b
+bad2 = coerce
+
+bad3 :: Coercible (a b) b => b -> a b
+bad3 = coerce
+
+bad4 :: Coercible b (a b) => b -> a b
+bad4 = coerce
+
+newtype Id a = MkId a
+
+foo :: Id Int
+foo = bad3 (3 :: Int)