[Git][ghc/ghc][master] Add a test for #17284

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu May 11 08:13:27 UTC 2023



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


Commits:
bd0b056e by Krzysztof Gogolewski at 2023-05-11T04:12:44-04:00
Add a test for #17284

Since !10123 we now reject this program.

- - - - -


4 changed files:

- compiler/GHC/Tc/Types.hs
- + testsuite/tests/typecheck/should_fail/T17284.hs
- + testsuite/tests/typecheck/should_fail/T17284.stderr
- testsuite/tests/typecheck/should_fail/all.T


Changes:

=====================================
compiler/GHC/Tc/Types.hs
=====================================
@@ -1592,7 +1592,7 @@ instance Outputable TcIdSigInfo where
     ppr (CompleteSig { sig_bndr = bndr })
         = ppr bndr <+> dcolon <+> ppr (idType bndr)
     ppr (PartialSig { psig_name = name, psig_hs_ty = hs_ty })
-        = text "psig" <+> ppr name <+> dcolon <+> ppr hs_ty
+        = text "[partial signature]" <+> ppr name <+> dcolon <+> ppr hs_ty
 
 instance Outputable TcIdSigInst where
     ppr (TISI { sig_inst_sig = sig, sig_inst_skols = skols


=====================================
testsuite/tests/typecheck/should_fail/T17284.hs
=====================================
@@ -0,0 +1,9 @@
+{-# LANGUAGE MonomorphismRestriction #-}
+{-# LANGUAGE PartialTypeSignatures #-}
+
+module MonoPoly where
+
+f :: Num a => a -> _
+f x = x + y
+
+y = f 1


=====================================
testsuite/tests/typecheck/should_fail/T17284.stderr
=====================================
@@ -0,0 +1,4 @@
+
+T17284.hs:6:1: error: [GHC-16675]
+    Overloaded signature conflicts with monomorphism restriction
+      [partial signature] f :: Num a => a -> _


=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -681,3 +681,4 @@ test('LazyFieldsDisabled', normal, compile_fail, [''])
 test('TyfamsDisabled', normal, compile_fail, [''])
 test('CommonFieldResultTypeMismatch', normal, compile_fail, [''])
 test('CommonFieldTypeMismatch', normal, compile_fail, [''])
+test('T17284', normal, compile_fail, [''])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bd0b056ea56643bcca1a23b78f72576f9459ce1b
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/20230511/58a8427c/attachment-0001.html>


More information about the ghc-commits mailing list