summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-08-25 15:27:13 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-26 13:40:09 -0400
commitd551199c492b789114f2188591d1a9872f9a5d20 (patch)
tree4338ec21440210b942d7803e0fc94e2c8492a5ec /testsuite
parentb365335180e82088d5a94b262c79c25b33ef0dc3 (diff)
downloadhaskell-d551199c492b789114f2188591d1a9872f9a5d20.tar.gz
Fix GHC.Core.Subst.substDVarSet
substDVarSet looked up coercion variables in the wrong environment! The fix is easy. It is still a pretty strange looking function, but the bug is gone. This fixes another manifestation of #20200.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/simplCore/should_compile/T20200b.hs11
-rw-r--r--testsuite/tests/simplCore/should_compile/T20200b.stderr4
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
3 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T20200b.hs b/testsuite/tests/simplCore/should_compile/T20200b.hs
new file mode 100644
index 0000000000..8826e66db5
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T20200b.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE DataKinds #-}
+module T20200b where
+
+import Data.Kind
+
+xrecTuple :: Rec [Bool, Char] -> (Bool, Char)
+xrecTuple (a :& (b :& _)) = (a, b)
+
+data Rec :: [Type] -> Type where
+ (:&) :: r -> !(Rec rs) -> Rec (r ': rs)
diff --git a/testsuite/tests/simplCore/should_compile/T20200b.stderr b/testsuite/tests/simplCore/should_compile/T20200b.stderr
new file mode 100644
index 0000000000..1db18a40f6
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T20200b.stderr
@@ -0,0 +1,4 @@
+
+T20200b.hs:8:1: warning: [-Woverlapping-patterns (in -Wdefault)]
+ Pattern match has inaccessible right hand side
+ In an equation for ‘xrecTuple’: xrecTuple (a :& (b :& _)) = ...
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 03039e8f8c..7db92e561c 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -374,3 +374,4 @@ test('T16373', normal, compile, [''])
test('T20112', normal, multimod_compile, ['T20112', '-O -v0 -g1'])
test('T20200', normal, compile, [''])
test('T20200a', normal, compile, ['-O2'])
+test('T20200b', normal, compile, ['-O2'])