[Git][ghc/ghc][master] Add a regression test for #24064

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Oct 19 15:37:44 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
740a1b85 by Krzysztof Gogolewski at 2023-10-19T11:37:20-04:00
Add a regression test for #24064

- - - - -


3 changed files:

- + testsuite/tests/typecheck/should_fail/T24064.hs
- + testsuite/tests/typecheck/should_fail/T24064.stderr
- testsuite/tests/typecheck/should_fail/all.T


Changes:

=====================================
testsuite/tests/typecheck/should_fail/T24064.hs
=====================================
@@ -0,0 +1,48 @@
+{-# LANGUAGE Haskell2010 #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeFamilies #-}
+
+module T24064 where
+
+class C1 b where
+  type F1 b
+
+class C2 (m :: * -> *) where
+  type F2 m
+
+class C3 r where
+  type F3 r
+
+class G t m where
+  g :: m a -> t m a
+
+data Y
+
+data X e a
+
+data H a
+
+data S a
+
+fun1 :: X e ()
+fun1 = undefined
+
+fun2 :: S ()
+fun2 = undefined
+
+fun3 :: H ()
+fun3 = undefined
+
+fun4 :: (F3 r ~ F1 (F2 m)) => r -> m ()
+fun4 = undefined
+
+test :: (C2 m, F2 m ~ Y) => m ()
+test = do
+  fun1
+  fun2
+  g fun3
+  fun4 undefined
+
+main :: IO ()
+main = pure ()


=====================================
testsuite/tests/typecheck/should_fail/T24064.stderr
=====================================
@@ -0,0 +1,26 @@
+
+T24064.hs:42:3: error: [GHC-25897]
+    • Could not deduce ‘m ~ X e0’
+      from the context: (C2 m, F2 m ~ Y)
+        bound by the type signature for:
+                   test :: forall (m :: * -> *). (C2 m, F2 m ~ Y) => m ()
+        at T24064.hs:40:1-32
+      Expected: m ()
+        Actual: X e0 ()
+      ‘m’ is a rigid type variable bound by
+        the type signature for:
+          test :: forall (m :: * -> *). (C2 m, F2 m ~ Y) => m ()
+        at T24064.hs:40:1-32
+    • In a stmt of a 'do' block: fun1
+      In the expression:
+        do fun1
+           fun2
+           g fun3
+           fun4 undefined
+      In an equation for ‘test’:
+          test
+            = do fun1
+                 fun2
+                 g fun3
+                 ....
+    • Relevant bindings include test :: m () (bound at T24064.hs:41:1)


=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -704,3 +704,4 @@ test('T22478c', normal, compile_fail, [''])
 test('T23776', normal, compile, ['']) # to become an error in GHC 9.12
 test('T17940', normal, compile_fail, [''])
 test('ErrorIndexLinks', normal, compile_fail, ['-fprint-error-index-links=always'])
+test('T24064', normal, compile_fail, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/740a1b8563f8abe573f3d325ed29c185448e23ca

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/740a1b8563f8abe573f3d325ed29c185448e23ca
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231019/9f4f815c/attachment-0001.html>


More information about the ghc-commits mailing list