summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-05-09 18:03:38 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-05-09 18:03:38 +0100
commit43e1ff2d60a1ed8c456a0f677430d277541eeeb2 (patch)
tree3c6a06204d367810d2dbf1cad5fd3ca2ce0996c2 /testsuite
parentaf0bf03c5495f00ccc24818907654b890ced0467 (diff)
parent3528d0ad169e97a78baeec95276372440dadf117 (diff)
downloadhaskell-43e1ff2d60a1ed8c456a0f677430d277541eeeb2.tar.gz
Merge branch 'master' of http://darcs.haskell.org/testsuite
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/driver/runtests.py18
-rw-r--r--testsuite/driver/testlib.py46
-rw-r--r--testsuite/mk/boilerplate.mk6
-rw-r--r--testsuite/mk/ghc-config.hs26
-rw-r--r--testsuite/tests/annotations/should_run/annrun01.hs4
-rw-r--r--testsuite/tests/cabal/cabal01/cabal01.stdout-mingw32 (renamed from testsuite/tests/cabal/cabal01/cabal01.stdout-i386-unknown-mingw32)0
-rw-r--r--testsuite/tests/cabal/ghcpkg03.stderr-mingw32 (renamed from testsuite/tests/cabal/ghcpkg03.stderr-i386-unknown-mingw32)0
-rw-r--r--testsuite/tests/cabal/ghcpkg05.stderr-mingw32 (renamed from testsuite/tests/cabal/ghcpkg05.stderr-i386-unknown-mingw32)0
-rw-r--r--testsuite/tests/driver/all.T2
-rw-r--r--testsuite/tests/dynlibs/Makefile4
-rw-r--r--testsuite/tests/ffi/should_run/4038.hs4
-rw-r--r--testsuite/tests/ffi/should_run/all.T4
-rw-r--r--testsuite/tests/ffi/should_run/capi_value_c.c2
-rw-r--r--testsuite/tests/ffi/should_run/capi_value_c.h2
-rw-r--r--testsuite/tests/ghci/linking/Makefile28
-rw-r--r--testsuite/tests/ghci/linking/ghcilink002.stderr-mingw32 (renamed from testsuite/tests/ghci/linking/ghcilink002.stderr-i386-unknown-mingw32)0
-rw-r--r--testsuite/tests/ghci/linking/ghcilink005.stderr-mingw32 (renamed from testsuite/tests/ghci/linking/ghcilink005.stderr-i386-unknown-mingw32)0
-rw-r--r--testsuite/tests/ghci/scripts/6007.script2
-rw-r--r--testsuite/tests/ghci/scripts/T6007.stderr6
-rw-r--r--testsuite/tests/ghci/should_run/all.T2
-rw-r--r--testsuite/tests/hsc2hs/all.T3
-rw-r--r--testsuite/tests/lib/win32/Makefile3
-rw-r--r--testsuite/tests/lib/win32/all.T10
-rw-r--r--testsuite/tests/lib/win32/win32001.hs104
-rw-r--r--testsuite/tests/lib/win32/win32002.hs19
-rw-r--r--testsuite/tests/perf/compiler/all.T31
-rw-r--r--testsuite/tests/plugins/Makefile2
-rw-r--r--testsuite/tests/polykinds/Makefile8
-rw-r--r--testsuite/tests/polykinds/T6054.hs7
-rw-r--r--testsuite/tests/polykinds/T6054.stderr10
-rw-r--r--testsuite/tests/polykinds/T6054a.hs6
-rw-r--r--testsuite/tests/polykinds/all.T1
-rw-r--r--testsuite/tests/rename/should_fail/T6060.hs5
-rw-r--r--testsuite/tests/rename/should_fail/T6060.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
-rw-r--r--testsuite/tests/rts/T6006.stdout-mingw322
-rw-r--r--testsuite/tests/rts/all.T14
-rw-r--r--testsuite/tests/rts/outofmem.stderr-x86_64-unknown-mingw321
-rw-r--r--testsuite/tests/simplCore/should_compile/spec-inline.stderr7
-rw-r--r--testsuite/tests/typecheck/should_compile/T6055.hs45
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
-rw-r--r--testsuite/tests/typecheck/should_fail/T6078.hs11
-rw-r--r--testsuite/tests/typecheck/should_fail/T6078.stderr11
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
44 files changed, 225 insertions, 238 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 301344ea86..07791349a2 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -18,11 +18,6 @@ from testglobals import *
# value.
os.environ['TERM'] = 'vt100'
-if sys.platform == "cygwin":
- cygwin = True
-else:
- cygwin = False
-
global config
config = getConfig() # get it from testglobals
@@ -115,15 +110,20 @@ if config.use_threads == 1:
config.cygwin = False
config.msys = False
if windows:
- if cygwin:
+ h = os.popen('uname -s', 'r')
+ v = h.read()
+ h.close()
+ if v.startswith("CYGWIN"):
config.cygwin = True
- else:
+ elif v.startswith("MINGW32"):
config.msys = True
+ else:
+ raise Exception("Can't detect Windows terminal type")
# Try to use UTF8
if windows:
import ctypes
- if cygwin:
+ if config.cygwin:
# Is this actually right? Which calling convention does it use?
# As of the time of writing, ctypes.windll doesn't exist in the
# cygwin python, anyway.
@@ -182,7 +182,7 @@ if windows or darwin:
path = re.sub('^"(.*)"$', '\\1', path)
path = re.sub('\\\\(.)', '\\1', path)
if windows:
- if cygwin:
+ if config.cygwin:
# On cygwin we can't put "c:\foo" in $PATH, as : is a
# field separator. So convert to /cygdrive/c/foo instead.
# Other pythons use ; as the separator, so no problem.
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index fe727bfde9..fc9014d2a2 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1466,9 +1466,15 @@ def dump_stderr( name ):
print read_no_crs(qualify(name, 'run.stderr'))
def read_no_crs(file):
- h = open(file)
- str = h.read()
- h.close
+ str = ''
+ try:
+ h = open(file)
+ str = h.read()
+ h.close
+ except:
+ # On Windows, if the program fails very early, it seems the
+ # files stdout/stderr are redirected to may not get created
+ pass
return re.sub('\r', '', str)
def write_file(file, str):
@@ -1700,8 +1706,8 @@ def rawSystem(cmd_and_args):
def runCmd( cmd ):
if_verbose( 1, cmd )
r = 0
- if config.platform == 'i386-unknown-mingw32':
- # On MinGW, we will always have timeout
+ if config.os == 'mingw32':
+ # On MinGW, we will always have timeout
assert config.timeout_prog!=''
if config.timeout_prog != '':
@@ -1713,8 +1719,8 @@ def runCmd( cmd ):
def runCmdFor( name, cmd ):
if_verbose( 1, cmd )
r = 0
- if config.platform == 'i386-unknown-mingw32':
- # On MinGW, we will always have timeout
+ if config.os == 'mingw32':
+ # On MinGW, we will always have timeout
assert config.timeout_prog!=''
if config.timeout_prog != '':
@@ -1980,28 +1986,20 @@ def platform_wordsize_qualify( name, suff ):
basepath = qualify(name, suff)
- fns = [ lambda x: x + '-' + config.compiler_type,
- lambda x: x + '-' + config.compiler_maj_version,
- lambda x: x + '-ws-' + config.wordsize ]
-
- paths = [ basepath ]
- for fn in fns:
- paths = paths + map(fn, paths)
-
- paths.reverse()
-
- plat_paths = map (lambda x: x + '-' + config.platform, paths)
+ paths = [(platformSpecific, basepath + comp + vers + ws + plat)
+ for (platformSpecific, plat) in [(1, '-' + config.platform),
+ (1, '-' + config.os),
+ (0, '')]
+ for ws in ['-ws-' + config.wordsize, '']
+ for comp in ['-' + config.compiler_type, '']
+ for vers in ['-' + config.compiler_maj_version, '']]
dir = glob.glob(basepath + '*')
dir = map (lambda d: normalise_slashes_(d), dir)
- for f in plat_paths:
- if f in dir:
- return (1,f)
-
- for f in paths:
+ for (platformSpecific, f) in paths:
if f in dir:
- return (0,f)
+ return (platformSpecific,f)
return (0, basepath)
diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk
index ad794985f5..56b0284583 100644
--- a/testsuite/mk/boilerplate.mk
+++ b/testsuite/mk/boilerplate.mk
@@ -116,10 +116,6 @@ ifeq "$(shell test -x '$(HPC)' && echo exists)" ""
$(error Cannot find hpc: $(HPC))
endif
-ifeq "$(AR)" ""
-AR = ar
-endif
-
# Be careful when using this. On Windows it ends up looking like
# c:/foo/bar which confuses make, as make thinks that the : is Makefile
# syntax
@@ -149,7 +145,9 @@ $(ghc-config-mk) : $(TOP)/mk/ghc-config
$(TOP)/mk/ghc-config "$(TEST_HC)" >"$@"; if [ $$? != 0 ]; then $(RM) "$@"; exit 1; fi
# If the ghc-config fails, remove $@, and fail
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
include $(ghc-config-mk)
+endif
# -----------------------------------------------------------------------------
diff --git a/testsuite/mk/ghc-config.hs b/testsuite/mk/ghc-config.hs
index e0b8954638..a14949ee70 100644
--- a/testsuite/mk/ghc-config.hs
+++ b/testsuite/mk/ghc-config.hs
@@ -1,5 +1,6 @@
import System.Environment
import System.Process
+import Data.Maybe
main = do
[ghc] <- getArgs
@@ -14,13 +15,14 @@ main = do
info <- readProcess ghc ["--info"] ""
let fields = read info :: [(String,String)]
+
getGhcField fields "GhcStage" "Stage"
getGhcField fields "GhcWithNativeCodeGen" "Have native code generator"
getGhcField fields "GhcWithInterpreter" "Have interpreter"
getGhcField fields "GhcUnregisterised" "Unregisterised"
getGhcField fields "GhcWithSMP" "Support SMP"
getGhcField fields "GhcRTSWays" "RTS ways"
- getGhcFieldWithDefault fields "AR" "ar command" "ar"
+ getGhcFieldProgWithDefault fields "AR" "ar command" "ar"
getGhcField :: [(String,String)] -> String -> String -> IO ()
getGhcField fields mkvar key =
@@ -28,8 +30,22 @@ getGhcField fields mkvar key =
Nothing -> fail ("No field: " ++ key)
Just val -> putStrLn (mkvar ++ '=':val)
-getGhcFieldWithDefault :: [(String,String)] -> String -> String -> String -> IO ()
-getGhcFieldWithDefault fields mkvar key deflt = do
+getGhcFieldProgWithDefault :: [(String,String)]
+ -> String -> String -> String -> IO ()
+getGhcFieldProgWithDefault fields mkvar key deflt = do
case lookup key fields of
- Nothing -> putStrLn (mkvar ++ '=':deflt)
- Just val -> putStrLn (mkvar ++ '=':val)
+ Nothing -> putStrLn (mkvar ++ '=' : deflt)
+ Just val -> putStrLn (mkvar ++ '=' : fixSlashes (fixTopdir topdir val))
+ where
+ topdir = fromMaybe "" (lookup "LibDir" fields)
+
+fixTopdir :: String -> String -> String
+fixTopdir t "" = ""
+fixTopdir t ('$':'t':'o':'p':'d':'i':'r':s) = t ++ s
+fixTopdir t (c:s) = c : fixTopdir t s
+
+fixSlashes :: FilePath -> FilePath
+fixSlashes = map f
+ where f '\\' = '/'
+ f c = c
+
diff --git a/testsuite/tests/annotations/should_run/annrun01.hs b/testsuite/tests/annotations/should_run/annrun01.hs
index 691e6a36ba..d7c8e6b823 100644
--- a/testsuite/tests/annotations/should_run/annrun01.hs
+++ b/testsuite/tests/annotations/should_run/annrun01.hs
@@ -4,7 +4,7 @@ module Main where
import GHC
import MonadUtils ( liftIO )
-import DynFlags ( defaultLogAction )
+import DynFlags ( defaultLogAction, defaultFlushOut )
import Annotations ( AnnTarget(..), CoreAnnTarget )
import Serialized ( deserializeWithData )
import Panic
@@ -17,7 +17,7 @@ import Data.List
import Data.Function
main :: IO ()
-main = defaultErrorHandler defaultLogAction
+main = defaultErrorHandler defaultLogAction defaultFlushOut
$ runGhc (Just cTop) $ do
liftIO $ putStrLn "Initializing Package Database"
dflags <- getSessionDynFlags
diff --git a/testsuite/tests/cabal/cabal01/cabal01.stdout-i386-unknown-mingw32 b/testsuite/tests/cabal/cabal01/cabal01.stdout-mingw32
index 647a2324b0..647a2324b0 100644
--- a/testsuite/tests/cabal/cabal01/cabal01.stdout-i386-unknown-mingw32
+++ b/testsuite/tests/cabal/cabal01/cabal01.stdout-mingw32
diff --git a/testsuite/tests/cabal/ghcpkg03.stderr-i386-unknown-mingw32 b/testsuite/tests/cabal/ghcpkg03.stderr-mingw32
index 71ff88a16b..71ff88a16b 100644
--- a/testsuite/tests/cabal/ghcpkg03.stderr-i386-unknown-mingw32
+++ b/testsuite/tests/cabal/ghcpkg03.stderr-mingw32
diff --git a/testsuite/tests/cabal/ghcpkg05.stderr-i386-unknown-mingw32 b/testsuite/tests/cabal/ghcpkg05.stderr-mingw32
index 360783bd78..360783bd78 100644
--- a/testsuite/tests/cabal/ghcpkg05.stderr-i386-unknown-mingw32
+++ b/testsuite/tests/cabal/ghcpkg05.stderr-mingw32
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index d721f22ae0..8c9bb40972 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -295,7 +295,7 @@ test('2499', normal, compile_fail, [''])
test('mode001', normal, run_command,
['$MAKE -s --no-print-directory mode001'])
-if config.platform == 'i386-unknown-mingw32':
+if config.os == 'mingw32':
only_windows = normal
else:
only_windows = skip
diff --git a/testsuite/tests/dynlibs/Makefile b/testsuite/tests/dynlibs/Makefile
index 6d4f736983..17931d27cd 100644
--- a/testsuite/tests/dynlibs/Makefile
+++ b/testsuite/tests/dynlibs/Makefile
@@ -19,7 +19,7 @@ T4464:
$(RM) T4464H_stub.c T4464H_stub.h T4464H_stub.o
$(RM) HS4464.dll HS4464.dll.a t4464.exe
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -shared T4464H.hs T4464B.c -optc-DRTSOPTS=RtsOptsSafeOnly -o HS4464.dll
- '$(TEST_HC)' $(TEST_HC_OPTS) -v0 T4464C.c HS4464.dll.a -o t4464.exe -no-hs-main
+ '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 T4464C.c HS4464.dll.a -o t4464.exe -no-hs-main
-./t4464.exe
echo "====="
echo "=====" >&2
@@ -27,7 +27,7 @@ T4464:
$(RM) T4464H_stub.c T4464H_stub.h T4464H_stub.o
$(RM) HS4464.dll HS4464.dll.a t4464.exe
'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -shared T4464H.hs T4464B.c -optc-DRTSOPTS=RtsOptsAll -o HS4464.dll
- '$(TEST_HC)' $(TEST_HC_OPTS) -v0 T4464C.c HS4464.dll.a -o t4464.exe -no-hs-main
+ '$(TEST_HC)' $(filter-out -rtsopts,$(TEST_HC_OPTS)) -v0 T4464C.c HS4464.dll.a -o t4464.exe -no-hs-main
./t4464.exe
.PHONY: T5373
diff --git a/testsuite/tests/ffi/should_run/4038.hs b/testsuite/tests/ffi/should_run/4038.hs
index 9250fb9082..621168773a 100644
--- a/testsuite/tests/ffi/should_run/4038.hs
+++ b/testsuite/tests/ffi/should_run/4038.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE ForeignFunctionInterface, CPP #-}
import Foreign
import Foreign.C
@@ -21,7 +21,7 @@ foreign import ccall "dynamic" f_io :: FunPtr IOF -> IOF
--
-- On *nix systems, the C stack size can be examined and changed by
-- the "ulimit -s" command.
---
+
n = 300
f :: Int -> IO Int
diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T
index 30eba8ee0e..15aa90a3c9 100644
--- a/testsuite/tests/ffi/should_run/all.T
+++ b/testsuite/tests/ffi/should_run/all.T
@@ -81,7 +81,7 @@ test('ffi011', normal, compile_and_run, [''])
# because it's difficult to discover whether a given Linux supports
# it.
-if config.platform == 'i386-unknown-mingw32':
+if config.os == 'mingw32':
skip_if_not_windows = normal
else:
skip_if_not_windows = skip
@@ -161,7 +161,7 @@ test('ffi021', normal, compile_and_run, [''])
test('ffi022', normal, compile_and_run, [''])
-if config.platform == 'i386-unknown-mingw32':
+if config.os == 'mingw32':
# This test needs a larger C stack than we get by default on Windows
flagsFor4038 = ['-optl-Wl,--stack,10485760']
else:
diff --git a/testsuite/tests/ffi/should_run/capi_value_c.c b/testsuite/tests/ffi/should_run/capi_value_c.c
index 45db07c6a0..5d37a7fcc2 100644
--- a/testsuite/tests/ffi/should_run/capi_value_c.c
+++ b/testsuite/tests/ffi/should_run/capi_value_c.c
@@ -1,4 +1,4 @@
#include "capi_value_c.h"
-const int i = 23;
+int i = 23;
diff --git a/testsuite/tests/ffi/should_run/capi_value_c.h b/testsuite/tests/ffi/should_run/capi_value_c.h
index d8ef814216..cec1863e99 100644
--- a/testsuite/tests/ffi/should_run/capi_value_c.h
+++ b/testsuite/tests/ffi/should_run/capi_value_c.h
@@ -1,3 +1,3 @@
-const int i;
+extern int i;
#define j 24
diff --git a/testsuite/tests/ghci/linking/Makefile b/testsuite/tests/ghci/linking/Makefile
index 4791712eb7..fe34e6372b 100644
--- a/testsuite/tests/ghci/linking/Makefile
+++ b/testsuite/tests/ghci/linking/Makefile
@@ -12,7 +12,7 @@ ghcilink001 :
$(RM) -rf dir001
mkdir dir001
"$(TEST_HC)" -c f.c -o dir001/foo.o
- $(AR) cqs dir001/libfoo.a dir001/foo.o
+ "$(AR)" cqs dir001/libfoo.a dir001/foo.o
echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -Ldir001 -lfoo TestLink.hs
# Test 2: ghci -Ldir -lfoo
@@ -57,16 +57,16 @@ ghcilink004 :
mkdir dir004
#
rm -f $(PKG004)
- echo "name: test" >>$(PKG004)
- echo "version: 1.0" >>$(PKG004)
- echo "id: test-XXX" >>$(PKG004)
- echo "library-dirs: `pwd`/dir004" >>$(PKG004)
- echo "extra-libraries: foo" >>$(PKG004)
- echo "[]" >$(LOCAL_PKGCONF004)
+ echo 'name: test' >>$(PKG004)
+ echo 'version: 1.0' >>$(PKG004)
+ echo 'id: test-XXX' >>$(PKG004)
+ echo 'library-dirs: $${pkgroot}' >>$(PKG004)
+ echo 'extra-libraries: foo' >>$(PKG004)
+ echo '[]' >$(LOCAL_PKGCONF004)
'$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF004) register $(PKG004) -v0
#
"$(TEST_HC)" -c f.c -o dir004/foo.o
- $(AR) cqs dir004/libfoo.a dir004/foo.o
+ "$(AR)" cqs dir004/libfoo.a dir004/foo.o
echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -package-conf $(LOCAL_PKGCONF004) -package test TestLink.hs
@@ -85,12 +85,12 @@ ghcilink005 :
mkdir dir005
#
rm -f $(PKG005)
- echo "name: test" >>$(PKG005)
- echo "version: 1.0" >>$(PKG005)
- echo "id: test-XXX" >>$(PKG005)
- echo "library-dirs: `pwd`/dir005" >>$(PKG005)
- echo "extra-libraries: foo" >>$(PKG005)
- echo "[]" >$(LOCAL_PKGCONF005)
+ echo 'name: test' >>$(PKG005)
+ echo 'version: 1.0' >>$(PKG005)
+ echo 'id: test-XXX' >>$(PKG005)
+ echo 'library-dirs: $${pkgroot}' >>$(PKG005)
+ echo 'extra-libraries: foo' >>$(PKG005)
+ echo '[]' >$(LOCAL_PKGCONF005)
'$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF005) register $(PKG005) -v0
#
"$(TEST_HC)" -c -dynamic f.c -o dir005/foo.o
diff --git a/testsuite/tests/ghci/linking/ghcilink002.stderr-i386-unknown-mingw32 b/testsuite/tests/ghci/linking/ghcilink002.stderr-mingw32
index c0649dab12..c0649dab12 100644
--- a/testsuite/tests/ghci/linking/ghcilink002.stderr-i386-unknown-mingw32
+++ b/testsuite/tests/ghci/linking/ghcilink002.stderr-mingw32
diff --git a/testsuite/tests/ghci/linking/ghcilink005.stderr-i386-unknown-mingw32 b/testsuite/tests/ghci/linking/ghcilink005.stderr-mingw32
index 7929095d94..7929095d94 100644
--- a/testsuite/tests/ghci/linking/ghcilink005.stderr-i386-unknown-mingw32
+++ b/testsuite/tests/ghci/linking/ghcilink005.stderr-mingw32
diff --git a/testsuite/tests/ghci/scripts/6007.script b/testsuite/tests/ghci/scripts/6007.script
deleted file mode 100644
index 6d63dc5867..0000000000
--- a/testsuite/tests/ghci/scripts/6007.script
+++ /dev/null
@@ -1,2 +0,0 @@
-import System.IO (does_not_exist)
-import Data.Maybe
diff --git a/testsuite/tests/ghci/scripts/T6007.stderr b/testsuite/tests/ghci/scripts/T6007.stderr
new file mode 100644
index 0000000000..b461ef19bf
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T6007.stderr
@@ -0,0 +1,6 @@
+
+<interactive>:1:19:
+ Module `System.IO' does not export `does_not_exist'
+
+<interactive>:1:20:
+ Module `Data.Maybe' does not export `does_not_exist'
diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T
index 89347ebc85..527461af2c 100644
--- a/testsuite/tests/ghci/should_run/all.T
+++ b/testsuite/tests/ghci/should_run/all.T
@@ -12,7 +12,7 @@ test('2589', just_ghci, compile_and_run, [''])
test('2881', just_ghci, compile_and_run, [''])
test('3171',
- [if_platform('i386-unknown-mingw32',skip),
+ [if_os('mingw32',skip),
req_interp,
combined_output],
run_command,
diff --git a/testsuite/tests/hsc2hs/all.T b/testsuite/tests/hsc2hs/all.T
index c0cd3bc125..b358dc409a 100644
--- a/testsuite/tests/hsc2hs/all.T
+++ b/testsuite/tests/hsc2hs/all.T
@@ -21,8 +21,7 @@ test('hsc2hs004',
test('3837',
- [extra_clean(['3837.hs', '3837_hsc_make.c']),
- if_platform('i386-unknown-mingw32', expect_broken(3929))],
+ [extra_clean(['3837.hs', '3837_hsc_make.c'])],
run_command,
['$MAKE -s --no-print-directory 3837'])
diff --git a/testsuite/tests/lib/win32/Makefile b/testsuite/tests/lib/win32/Makefile
deleted file mode 100644
index 66afc12be9..0000000000
--- a/testsuite/tests/lib/win32/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/win32/all.T b/testsuite/tests/lib/win32/all.T
deleted file mode 100644
index 1e9378a5e6..0000000000
--- a/testsuite/tests/lib/win32/all.T
+++ /dev/null
@@ -1,10 +0,0 @@
-def win_only(opts):
- if config.platform != "i386-unknown-mingw32" and \
- config.platform != "i386-unknown-cygwin32":
- opts.skip = 1
-
-# This isn't a very good test to run automatically at the moment, since
-# it doesn't terminate
-test('win32001', skip, compile_and_run, ['-package lang -package win32'])
-
-test('win32002', win_only, compile_and_run, ['-package Win32'])
diff --git a/testsuite/tests/lib/win32/win32001.hs b/testsuite/tests/lib/win32/win32001.hs
deleted file mode 100644
index 8765dcb0fd..0000000000
--- a/testsuite/tests/lib/win32/win32001.hs
+++ /dev/null
@@ -1,104 +0,0 @@
--- Haskell version of "Hello, World" using the Win32 library.
--- Demonstrates how the Win32 library can be put to use.
--- (c) sof 1999
-
-
-module Main(main) where
-
-import qualified Win32
-import Addr
-
--- Toplevel main just creates a window and pumps messages.
--- The window procedure (wndProc) we pass in is partially
--- applied with the user action that takes care of responding
--- to repaint messages (WM_PAINT).
-
-main :: IO ()
-main = do
- lpps <- Win32.malloc Win32.sizeofPAINTSTRUCT
- hwnd <- createWindow 200 200 (wndProc lpps onPaint)
- messagePump hwnd
-
--- OnPaint handler for a window - draw a string centred
--- inside it.
-onPaint :: Win32.RECT -> Win32.HDC -> IO ()
-onPaint (_,_,w,h) hdc = do
- Win32.setBkMode hdc Win32.tRANSPARENT
- Win32.setTextColor hdc (Win32.rgb 255 255 0)
- let y | h==10 = 0
- | otherwise = ((h-10) `div` 2)
- x | w==50 = 0
- | otherwise = (w-50) `div` 2
- Win32.textOut hdc x y "Hello, world"
- return ()
-
--- Simple window procedure - one way to improve and generalise
--- it would be to pass it a message map (represented as a
--- finite map from WindowMessages to actions, perhaps).
-
-wndProc :: Win32.LPPAINTSTRUCT
- -> (Win32.RECT -> Win32.HDC -> IO ()) -- on paint action
- -> Win32.HWND
- -> Win32.WindowMessage
- -> Win32.WPARAM
- -> Win32.LPARAM
- -> IO Win32.LRESULT
-wndProc lpps onPaint hwnd wmsg wParam lParam
- | wmsg == Win32.wM_DESTROY = do
- Win32.sendMessage hwnd Win32.wM_QUIT 1 0
- return 0
- | wmsg == Win32.wM_PAINT && hwnd /= nullAddr = do
- r <- Win32.getClientRect hwnd
- paintWith lpps hwnd (onPaint r)
- return 0
- | otherwise =
- Win32.defWindowProc (Just hwnd) wmsg wParam lParam
-
-createWindow :: Int -> Int -> Win32.WindowClosure -> IO Win32.HWND
-createWindow width height wndProc = do
- let winClass = Win32.mkClassName "Hello"
- icon <- Win32.loadIcon Nothing Win32.iDI_APPLICATION
- cursor <- Win32.loadCursor Nothing Win32.iDC_ARROW
- bgBrush <- Win32.createSolidBrush (Win32.rgb 0 0 255)
- mainInstance <- Win32.getModuleHandle Nothing
- Win32.registerClass
- ( Win32.cS_VREDRAW + Win32.cS_HREDRAW
- , mainInstance
- , Just icon
- , Just cursor
- , Just bgBrush
- , Nothing
- , winClass
- )
- w <- Win32.createWindow
- winClass
- "Hello, World example"
- Win32.wS_OVERLAPPEDWINDOW
- Nothing Nothing -- leave it to the shell to decide the position
- -- at where to put the window initially
- (Just width)
- (Just height)
- Nothing -- no parent, i.e, root window is the parent.
- Nothing -- no menu handle
- mainInstance
- wndProc
- Win32.showWindow w Win32.sW_SHOWNORMAL
- Win32.updateWindow w
- return w
-
-messagePump :: Win32.HWND -> IO ()
-messagePump hwnd = do
- msg <- Win32.getMessage (Just hwnd) `catch` \ _ -> return nullAddr
- if msg == nullAddr then
- return ()
- else do
- Win32.translateMessage msg
- Win32.dispatchMessage msg
- messagePump hwnd
-
-paintWith :: Win32.LPPAINTSTRUCT -> Win32.HWND -> (Win32.HDC -> IO a) -> IO a
-paintWith lpps hwnd p = do
- hdc <- Win32.beginPaint hwnd lpps
- a <- p hdc
- Win32.endPaint hwnd lpps
- return a
diff --git a/testsuite/tests/lib/win32/win32002.hs b/testsuite/tests/lib/win32/win32002.hs
deleted file mode 100644
index 0b57985333..0000000000
--- a/testsuite/tests/lib/win32/win32002.hs
+++ /dev/null
@@ -1,19 +0,0 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
--- Test that the Win32 error code from getLastError is thread-local.
-
-import System.Win32
-import Control.Monad
-import Control.Concurrent
-
-main = do
- setLastError 42
- r <- getLastError
- when (r /= 42) $ fail ("wrong: " ++ show r)
- m <- newEmptyMVar
- forkIO $ do setLastError 43; putMVar m ()
- takeMVar m
- r <- getLastError
- when (r /= 42) $ fail ("wrong: " ++ show r)
-
-foreign import stdcall unsafe "windows.h SetLastError"
- setLastError :: ErrCode -> IO ()
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index b3f408cb10..373fc5d0ee 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -93,7 +93,7 @@ test('T4801',
if_wordsize(32,
compiler_stats_range_field('peak_megabytes_allocated', 30, 10)),
if_wordsize(64, # sample from (amd64/Linux):
- compiler_stats_range_field('peak_megabytes_allocated', 47, 10)),
+ compiler_stats_range_field('peak_megabytes_allocated', 50, 20)),
# expected value: 58 (amd64/OS X):
if_platform('x86_64-apple-darwin',
compiler_stats_num_field('peak_megabytes_allocated', 56, 60)),
@@ -128,24 +128,23 @@ test('T3064',
[# expect_broken( 3064 ),
# expected value: 9 (x86/Linux 30-03-2011):
if_wordsize(32,
- compiler_stats_num_field('peak_megabytes_allocated', 7, 12)),
+ compiler_stats_range_field('peak_megabytes_allocated', 10, 14)),
# expected value: 18 (amd64/Linux):
if_wordsize(64,
- compiler_stats_num_field('peak_megabytes_allocated', 30, 38)),
+ compiler_stats_num_field('peak_megabytes_allocated', 20, 28)),
# expected value: 56380288 (x86/Linux) (28/6/2011)
if_wordsize(32,
- compiler_stats_range_field('bytes allocated', 39800820, 10)),
+ compiler_stats_range_field('bytes allocated', 124952112, 10)),
# expected value: 73259544 (amd64/Linux) (28/6/2011):
if_wordsize(64,
compiler_stats_num_field('bytes allocated', 200000000,
280000000)),
# expected value: 2247016 (x86/Linux) (28/6/2011):
if_wordsize(32,
- compiler_stats_num_field('max_bytes_used', 2000000,
- 3000000)),
+ compiler_stats_range_field('max_bytes_used', 5511604, 10)),
# expected value: 4032024 (amd64/Linux, intree) (28/6/2011):
if_wordsize(64,
- compiler_stats_num_field('max_bytes_used', 10000000,
+ compiler_stats_num_field('max_bytes_used', 8000000,
14000000)),
only_ways(['normal'])
],
@@ -158,9 +157,10 @@ test('T4007',
['$MAKE -s --no-print-directory T4007'])
test('T5030',
- [# expected value: 449368924 (x86/Linux)
+ [expect_broken(5030),
+ # expected value: 449368924 (x86/Linux)
if_wordsize(32,
- compiler_stats_range_field('bytes allocated', 176193448, 10)),
+ compiler_stats_range_field('bytes allocated', 196457520, 10)),
# expected value: 346750856 (amd64/Linux):
if_wordsize(64,
compiler_stats_num_field('bytes allocated', 300000000,
@@ -185,8 +185,7 @@ test('T5631',
test('parsing001',
[# expected value: ?
if_wordsize(32,
- compiler_stats_num_field('bytes allocated', 280000000,
- 320000000)),
+ compiler_stats_range_field('bytes allocated', 274000576, 10)),
# expected value: 587079016 (amd64/Linux):
if_wordsize(64,
compiler_stats_num_field('bytes allocated', 540000000,
@@ -212,8 +211,7 @@ test('T5321Fun',
[ only_ways(['normal']), # no optimisation for this one
# sample from x86/Linux
if_wordsize(32,
- compiler_stats_range_field('bytes allocated', 341591280, 10)),
- # expected value: 669165280 (amd64/Linux):
+ compiler_stats_range_field('bytes allocated', 296657384, 10)),
if_wordsize(64,
compiler_stats_range_field('bytes allocated', 585521080, 10))
],
@@ -223,8 +221,7 @@ test('T5321FD',
[ only_ways(['normal']), # no optimisation for this one
# sample from x86/Linux
if_wordsize(32,
- compiler_stats_range_field('bytes allocated', 257175456, 10)),
- # expected value: 500642456 (amd64/Linux):
+ compiler_stats_range_field('bytes allocated', 213380256, 10)),
if_wordsize(64,
compiler_stats_range_field('bytes allocated', 418306336, 10))
],
@@ -233,9 +230,7 @@ test('T5321FD',
test('T5642',
[ only_ways(['normal']),
if_wordsize(32, # sample from x86/Linux
- compiler_stats_range_field('bytes allocated', 1893427932, 10)),
-
- # sample: 3926235424 (amd64/Linux, 15/2/2012)
+ compiler_stats_range_field('bytes allocated', 1682508520, 10)),
if_wordsize(64,
compiler_stats_range_field('bytes allocated', 3361296144, 10))
],
diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile
index 8edee2305e..7506f9368e 100644
--- a/testsuite/tests/plugins/Makefile
+++ b/testsuite/tests/plugins/Makefile
@@ -12,7 +12,7 @@ plugins01:
#
# Suggestions to make this better gratefully recieved.
(cd simple-plugin; make package)
- @$(RM) plugins01.hi plugins01.o
+ $(RM) plugins01.hi plugins01.o
"$(TEST_HC)" $(HC_OPTS) --make -v0 plugins01.hs -package-conf simple-plugin/local.package.conf -fplugin Simple.Plugin -fplugin-opt Simple.Plugin:Irrelevant_Option -package simple-plugin
./plugins01
diff --git a/testsuite/tests/polykinds/Makefile b/testsuite/tests/polykinds/Makefile
index 9f3fb669b3..4ac688d458 100644
--- a/testsuite/tests/polykinds/Makefile
+++ b/testsuite/tests/polykinds/Makefile
@@ -9,9 +9,15 @@ T5881:
'$(TEST_HC)' $(TEST_HC_OPTS) -c T5881a.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -c T5881.hs
-# T6025 is like T5881; needs separat compile
+# T6025 is like T5881; needs separate compile
T6025:
$(RM) -f T6025.hi T6025.o T6025a.hi T6025a.o
'$(TEST_HC)' $(TEST_HC_OPTS) -c T6025a.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -c T6025.hs
+# T6054 is like T5881; needs separate compile
+# The second compile fails, and should do so, hence leading "-"
+T6054:
+ $(RM) -f T6054.hi T6054.o T6054a.hi T6054a.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c T6054a.hs
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -c T6054.hs
diff --git a/testsuite/tests/polykinds/T6054.hs b/testsuite/tests/polykinds/T6054.hs
new file mode 100644
index 0000000000..f1801ab26c
--- /dev/null
+++ b/testsuite/tests/polykinds/T6054.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE FlexibleContexts, DataKinds #-}
+
+module T6054 where
+
+import T6054a
+
+foo = print (Proxy :: Bar '() a => Proxy a)
diff --git a/testsuite/tests/polykinds/T6054.stderr b/testsuite/tests/polykinds/T6054.stderr
new file mode 100644
index 0000000000..9b190ce4d8
--- /dev/null
+++ b/testsuite/tests/polykinds/T6054.stderr
@@ -0,0 +1,10 @@
+
+T6054.hs:7:14:
+ No instance for (Bar () '() a0)
+ arising from an expression type signature
+ Possible fix: add an instance declaration for (Bar () '() a0)
+ In the first argument of `print', namely
+ `(Proxy :: Bar () a => Proxy a)'
+ In the expression: print (Proxy :: Bar () a => Proxy a)
+ In an equation for `foo':
+ foo = print (Proxy :: Bar () a => Proxy a)
diff --git a/testsuite/tests/polykinds/T6054a.hs b/testsuite/tests/polykinds/T6054a.hs
new file mode 100644
index 0000000000..5b1077f0da
--- /dev/null
+++ b/testsuite/tests/polykinds/T6054a.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE PolyKinds, FunctionalDependencies, KindSignatures, MultiParamTypeClasses, DataKinds #-}
+
+module T6054a where
+
+class Bar a (p :: Bool) | a -> p
+data Proxy a = Proxy deriving Show
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 5f136b16b9..3e026da116 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -43,3 +43,4 @@ test('T6039', normal, compile_fail, [''])
test('T6021', normal, compile_fail, [''])
test('T6020a', normal, compile, [''])
test('T6044', normal, compile, [''])
+test('T6054', normal, run_command, ['$MAKE -s --no-print-directory T6054'])
diff --git a/testsuite/tests/rename/should_fail/T6060.hs b/testsuite/tests/rename/should_fail/T6060.hs
new file mode 100644
index 0000000000..c323835c22
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T6060.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ParallelListComp #-}
+
+module T6060 where
+
+foo = do let bad = [True | x <- [] | y <- []]
diff --git a/testsuite/tests/rename/should_fail/T6060.stderr b/testsuite/tests/rename/should_fail/T6060.stderr
new file mode 100644
index 0000000000..3d381cb184
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T6060.stderr
@@ -0,0 +1,4 @@
+
+T6060.hs:5:10:
+ The last statement in a 'do' block must be an expression
+ let bad = [True | x <- [] | y <- []]
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index a512d196d7..383a4d72ee 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -102,3 +102,4 @@ test('T5745',
test('T5892a', normal, compile_fail, [''])
test('T5892b', normal, compile_fail, [''])
test('T5951', normal, compile_fail, [''])
+test('T6060', normal, compile_fail, [''])
diff --git a/testsuite/tests/rts/T6006.stdout-mingw32 b/testsuite/tests/rts/T6006.stdout-mingw32
new file mode 100644
index 0000000000..42e57fde57
--- /dev/null
+++ b/testsuite/tests/rts/T6006.stdout-mingw32
@@ -0,0 +1,2 @@
+"T6006.exe"
+[]
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index 90953e1d76..6f42d2f2df 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -9,6 +9,7 @@ test('testblockalloc', compose(c_src,
test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
test('derefnull',
composes([
+ if_platform('x86_64-unknown-mingw32', expect_broken(6079)),
# LLVM Optimiser considers dereference of a null pointer
# undefined and marks the code as unreachable which means
# that later optimisations remove it altogether.
@@ -22,17 +23,18 @@ test('derefnull',
# SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
if_platform('i386-apple-darwin', exit_code(138)),
if_platform('powerpc-apple-darwin', exit_code(138)),
- if_platform('i386-unknown-mingw32', exit_code(1))]),
+ if_os('mingw32', exit_code(1))]),
compile_and_run, [''])
test('divbyzero',
composes([
+ if_platform('x86_64-unknown-mingw32', expect_broken(6079)),
# SIGFPE on Linux
exit_code(136),
# Apparently the output can be different on different
# Linux setups, so just ignore it. As long as we get
# the right exit code we're OK.
if_os('linux', ignore_output),
- if_platform('i386-unknown-mingw32', exit_code(1))]),
+ if_os('mingw32', exit_code(1))]),
compile_and_run, [''])
test('outofmem', if_os('darwin', skip),
@@ -78,7 +80,7 @@ test('rtsflags002', [ only_ways(['normal']) ], compile_and_run, ['-with-rtsopts=
# Test to see if linker scripts link properly to real ELF files
test('T2615',
- [ if_platform('i386-unknown-mingw32',skip),
+ [ if_os('mingw32', skip),
# OS X doesn't seem to support linker scripts
if_os('darwin', skip),
# Solaris' linker does not support GNUish linker scripts
@@ -103,7 +105,7 @@ test('T4059',
# Test for #4274
test('exec_signals', [
- if_platform('i386-unknown-mingw32',skip),
+ if_os('mingw32', skip),
cmd_prefix('$MAKE exec_signals-prep && ./exec_signals_prepare'),
extra_clean(['exec_signals_child', 'exec_signals_prepare'])
], compile_and_run, [''])
@@ -120,6 +122,8 @@ def config_5250(opts):
test('5250', [ config_5250,
# stack ptr is not 16-byte aligned on 32-bit Windows
if_platform('i386-unknown-mingw32', expect_fail),
+ if_platform('i386-unknown-linux',
+ expect_broken_for(4211,['llvm'])),
extra_clean(['spalign.o']),
omit_ways(['ghci']) ],
compile_and_run, ['spalign.c'])
@@ -131,7 +135,7 @@ test('T5423',
test('5993', extra_run_opts('+RTS -k8 -RTS'), compile_and_run, [''])
-test('T6006', [ omit_ways(['ghci']),
+test('T6006', [ omit_ways(prof_ways + ['ghci']),
extra_clean(['T6006_c.o']),
compile_cmd_prefix('$MAKE T6006_setup && ') ],
# The T6006_setup hack is to ensure that we generate
diff --git a/testsuite/tests/rts/outofmem.stderr-x86_64-unknown-mingw32 b/testsuite/tests/rts/outofmem.stderr-x86_64-unknown-mingw32
new file mode 100644
index 0000000000..78429713e4
--- /dev/null
+++ b/testsuite/tests/rts/outofmem.stderr-x86_64-unknown-mingw32
@@ -0,0 +1 @@
+outofmem.exe: getMBlocks: VirtualAlloc MEM_COMMIT failed: The paging file is too small for this operation to complete.
diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
index ea9921d88f..f2c66331f5 100644
--- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr
+++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
@@ -1,6 +1,6 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 139, types: 54, coercions: 2}
+Result size of Tidy Core = {terms: 140, types: 55, coercions: 0}
Roman.foo3 :: GHC.Types.Int
[GblId, Str=DmdType b]
@@ -52,10 +52,7 @@ Roman.$wgo =
\ (w :: Data.Maybe.Maybe GHC.Types.Int)
(w1 :: Data.Maybe.Maybe GHC.Types.Int) ->
case w1 of _ {
- Data.Maybe.Nothing ->
- Roman.foo3
- `cast` (UnsafeCo GHC.Types.Int GHC.Prim.Int#
- :: GHC.Types.Int ~# GHC.Prim.Int#);
+ Data.Maybe.Nothing -> case Roman.foo3 of wild1 { };
Data.Maybe.Just x ->
case x of _ { GHC.Types.I# ipv ->
let {
diff --git a/testsuite/tests/typecheck/should_compile/T6055.hs b/testsuite/tests/typecheck/should_compile/T6055.hs
new file mode 100644
index 0000000000..beede55139
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T6055.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE FunctionalDependencies #-}
+{-# LANGUAGE EmptyDataDecls #-}
+module T6055 where
+
+data Int1 = Int1
+data Word1 = Word1
+
+data D1
+data D2
+
+
+class Succ x y | x -> y
+instance Succ D1 D2
+
+
+class Add' x y z | x y -> z
+
+instance Succ y z => Add' D1 y z
+
+
+class (Add' x y z) => Add x y z
+instance (Add' D1 y z) => Add D1 y z
+
+
+class IsSized a s | a -> s where
+
+instance IsSized Int1 D1
+instance IsSized Word1 D1
+
+instance (IsSized a s, Add s s ns) =>
+ IsSized (Pair a) ns where
+
+data Pair a = Pair a a
+
+
+switchFPPred ::
+ (IsSized v0 s, IsSized v1 s) =>
+ v0 -> v1
+switchFPPred = undefined
+
+cmpss :: Pair Word1 -> Pair Int1
+cmpss = switchFPPred
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index bccb1fa550..58664a4d51 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -378,3 +378,4 @@ test('T5792',normal,run_command,
test('PolytypeDecomp', normal, compile, [''])
test('T6011', normal, compile, [''])
+test('T6055', normal, compile, [''])
diff --git a/testsuite/tests/typecheck/should_fail/T6078.hs b/testsuite/tests/typecheck/should_fail/T6078.hs
new file mode 100644
index 0000000000..4addabe8af
--- /dev/null
+++ b/testsuite/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/testsuite/tests/typecheck/should_fail/T6078.stderr b/testsuite/tests/typecheck/should_fail/T6078.stderr
new file mode 100644
index 0000000000..7690ecd9c6
--- /dev/null
+++ b/testsuite/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/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index e9d27ec88a..e27d0ccaa0 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/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, [''])