[Git][ghc/ghc][master] Add a testcase for #20076

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jun 14 11:03:38 UTC 2023



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


Commits:
c29b45ee by Krzysztof Gogolewski at 2023-06-14T07:03:19-04:00
Add a testcase for #20076

Remove 'recursive' in the error message, since the error
can arise without recursion.

- - - - -


3 changed files:

- compiler/GHC/Tc/Types/Origin.hs
- testsuite/tests/typecheck/should_fail/T23427.hs
- testsuite/tests/typecheck/should_fail/T23427.stderr


Changes:

=====================================
compiler/GHC/Tc/Types/Origin.hs
=====================================
@@ -830,7 +830,7 @@ pprCtOrigin (InstProvidedOrigin mod cls_inst)
 
 pprCtOrigin (ImpedanceMatching x)
   = vcat [ text "arising when matching required constraints"
-         , text "in a recursive group involving" <+> quotes (ppr x)]
+         , text "in a group involving" <+> quotes (ppr x)]
 
 pprCtOrigin (CycleBreakerOrigin orig)
   = pprCtOrigin orig


=====================================
testsuite/tests/typecheck/should_fail/T23427.hs
=====================================
@@ -1,3 +1,4 @@
+{-# LANGUAGE NoMonomorphismRestriction #-}
 module T23427 where
 
 class C a where
@@ -8,3 +9,7 @@ indent n = doText n
     where
       doText x = const (f x) doTail
       doTail _ = const n doText
+
+-- Test case from #20076
+x :: Num a => a
+(x, y) = (1.2, 3.4)


=====================================
testsuite/tests/typecheck/should_fail/T23427.stderr
=====================================
@@ -1,12 +1,12 @@
 
-T23427.hs:9:7: error: [GHC-39999]
+T23427.hs:10:7: error: [GHC-39999]
     • Could not deduce ‘C a0’
         arising when matching required constraints
-        in a recursive group involving ‘doTail’
+        in a group involving ‘doTail’
       from the context: C a
         bound by the type signature for:
                    indent :: forall a. C a => a -> a
-        at T23427.hs:6:1-23
+        at T23427.hs:7:1-23
       The type variable ‘a0’ is ambiguous
     • In an equation for ‘indent’:
           indent n
@@ -14,3 +14,12 @@ T23427.hs:9:7: error: [GHC-39999]
             where
                 doText x = const (f x) doTail
                 doTail _ = const n doText
+
+T23427.hs:15:1: error: [GHC-39999]
+    Could not deduce ‘Fractional a’
+      arising when matching required constraints
+      in a group involving ‘x’
+    from the context: Num a
+      bound by the inferred type for ‘x’:
+                 forall a. Num a => a
+      at T23427.hs:15:1-19



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c29b45eefc27cacb0ea014d856500396e178da25
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/20230614/4ba80ea0/attachment-0001.html>


More information about the ghc-commits mailing list