base: Reintroduce fusion for scanr
[ghc.git] / testsuite / tests / partial-sigs / should_compile / LocalDefinitionBug.hs
1 {-# LANGUAGE ScopedTypeVariables #-}
2 {-# LANGUAGE PartialTypeSignatures #-}
3 module LocalDefinitionBug where
4
5 monoLoc :: forall a. a -> ((a, String), (a, _))
6 monoLoc x = (g True , g False)
7 where
8 g :: t -> (a, String)
9 g _ = (x, "foo")
10
11 -- Test case for (fixed) bug that previously generated the following error message:
12
13 -- LocalDefinitionBug.hs:9:16:
14 -- GHC internal error: ‘a’ is not in scope during type checking, but it passed the renamer
15 -- tcl_env of environment: [alA :-> Type variable ‘_’ = _,
16 -- alC :-> Identifier[x::a, <NotTopLevel>],
17 -- alE :-> Type variable ‘t’ = t,
18 -- rjF :-> Identifier[monoLoc::a
19 -- -> ((a, String), (a, _)), <NotTopLevel>]]
20 -- In the type signature for ‘g’: g :: t -> (a, String)
21 -- In an equation for ‘monoLoc’:
22 -- monoLoc x
23 -- = (g True, g False)
24 -- where
25 -- g :: t -> (a, String)
26 -- g _ = (x, "foo")
27
28
29 -- Fixed by using tcExtendTyVarEnv2 instead of tcExtendTyVarEnv