Commit 1d43475b authored by gmainland's avatar gmainland

Fix test wibbles for new Template Haskell.

Because splices are now run in the renamer, we do not get the same error context
as we would when running in the type checker. In most cases we get less context,
and in some cases I have added additional context. Error messages should at
least tell the user that an error occurred in a splice; dropping context beyond
that point is not judged a great loss.

Note that we may now report only one error when multiple errors were reported
before because splices are now run in the renamer.
parent 4ccdc324
...@@ -3,3 +3,9 @@ ...@@ -3,3 +3,9 @@
Multiple declarations of ‛f’ Multiple declarations of ‛f’
Declared at: <interactive>:3:32 Declared at: <interactive>:3:32
<interactive>:3:68 <interactive>:3:68
In the Template Haskell quotation
[d| f = undefined
class Foo x where
f :: x -> x
instance Foo Int where
f = id |]
inside d: t_0
inside b: a_0 inside b: a_0
inside d: GHC.Types.Bool
type of c: GHC.Types.Bool type of c: GHC.Types.Bool
inside f: GHC.Types.Bool inside f: GHC.Types.Bool
type of e: GHC.Types.Bool type of e: GHC.Types.Bool
...@@ -3,4 +3,3 @@ T2597b.hs:8:8: ...@@ -3,4 +3,3 @@ T2597b.hs:8:8:
Empty stmt list in do-block Empty stmt list in do-block
When splicing a TH expression: do When splicing a TH expression: do
In the expression: $mkBug2 In the expression: $mkBug2
In an equation for ‛bug2’: bug2 = $mkBug2
T3177a.hs:8:15: T3177a.hs:8:6:
‛Int’ is applied to too many type arguments ‛Int’ is applied to too many type arguments
In the type ‛Int Int’ In the type signature for ‛f’: f :: Int Int
In the Template Haskell quotation [t| Int Int |]
In the first argument of ‛id’, namely ‛[t| Int Int |]’
T3177a.hs:11:6: T3177a.hs:11:6:
‛Int’ is applied to too many type arguments ‛Int’ is applied to too many type arguments
......
...@@ -9,9 +9,3 @@ T3395.hs:6:9: ...@@ -9,9 +9,3 @@ T3395.hs:6:9:
$ CompE $ CompE
[NoBindS (VarE $ mkName "undefined"), [NoBindS (VarE $ mkName "undefined"),
BindS (VarP $ mkName "r1") (VarE $ mkName "undefined")]) BindS (VarP $ mkName "r1") (VarE $ mkName "undefined")])
In an equation for ‛foo’:
foo
= $(return
$ CompE
[NoBindS (VarE $ mkName "undefined"),
BindS (VarP $ mkName "r1") (VarE $ mkName "undefined")])
T5358.hs:7:1: T5358.hs:14:15:
Couldn't match expected type ‛t1 -> t1’ with actual type ‛Int’
The equation(s) for ‛t1’ have one argument,
but its type ‛Int’ has none
T5358.hs:8:1:
Couldn't match expected type ‛t0 -> t0’ with actual type ‛Int’
The equation(s) for ‛t2’ have one argument,
but its type ‛Int’ has none
T5358.hs:10:13:
Couldn't match expected type ‛t -> a0’ with actual type ‛Int’
Relevant bindings include
x :: t (bound at T5358.hs:10:9)
prop_x1 :: t -> Bool (bound at T5358.hs:10:1)
The function ‛t1’ is applied to one argument,
but its type ‛Int’ has none
In the first argument of ‛(==)’, namely ‛t1 x’
In the expression: t1 x == t2 x
T5358.hs:10:21:
Couldn't match expected type ‛t -> a0’ with actual type ‛Int’
Relevant bindings include
x :: t (bound at T5358.hs:10:9)
prop_x1 :: t -> Bool (bound at T5358.hs:10:1)
The function ‛t2’ is applied to one argument,
but its type ‛Int’ has none
In the second argument of ‛(==)’, namely ‛t2 x’
In the expression: t1 x == t2 x
T5358.hs:12:15:
Exception when trying to run compile-time code: Exception when trying to run compile-time code:
runTest called error: forall t_0 . t_0 -> GHC.Types.Bool runTest called error: forall t_0 . t_0 -> GHC.Types.Bool
Code: do { VarI _ t _ _ <- reify (mkName "prop_x1"); Code: do { VarI _ t _ _ <- reify (mkName "prop_x1");
...@@ -37,7 +7,3 @@ T5358.hs:12:15: ...@@ -37,7 +7,3 @@ T5358.hs:12:15:
In the expression: In the expression:
$(do { VarI _ t _ _ <- reify (mkName "prop_x1"); $(do { VarI _ t _ _ <- reify (mkName "prop_x1");
error $ ("runTest called error: " ++ pprint t) }) error $ ("runTest called error: " ++ pprint t) })
In an equation for ‛runTests’:
runTests
= $(do { VarI _ t _ _ <- reify (mkName "prop_x1");
error $ ("runTest called error: " ++ pprint t) })
...@@ -4,4 +4,3 @@ T5795.hs:9:6: ...@@ -4,4 +4,3 @@ T5795.hs:9:6:
‛ty’ is used in a top-level splice or annotation, ‛ty’ is used in a top-level splice or annotation,
and must be imported, not defined locally and must be imported, not defined locally
In the expression: ty In the expression: ty
In the type signature for ‛f’: f :: $ty
...@@ -8,4 +8,3 @@ T5971.hs:6:7: ...@@ -8,4 +8,3 @@ T5971.hs:6:7:
$(newName "x" >>= varE) $(newName "x" >>= varE)
To see what the splice expanded to, use -ddump-splices To see what the splice expanded to, use -ddump-splices
In the expression: $(newName "x" >>= varE) In the expression: $(newName "x" >>= varE)
In a pattern binding: _ = $(newName "x" >>= varE)
...@@ -10,8 +10,3 @@ T6114.hs:6:17: ...@@ -10,8 +10,3 @@ T6114.hs:6:17:
instanceType <- [t| $(varT xName) |]; instanceType <- [t| $(varT xName) |];
_ <- reifyInstances ''Eq [instanceType]; _ <- reifyInstances ''Eq [instanceType];
.... }) .... })
In an equation for ‛instanceVar’:
instanceVar
= $(do { xName <- newName "x";
instanceType <- [t| $(varT xName) |];
.... })
...@@ -3,4 +3,3 @@ TH_1tuple.hs:11:7: ...@@ -3,4 +3,3 @@ TH_1tuple.hs:11:7:
Illegal 1-tuple type constructor Illegal 1-tuple type constructor
When splicing a TH expression: 1 :: () When splicing a TH expression: 1 :: ()
In the expression: $(sigE [| 1 |] (tupleT 1)) In the expression: $(sigE [| 1 |] (tupleT 1))
In an equation for ‛y’: y = $(sigE [| 1 |] (tupleT 1))
TH_dataD1.hs:8:13: TH_dataD1.hs:8:13:
Declaration splices are not permitted inside declaration brackets Declaration splices are not permitted inside declaration brackets
In the Template Haskell quotation
[d| $(dataD [] (mkName "D") [] [normalC "K" []] []) |]
...@@ -4,4 +4,3 @@ TH_runIO.hs:12:9: ...@@ -4,4 +4,3 @@ TH_runIO.hs:12:9:
user error (hi) user error (hi)
Code: runIO (fail "hi") Code: runIO (fail "hi")
In the expression: $(runIO (fail "hi")) In the expression: $(runIO (fail "hi"))
In an equation for ‛foo’: foo = $(runIO (fail "hi"))
TH_unresolvedInfix2.hs:12:11: TH_unresolvedInfix2.hs:14:11:
The operator ‛:+’ [infixl 6] of a section The operator ‛:+’ [infixl 6] of a section
must have lower precedence than that of the operand, must have lower precedence than that of the operand,
namely ‛:+’ [infixl 6] namely ‛:+’ [infixl 6]
...@@ -15,9 +15,3 @@ TH_unresolvedInfix2.hs:12:11: ...@@ -15,9 +15,3 @@ TH_unresolvedInfix2.hs:12:11:
plus = conE ... plus = conE ...
n = conE ... n = conE ...
in infixE Nothing plus (Just $ uInfixE n plus n)) in infixE Nothing plus (Just $ uInfixE n plus n))
In an equation for ‛expr’:
expr
= $(let
plus = ...
....
in infixE Nothing plus (Just $ uInfixE n plus n))
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