summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T3342.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T3342.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/T3342.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T3342.hs b/testsuite/tests/typecheck/should_compile/T3342.hs
new file mode 100644
index 0000000000..7881aadb4e
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T3342.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE ViewPatterns #-}
+{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}
+
+module T3342 where
+
+data F = FT String [F]
+data G = GX F F | GY
+
+spec :: F -> G
+spec (FT "X" [t1, t2]) = GX t1 t2
+spec _ = GY
+
+-- walk :: F -> F
+walk (spec -> GX _ t2) = walk t2
+walk t@(FT _ _) = t