Commit 9a43b2c1 authored by Edward Z. Yang's avatar Edward Z. Yang

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: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: bgamari, thomie

Differential Revision: https://phabricator.haskell.org/D880

GHC Trac Issues: #10384
parent eb0ed403
......@@ -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]
......
{-# LANGUAGE TemplateHaskell, RankNTypes, ScopedTypeVariables #-}
module A where
x = \(y :: forall a. a -> a) -> [|| y ||]
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 ||]
......@@ -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, [''])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment