Commit d8d798b1 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Small issue with signatures in a TH splice (fixes Trac #8932)

parent 8f831ec5
......@@ -270,8 +270,16 @@ lookupExactOcc name
; return name
[gre] -> return (gre_name gre)
_ -> pprPanic "lookupExactOcc" (ppr name $$ ppr gres) }
(gre:_) -> return (gre_name gre) }
-- We can get more than one GRE here, if there are multiple
-- bindings for the same name; but there will already be a
-- reported error for the duplicate. (If we add the error
-- rather than stopping when we encounter it.)
-- So all we need do here is not crash.
-- Example is Trac #8932:
-- $( [d| foo :: a->a; foo x = x |])
-- foo = True
-- Here the 'foo' in the splice turns into an Exact Name
exact_nm_err = hang (ptext (sLit "The exact Name") <+> quotes (ppr name) <+> ptext (sLit "is not in scope"))
{-# LANGUAGE TemplateHaskell #-}
module T8932 where
foo :: a -> a
foo x = x
foo :: a
foo = undefined
Multiple declarations of ‘foo’
Declared at: T8932.hs:5:3
......@@ -324,3 +324,5 @@ test('T7021',
test('T8807', normal, compile, ['-v0'])
test('T8884', normal, compile, ['-v0'])
test('T8954', normal, compile, ['-v0'])
test('T8932', normal, compile_fail, ['-v0'])
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