diff options
author | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2023-03-04 22:37:43 +0000 |
---|---|---|
committer | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2023-03-04 22:37:43 +0000 |
commit | a446bde622b9e14b0eb7aa2821b093a17b5d33d1 (patch) | |
tree | df7d6d8ececf11cc52d9ced9cbee8bdad7c743df | |
parent | bf43ba9215a726039ace7bac37c0a223a912d998 (diff) | |
download | haskell-wip/T22328.tar.gz |
Add regression test for #22328wip/T22328
-rw-r--r-- | testsuite/tests/patsyn/should_compile/T22328.hs | 16 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_compile/all.T | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_compile/T22328.hs b/testsuite/tests/patsyn/should_compile/T22328.hs new file mode 100644 index 0000000000..02830b8290 --- /dev/null +++ b/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 diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 3a5b3aef5a..d90a0e3358 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/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, ['']) |