Add test for old issue displaying unboxed tuples in error messages (#502)
authorKevin Buhr <buhr@asaurus.net>
Fri, 10 May 2019 02:46:48 +0000 (21:46 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 29 May 2019 14:38:30 +0000 (10:38 -0400)
testsuite/tests/typecheck/should_fail/T502.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T502.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T502.hs b/testsuite/tests/typecheck/should_fail/T502.hs
new file mode 100644 (file)
index 0000000..c73b7ac
--- /dev/null
@@ -0,0 +1,10 @@
+{-# LANGUAGE MagicHash, UnboxedTuples #-}
+
+module T502 where
+
+-- As per #502, the following type error message should correctly
+-- display the unboxed tuple type.
+bar :: Int
+bar = snd foo
+  where foo :: (# Int, Int #)
+        foo = undefined
diff --git a/testsuite/tests/typecheck/should_fail/T502.stderr b/testsuite/tests/typecheck/should_fail/T502.stderr
new file mode 100644 (file)
index 0000000..ba5f6d1
--- /dev/null
@@ -0,0 +1,12 @@
+
+T502.hs:8:11: error:
+    • Couldn't match expected type ‘(a0, Int)’
+                  with actual type ‘(# Int, Int #)’
+    • In the first argument of ‘snd’, namely ‘foo’
+      In the expression: snd foo
+      In an equation for ‘bar’:
+          bar
+            = snd foo
+            where
+                foo :: (# Int, Int #)
+                foo = undefined
index 5711753..962febd 100644 (file)
@@ -515,3 +515,4 @@ test('T16204c', normal, compile_fail, [''])
 test('T16394', normal, compile_fail, [''])
 test('T16414', normal, compile_fail, [''])
 test('T16627', normal, compile_fail, [''])
+test('T502', normal, compile_fail, [''])