Commit 21c72e7d authored by Edward Z. Yang's avatar Edward Z. Yang

Split off quotes/ from th/ for tests that can be done on stage1 compiler.

Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: run these tests with stage1

Reviewers: simonpj, austin

Subscribers: bgamari, thomie

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

GHC Trac Issues: #10382
parent 28257cae
T3572
T8633
TH_ppr1
TH_spliceViewPat/TH_spliceViewPat
TOP=../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
{-# LANGUAGE TemplateHaskell #-}
-- Trac #2632
module MkData where
......
{-# LANGUAGE TemplateHaskell #-}
-- Trac #2931
module Foo where
a = 1
-- NB: no newline after the 'a'!
b = 'a
\ No newline at end of file
b = 'a
{-# LANGUAGE TemplateHaskell, TypeFamilies, RankNTypes, FlexibleContexts #-}
{-# LANGUAGE TypeFamilies, RankNTypes, FlexibleContexts #-}
module T4056 where
import Language.Haskell.TH
......
{-# LANGUAGE TemplateHaskell #-}
-- Crashed GHC 6.12
module T4165 where
......
{-# LANGUAGE TemplateHaskell #-}
module T4170 where
import Language.Haskell.TH
......
{-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-}
{-# LANGUAGE ScopedTypeVariables #-}
module T5371 where
import Language.Haskell.TH
......
{-# LANGUAGE TemplateHaskell #-}
module T6062 where
x = [| False True |]
{-# LANGUAGE DataKinds #-}
module T8455 where
ty = [t| 5 |]
module Main where
import Language.Haskell.TH.Syntax
t1 = case mkName "^.." of
Name (OccName ".") (NameQ (ModName "^")) -> error "bug0"
Name (OccName "^..") NameS -> return ()
t2 = case mkName "Control.Lens.^.." of
Name (OccName ".") (NameQ (ModName "Control.Lens.^")) -> error "bug1"
Name (OccName "^..") (NameQ (ModName "Control.Lens")) -> return ()
t3 = case mkName "Data.Bits..&." of
Name (OccName ".&.") (NameQ (ModName "Data.Bits")) -> return ()
t4 = case mkName "abcde" of
Name (OccName "abcde") NameS -> return ()
main :: IO ()
main = do t1; t2; t3; t4
\ No newline at end of file
module Main where
import Language.Haskell.TH.Syntax
t1 = case mkName "^.." of
Name (OccName ".") (NameQ (ModName "^")) -> error "bug0"
Name (OccName "^..") NameS -> return ()
t2 = case mkName "Control.Lens.^.." of
Name (OccName ".") (NameQ (ModName "Control.Lens.^")) -> error "bug1"
Name (OccName "^..") (NameQ (ModName "Control.Lens")) -> return ()
t3 = case mkName "Data.Bits..&." of
Name (OccName ".&.") (NameQ (ModName "Data.Bits")) -> return ()
t4 = case mkName "abcde" of
Name (OccName "abcde") NameS -> return ()
main :: IO ()
main = do t1; t2; t3; t4
{-# LANGUAGE TemplateHaskell, PatternSynonyms #-}
{-# LANGUAGE PatternSynonyms #-}
module T8759a where
......
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fwarn-unused-matches #-}
module T9824 where
......
-- Check that declarations in a bracket shadow the top-level
-- Check that declarations in a bracket shadow the top-level
-- declarations, rather than clashing with them.
module TH_bracket1 where
......
def f(name, opts):
opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell'
if (ghc_with_interpreter == 0):
opts.skip = 1
setTestOpts(f)
setTestOpts(only_compiler_types(['ghc']))
setTestOpts(only_ways(['normal','ghci']))
setTestOpts(when(compiler_profiled(), skip))
test('TH_spliceViewPat',
extra_clean(['Main.o', 'Main.hi', 'A.o', 'A.hi']),
......
......@@ -9,7 +9,7 @@ $( [d| class C a where
foo :: Bool -> T a |] )
$( [d| instance C Int where
data T Int = TInt Bool
data T Int = TInt Bool
foo b = TInt (b && b) |] )
$( [d| instance C Float where
......@@ -18,9 +18,9 @@ $( [d| instance C Float where
-}
class D a where
type S a
type S a
bar :: S a -> Int
instance D Int where
type S Int = Bool
type S Int = Bool
bar c = if c then 1 else 2
def f(name, opts):
opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell'
setTestOpts(f)
test('T2632', normal, compile, [''])
test('T2931', normal, compile, ['-v0'])
test('T3572', normal, compile_and_run, [''])
test('T4056', normal, compile, ['-v0'])
test('T4169', normal, compile, ['-v0'])
test('T4170', normal, compile, ['-v0'])
test('T5721', normal, compile, ['-v0'])
test('T6062', normal, compile, ['-v0'])
test('T8455', normal, compile, ['-v0'])
test('T8633', normal, compile_and_run, [''])
test('T8759a', normal, compile_fail, ['-v0'])
test('T9824', normal, compile, ['-v0'])
test('TH_tf2', normal, compile, ['-v0'])
test('TH_ppr1', normal, compile_and_run, [''])
test('TH_bracket1', normal, compile, [''])
test('TH_bracket2', normal, compile, [''])
test('TH_bracket3', normal, compile, [''])
test('TH_scope', normal, compile, [''])
test('TH_reifyType1', normal, compile, [''])
test('TH_reifyType2', normal, compile, [''])
test('TH_repE1', normal, compile, [''])
test('TH_repE3', normal, compile, [''])
test('TH_abstractFamily', normal, compile_fail, [''])
{-# LANGUAGE TemplateHaskell, DataKinds #-}
module T8455 where
ty = [t| 5 |]
\ No newline at end of file
# NOTICE TO DEVELOPERS
# ~~~~~~~~~~~~~~~~~~~~
# Adding a TemplateHaskell test? If it only contains (non-quasi) quotes
# and no splices, consider adding it to the quotes/ directory instead
# of the th/ directory; this way, we can test it on the stage 1 compiler too!
# This test needs to come before the setTestOpts calls below, as we want
# to run it if compiler_profiled.
......@@ -16,9 +21,7 @@ setTestOpts(when(compiler_profiled(), skip))
test('TH_mkName', normal, compile, ['-v0'])
test('TH_1tuple', normal, compile_fail, ['-v0'])
test('TH_repE1', normal, compile, [''])
test('TH_repE2', normal, compile_and_run, [''])
test('TH_repE3', normal, compile, [''])
test('TH_repPrim', normal, compile, ['-v0'])
test('TH_repPrim2', normal, compile, ['-v0'])
test('TH_repUnboxedTuples', normal, compile, ['-v0'])
......@@ -67,8 +70,6 @@ test('TH_spliceD2',
test('TH_reifyDecl1', normal, compile, ['-v0'])
test('TH_reifyDecl2', normal, compile, ['-v0'])
test('TH_reifyType1', normal, compile, [''])
test('TH_reifyType2', normal, compile, [''])
test('TH_reifyMkName', normal, compile, ['-v0'])
test('TH_reifyInstances', normal, compile, ['-v0'])
......@@ -99,10 +100,6 @@ test('TH_spliceExpr1', normal, compile, ['-v0'])
test('TH_spliceE3', normal, compile, ['-v0'])
test('TH_spliceE4', normal, compile_and_run, [''])
test('TH_bracket1', normal, compile, [''])
test('TH_bracket2', normal, compile, [''])
test('TH_bracket3', normal, compile, [''])
test('TH_class1', normal, compile, ['-v0'])
test('TH_tuple1', normal, compile, ['-v0'])
test('TH_genEx',
......@@ -122,8 +119,6 @@ test('TH_exn2', normal, compile_fail, ['-v0'])
test('TH_recover', normal, compile_and_run, [''])
test('TH_dataD1', normal, compile_fail, ['-v0'])
test('TH_ppr1', normal, compile_and_run, [''])
test('TH_fail', normal, compile_fail, ['-v0'])
test('TH_scopedTvs', normal, compile, ['-v0'])
......@@ -133,13 +128,10 @@ test('TH_ghci1', normal, ghci_script, ['TH_ghci1.script'])
test('TH_linePragma', normal, compile_fail, ['-v0'])
test('TH_scope', normal, compile, [''])
test('T2632', normal, compile, [''])
test('T2700', normal, compile, ['-v0'])
test('T2817', normal, compile, ['-v0'])
test('T2713', normal, compile_fail, ['-v0'])
test('T2674', normal, compile_fail, ['-v0'])
test('T2931', normal, compile, ['-v0'])
test('TH_emptycase', normal, compile, ['-v0'])
test('T2386', extra_clean(['T2386_Lib.hi', 'T2386_Lib.o']),
......@@ -152,7 +144,6 @@ test('T2685', extra_clean(['T2685a.hi','T2685a.o']),
test('TH_sections', normal, compile, ['-v0'])
test('TH_tf1', normal, compile, ['-v0'])
test('TH_tf2', normal, compile, ['-v0'])
test('TH_tf3', normal, compile, ['-v0'])
test('TH_pragma', normal, compile, ['-v0 -dsuppress-uniques'])
......@@ -167,7 +158,6 @@ test('TH_foreignCallingConventions', normal,
test('T3395', normal, compile_fail, ['-v0'])
test('T3467', normal, compile, [''])
test('T3572', normal, compile_and_run, [''])
test('T3100', normal, compile, ['-v0'])
test('T3920', normal, compile_and_run, ['-v0'])
......@@ -177,10 +167,8 @@ test('T3845', normal, compile, ['-v0'])
test('T3899', extra_clean(['T3899a.hi','T3899a.o']),
multimod_compile,
['T3899','-v0 -ddump-splices -dsuppress-uniques ' + config.ghc_th_way_flags])
test('T4056', normal, compile, ['-v0'])
test('T4188', normal, compile, ['-v0'])
test('T4233', normal, compile, ['-v0'])
test('T4169', normal, compile, ['-v0'])
test('T1835', normal, compile_and_run, ['-v0'])
test('TH_viewPatPrint', normal, compile_and_run, [''])
......@@ -227,7 +215,6 @@ test('T5665', extra_clean(['T5665a.hi','T5665a.o']),
test('T5700', extra_clean(['T5700a.hi','T5700a.o']),
multimod_compile,
['T5700','-v0 -ddump-splices ' + config.ghc_th_way_flags])
test('T5721', normal, compile, ['-v0'])
test('TH_PromotedTuple', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
test('TH_PromotedList', normal, compile, ['-v0'])
......@@ -302,15 +289,12 @@ test('T8333',
run_command,
['$MAKE -s --no-print-directory T8333'])
test('T4170', normal, compile, ['-v0'])
test('T4124', normal, compile, ['-v0'])
test('T4128', normal, compile, ['-v0'])
test('T6062', normal, compile, ['-v0'])
test('T4364', normal, compile, ['-v0'])
test('T8412', normal, compile_fail, ['-v0'])
test('T7667', normal, compile, ['-v0'])
test('T7667a', normal, compile_fail, ['-v0'])
test('T8455', normal, compile, ['-v0'])
test('T8499', normal, compile, ['-v0'])
test('T7477', normal, compile, ['-v0'])
test('T8507', normal, compile, ['-v0'])
......@@ -322,7 +306,6 @@ test('T8577',
extra_clean(['T8577a.hi', 'T8577a.o']),
multimod_compile_fail,
['T8577', '-v0 ' + config.ghc_th_way_flags])
test('T8633', normal, compile_and_run, [''])
test('T8625', normal, ghci_script, ['T8625.script'])
test('TH_StaticPointers',
[ when(compiler_lt('ghc', '7.9'), skip) ],
......@@ -331,7 +314,6 @@ test('TH_StaticPointers02',
[ when(compiler_lt('ghc', '7.9'), skip) ],
compile_fail, [''])
test('T8759', normal, compile_fail, ['-v0'])
test('T8759a', normal, compile_fail, ['-v0'])
test('T7021',
extra_clean(['T7021a.hi', 'T7021a.o']), multimod_compile, ['T7021','-v0'])
test('T8807', normal, compile, ['-v0'])
......@@ -354,7 +336,6 @@ test('T9209', normal, compile_fail, ['-v0'])
test('T7484', normal, compile_fail, ['-v0'])
test('T1476', normal, compile, ['-v0'])
test('T1476b', normal, compile_fail, ['-v0'])
test('T9824', normal, compile, ['-v0'])
test('T8031', normal, compile, ['-v0'])
test('T8624', normal, run_command, ['$MAKE -s --no-print-directory T8624'])
test('TH_Lift', normal, compile, ['-v0'])
......@@ -362,5 +343,3 @@ test('T10047', normal, ghci_script, ['T10047.script'])
test('T10019', normal, ghci_script, ['T10019.script'])
test('T10279', normal, compile_fail, ['-v0'])
test('T10306', normal, compile, ['-v0'])
test('TH_abstractFamily', normal, compile_fail, [''])
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