Commit 2a3dbc81 authored by simonpj's avatar simonpj

[project @ 2005-05-19 07:48:09 by simonpj]

Add test for splicing instance, and for pat-match failure in splice code
parent bf325d2d
{-# OPTIONS_GHC -fth #-}
-- Test error message when the code in a splice
-- fails (e.g. with pattern match failure)
module ShouldCompile where
$( case reverse "no" of
[] -> return []
)
TH_fail.hs:1:0:
Exception when trying to run compile-time code:
TH_fail.hs:(8,3)-(9,22): Non-exhaustive patterns in case
Code: let
return = return Language.Haskell.TH.Syntax.Q $dMonad
$dMonad = Language.Haskell.TH.Syntax.$f18
in
case reverse Char "no" of
[]
-> return [Language.Haskell.TH.Syntax.Dec] (GHC.Base.[]
Language.Haskell.TH.Syntax.Dec)
Loading package base-1.0 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package template-haskell-1.0 ... linking ... done.
{-# OPTIONS_GHC -fth #-}
-- Tickles a GHC 6.4 buglet
module ShouldCompile where
class Foo a where
foo :: a -> a
foo = id
-- Splice an instance decl that uses the default method
$( [d| instance Foo () where |] )
Loading package base-1.0 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package template-haskell-1.0 ... linking ... done.
......@@ -40,3 +40,7 @@ test('TH_tuple1', normal, compile, [''])
test('TH_genEx', normal, multimod_compile, ['TH_genEx', '-ddump-splices'])
test('TH_where', normal, compile_and_run, [''])
test('TH_spliceInst', normal, compile, [''])
test('TH_fail', 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