[Git][ghc/ghc][wip/T24978] Add tests for #24845

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Thu Jul 4 14:29:51 UTC 2024



Simon Peyton Jones pushed to branch wip/T24978 at Glasgow Haskell Compiler / GHC


Commits:
be14df42 by Simon Peyton Jones at 2024-07-04T15:29:38+01:00
Add tests for #24845

- - - - -


4 changed files:

- + testsuite/tests/pmcheck/should_compile/T24845.hs
- testsuite/tests/pmcheck/should_compile/all.T
- + testsuite/tests/typecheck/should_compile/T24845a.hs
- testsuite/tests/typecheck/should_compile/all.T


Changes:

=====================================
testsuite/tests/pmcheck/should_compile/T24845.hs
=====================================
@@ -0,0 +1,14 @@
+{-# LANGUAGE DataKinds, GADTs #-}
+{-# OPTIONS_GHC -Wall #-}
+module M where
+
+import Data.Proxy
+import GHC.TypeLits
+
+data T n where
+  Z :: T 0
+  S :: Proxy n -> T (n + 1)
+
+foo :: T 0 -> Bool
+foo Z = True
+-- Should not warn of non-exhaustive patterns


=====================================
testsuite/tests/pmcheck/should_compile/all.T
=====================================
@@ -170,3 +170,4 @@ test('DsIncompleteRecSel1', normal, compile, ['-Wincomplete-record-selectors'])
 test('DsIncompleteRecSel2', normal, compile, ['-Wincomplete-record-selectors'])
 test('DsIncompleteRecSel3', [collect_compiler_stats('bytes allocated', 10)], compile, ['-Wincomplete-record-selectors'])
 test('DoubleMatch', normal, compile, [overlapping_incomplete])
+test('T24845', [], compile, [overlapping_incomplete])


=====================================
testsuite/tests/typecheck/should_compile/T24845a.hs
=====================================
@@ -0,0 +1,12 @@
+{-# LANGUAGE GHC2021 #-}
+
+module T24845a where
+
+import GHC.TypeLits
+import Data.Proxy
+
+f :: (a+b ~ a+c) => Proxy b -> Proxy c
+f x = x   -- Should be accepted
+
+g :: (a+b ~ d, a+c ~ d) => Proxy b -> Proxy c
+g x = x   -- Should be accepted


=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -919,4 +919,5 @@ test('T23739a', normal, compile, [''])
 test('T24810', normal, compile, [''])
 test('T24887', normal, compile, [''])
 test('T24938a', normal, compile, [''])
+test('T24845a', normal, compile, [''])
 



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

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/be14df42b66833cc1a6aa1348473ebb4848fc3f2
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/20240704/9b78ef16/attachment-0001.html>


More information about the ghc-commits mailing list