[commit: ghc] master: Always do polymorphic typed quote check, c.f. #10384 (9a43b2c)
git at git.haskell.org
git at git.haskell.org
Sat May 9 08:25:24 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/9a43b2c1f78b3cf684646af64b9b67dc8079f58f/ghc
>---------------------------------------------------------------
commit 9a43b2c1f78b3cf684646af64b9b67dc8079f58f
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date: Tue May 5 10:53:00 2015 -0700
Always do polymorphic typed quote check, c.f. #10384
Summary:
Since quotes are enabled in stage1, we need to do the
staging check. This also "fixes" #10384 by adding
a test for the polymorphic local variable test.
Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin
Subscribers: bgamari, thomie
Differential Revision: https://phabricator.haskell.org/D880
GHC Trac Issues: #10384
>---------------------------------------------------------------
9a43b2c1f78b3cf684646af64b9b67dc8079f58f
compiler/typecheck/TcExpr.hs | 10 ----------
testsuite/tests/quotes/T10384.hs | 3 +++
testsuite/tests/quotes/T10384.stderr | 6 ++++++
testsuite/tests/quotes/all.T | 1 +
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs
index 353b2b7..155cdb4 100644
--- a/compiler/typecheck/TcExpr.hs
+++ b/compiler/typecheck/TcExpr.hs
@@ -16,9 +16,7 @@ module TcExpr ( tcPolyExpr, tcPolyExprNC, tcMonoExpr, tcMonoExprNC,
#include "HsVersions.h"
import {-# SOURCE #-} TcSplice( tcSpliceExpr, tcTypedBracket, tcUntypedBracket )
-#ifdef GHCI
import DsMeta( liftStringName, liftName )
-#endif
import HsSyn
import TcHsSyn
@@ -1234,13 +1232,6 @@ tcTagToEnum loc fun_name arg res_ty
-}
checkThLocalId :: Id -> TcM ()
-#ifndef GHCI /* GHCI and TH is off */
---------------------------------------
--- Check for cross-stage lifting
-checkThLocalId _id
- = return ()
-
-#else /* GHCI and TH is on */
checkThLocalId id
= do { mb_local_use <- getStageAndBindLevel (idName id)
; case mb_local_use of
@@ -1303,7 +1294,6 @@ checkCrossStageLifting _ _ = return ()
polySpliceErr :: Id -> SDoc
polySpliceErr id
= ptext (sLit "Can't splice the polymorphic local variable") <+> quotes (ppr id)
-#endif /* GHCI */
{-
Note [Lifting strings]
diff --git a/testsuite/tests/quotes/T10384.hs b/testsuite/tests/quotes/T10384.hs
new file mode 100644
index 0000000..773deb0
--- /dev/null
+++ b/testsuite/tests/quotes/T10384.hs
@@ -0,0 +1,3 @@
+{-# LANGUAGE TemplateHaskell, RankNTypes, ScopedTypeVariables #-}
+module A where
+x = \(y :: forall a. a -> a) -> [|| y ||]
diff --git a/testsuite/tests/quotes/T10384.stderr b/testsuite/tests/quotes/T10384.stderr
new file mode 100644
index 0000000..f2360fd
--- /dev/null
+++ b/testsuite/tests/quotes/T10384.stderr
@@ -0,0 +1,6 @@
+
+T10384.hs:3:37: error:
+ Can't splice the polymorphic local variable ‘y’
+ In the Template Haskell quotation [|| y ||]
+ In the expression: [|| y ||]
+ In the expression: \ (y :: forall a. a -> a) -> [|| y ||]
diff --git a/testsuite/tests/quotes/all.T b/testsuite/tests/quotes/all.T
index a3dfb8b..a56a50c 100644
--- a/testsuite/tests/quotes/all.T
+++ b/testsuite/tests/quotes/all.T
@@ -15,6 +15,7 @@ test('T8455', normal, compile, ['-v0'])
test('T8633', normal, compile_and_run, [''])
test('T8759a', normal, compile_fail, ['-v0'])
test('T9824', normal, compile, ['-v0'])
+test('T10384', normal, compile_fail, [''])
test('TH_tf2', normal, compile, ['-v0'])
test('TH_ppr1', normal, compile_and_run, [''])
More information about the ghc-commits
mailing list