[commit: testsuite] master: Test Trac #6078 (37769ce)
Simon Peyton Jones
simonpj at microsoft.com
Wed May 9 18:51:10 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/37769ce675680d63072cd7103f8c21e408a188b5
>---------------------------------------------------------------
commit 37769ce675680d63072cd7103f8c21e408a188b5
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed May 9 17:48:20 2012 +0100
Test Trac #6078
>---------------------------------------------------------------
tests/typecheck/should_fail/T6078.hs | 11 +++++++++++
tests/typecheck/should_fail/T6078.stderr | 11 +++++++++++
tests/typecheck/should_fail/all.T | 1 +
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/tests/typecheck/should_fail/T6078.hs b/tests/typecheck/should_fail/T6078.hs
new file mode 100644
index 0000000..4addabe
--- /dev/null
+++ b/tests/typecheck/should_fail/T6078.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE BangPatterns #-}
+module T6078 where
+
+import GHC.Ptr
+import Foreign
+
+byteStringSlice len = \fpbuf ip0 ipe s0 ->
+ let ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len
+ -- Note that the panic goes away if we use a bang-pattern as follows
+ -- let !ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len
+ in ip1p
diff --git a/tests/typecheck/should_fail/T6078.stderr b/tests/typecheck/should_fail/T6078.stderr
new file mode 100644
index 0000000..7690ecd
--- /dev/null
+++ b/tests/typecheck/should_fail/T6078.stderr
@@ -0,0 +1,11 @@
+
+T6078.hs:8:10:
+ You can't mix polymorphic and unlifted bindings
+ ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len
+ Probable fix: use a bang pattern
+ In the expression:
+ let ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len in ip1p
+ In the expression:
+ \ fpbuf ip0 ipe s0 -> let ip1p@(Ptr ip1) = ... in ip1p
+ In an equation for `byteStringSlice':
+ byteStringSlice len = \ fpbuf ip0 ipe s0 -> let ... in ip1p
diff --git a/tests/typecheck/should_fail/all.T b/tests/typecheck/should_fail/all.T
index e9d27ec..e27d0cc 100644
--- a/tests/typecheck/should_fail/all.T
+++ b/tests/typecheck/should_fail/all.T
@@ -276,3 +276,4 @@ test('T5957', normal, compile_fail, [''])
test('T6001', normal, compile_fail, [''])
test('T6022', expect_broken(6022), compile_fail, [''])
test('T5853', normal, compile_fail, [''])
+test('T6078', normal, compile_fail, [''])
More information about the Cvs-ghc
mailing list