Allow typed holes to be levity-polymorphic
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Aug 2016 16:24:10 +0000 (17:24 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Aug 2016 16:35:38 +0000 (17:35 +0100)
This one-line change fixes Trac #12531.  Hooray.

Simple, non-invasive; can merge to 8.0.2

compiler/typecheck/TcExpr.hs
testsuite/tests/partial-sigs/should_compile/12531.stderr [new file with mode: 0644]
testsuite/tests/partial-sigs/should_compile/T12531.hs [new file with mode: 0644]
testsuite/tests/partial-sigs/should_compile/all.T

index dc1a90f..8ae454c 100644 (file)
@@ -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 (file)
index 0000000..0519ecb
--- /dev/null
@@ -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 (file)
index 0000000..2488db2
--- /dev/null
@@ -0,0 +1,6 @@
+{-# LANGUAGE MagicHash #-}
+
+module T12531 where
+import GHC.Exts
+
+f x = I# (_ +# x)
index 104c2ad..17c769e 100644 (file)
@@ -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'])