summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_run/T17104.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_run/T17104.hs')
-rw-r--r--testsuite/tests/typecheck/should_run/T17104.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_run/T17104.hs b/testsuite/tests/typecheck/should_run/T17104.hs
new file mode 100644
index 0000000000..8cf3b5fda1
--- /dev/null
+++ b/testsuite/tests/typecheck/should_run/T17104.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE ImplicitParams #-}
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+
+module Main where
+
+import GHC.Exts
+import Data.Type.Equality
+
+type family F x :: Constraint
+type instance F Int = (?x :: String)
+
+data Box where MkBox :: (?x :: String) => Box
+data Box2 a where MkBox2 :: F a => Box2 a
+
+f :: Box2 a -> Box -> a :~: Int -> String
+f MkBox2 MkBox Refl = ?x
+
+main :: IO ()
+main = do { let mb = let ?x = "right" in MkBox
+ ; let mb2 = let ?x = "wrong" in MkBox2
+ ; print (f mb2 mb Refl) }