[Git][ghc/ghc][master] Add regression test for #22328

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Mar 6 00:57:45 UTC 2023



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


Commits:
232cfc24 by Simon Peyton Jones at 2023-03-05T19:57:30-05:00
Add regression test for #22328

- - - - -


2 changed files:

- + testsuite/tests/patsyn/should_compile/T22328.hs
- testsuite/tests/patsyn/should_compile/all.T


Changes:

=====================================
testsuite/tests/patsyn/should_compile/T22328.hs
=====================================
@@ -0,0 +1,16 @@
+{-# LANGUAGE TypeApplications, PatternSynonyms, GADTs, ViewPatterns #-}
+
+module T22328 where
+
+import Data.Typeable
+
+data Gadt x y where
+  ExistentialInGadt :: Typeable a => a -> Gadt x x
+
+pattern CastGadt :: Typeable a => x ~ y => a -> Gadt x y
+pattern CastGadt a <- ExistentialInGadt (cast -> Just a)
+
+test :: Gadt i o -> Bool
+test gadt = case gadt of
+  CastGadt @Bool a -> a
+  _ -> False


=====================================
testsuite/tests/patsyn/should_compile/all.T
=====================================
@@ -84,3 +84,4 @@ test('T14630', normal, compile, ['-Wname-shadowing'])
 test('T21531', [ grep_errmsg(r'INLINE') ], compile, ['-ddump-ds'])
 test('T22521', normal, compile, [''])
 test('T23038', normal, compile_fail, [''])
+test('T22328', normal, compile, [''])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/232cfc241c14ba6a49d9552a90a94857255e455d
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/20230305/7de05295/attachment-0001.html>


More information about the ghc-commits mailing list