summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2019-03-08 19:02:44 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-13 15:16:08 -0400
commit36546a43e490ea6f989e6cad369d1a251c94a42b (patch)
treef6e6b6691cd413381a9a2945552349864e8f342a /testsuite
parentcb17c2da1774a2565946f43261140f2a8b328840 (diff)
downloadhaskell-36546a43e490ea6f989e6cad369d1a251c94a42b.tar.gz
Fix #16411 by making dataConCannotMatch aware of (~~)
The `dataConCannotMatch` function (which powers the `-Wpartial-fields` warning, among other things) had special reasoning for explicit equality constraints of the form `a ~ b`, but it did not extend that reasoning to `a ~~ b` constraints, leading to #16411. Easily fixed.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/typecheck/should_compile/T16411.hs14
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
2 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T16411.hs b/testsuite/tests/typecheck/should_compile/T16411.hs
new file mode 100644
index 0000000000..5cbd255086
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T16411.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE TypeOperators #-}
+{-# OPTIONS_GHC -Wpartial-fields #-}
+module T16411 where
+
+import Data.Type.Equality
+
+data T1 z where
+ MkT1a :: { rec1 :: () } -> T1 Int
+ MkT1b :: (z ~ Bool) => T1 z
+
+data T2 z where
+ MkT2a :: { rec2 :: () } -> T2 Int
+ MkT2b :: (z ~~ Bool) => T2 z
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index b94f021058..81a63c594f 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -670,3 +670,4 @@ test('T16204a', normal, compile, [''])
test('T16204b', normal, compile, [''])
test('T16225', normal, compile, [''])
test('T13951', normal, compile, [''])
+test('T16411', normal, compile, [''])