summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-08-26 17:24:10 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-08-26 17:35:38 +0100
commitae66f356fb0dbf79dab1074d71275904c448b329 (patch)
tree1e5a11c7c3d9fab3272a86c1eea3d7405dd2f954
parent1083f453dd296d4336899893518c65ae5113dc3e (diff)
downloadhaskell-ae66f356fb0dbf79dab1074d71275904c448b329.tar.gz
Allow typed holes to be levity-polymorphic
This one-line change fixes Trac #12531. Hooray. Simple, non-invasive; can merge to 8.0.2
-rw-r--r--compiler/typecheck/TcExpr.hs8
-rw-r--r--testsuite/tests/partial-sigs/should_compile/12531.stderr1
-rw-r--r--testsuite/tests/partial-sigs/should_compile/T12531.hs6
-rw-r--r--testsuite/tests/partial-sigs/should_compile/all.T1
4 files changed, 12 insertions, 4 deletions
diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs
index dc1a90f87f..8ae454c167 100644
--- a/compiler/typecheck/TcExpr.hs
+++ b/compiler/typecheck/TcExpr.hs
@@ -1658,16 +1658,16 @@ tc_infer_id lbl id_name
tcUnboundId :: UnboundVar -> ExpRhoType -> TcM (HsExpr TcId)
--- Typechedk an occurrence of an unbound Id
+-- Typecheck an occurrence of an unbound Id
--
--- Some of these started life as a true hole "_". Others might simply
--- be variables that accidentally have no binding site
+-- Some of these started life as a true expression hole "_".
+-- Others might simply be variables that accidentally have no binding site
--
-- We turn all of them into HsVar, since HsUnboundVar can't contain an
-- Id; and indeed the evidence for the CHoleCan does bind it, so it's
-- not unbound any more!
tcUnboundId unbound res_ty
- = do { ty <- newFlexiTyVarTy liftedTypeKind
+ = do { ty <- newOpenFlexiTyVarTy -- Allow Int# etc (Trac #12531)
; let occ = unboundVarOcc unbound
; name <- newSysName occ
; let ev = mkLocalId name ty
diff --git a/testsuite/tests/partial-sigs/should_compile/12531.stderr b/testsuite/tests/partial-sigs/should_compile/12531.stderr
new file mode 100644
index 0000000000..0519ecba6e
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/12531.stderr
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/testsuite/tests/partial-sigs/should_compile/T12531.hs b/testsuite/tests/partial-sigs/should_compile/T12531.hs
new file mode 100644
index 0000000000..2488db2cf7
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/T12531.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE MagicHash #-}
+
+module T12531 where
+import GHC.Exts
+
+f x = I# (_ +# x)
diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T
index 104c2ad5c6..17c769e653 100644
--- a/testsuite/tests/partial-sigs/should_compile/all.T
+++ b/testsuite/tests/partial-sigs/should_compile/all.T
@@ -65,3 +65,4 @@ test('T12033', normal, compile, [''])
test('T11339a', normal, compile, [''])
test('T11670', normal, compile, [''])
test('T12156', normal, compile_fail, ['-fdefer-typed-holes'])
+test('T12531', normal, compile, ['-fdefer-typed-holes'])