git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Traversal should pick up bindings in all value declarations. (#2412)
commit887d4130e91a3af9ef8178f04e63d10c8ef56c19 authorLiam Goodacre <goodacre.liam@gmail.com> dateMon 7 Nov 2016, 14:55 (10 years ago) parent6675280
2 files changed+17−1
examples/warning/2411.purs+15 src/Language/PureScript/AST/Traversals.hs+2−1
examples/warning/2411.pursnew file+15
@@ -0,0 +1,15 @@
1+-- @shouldWarnWith ShadowedName
2+module Main where
3+
4+import Prelude
5+
6+import Control.Monad.Eff (Eff)
7+
8+test :: forall m. Monad m => Int -> m Unit
9+test x =
10+ let x = unit
11+ in pure x
12+
13+main :: Eff () Unit
14+main = test 42
15+
src/Language/PureScript/AST/Traversals.hs+2−1
@@ -474,7 +474,8 @@ everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s)
474474 in foldMap (f'' s') ds
475475 f' s (ValueDeclaration name _ bs (Right val)) =
476476 let s' = S.insert name s
477− in foldMap (h'' s') bs <> g'' s' val
477+ s'' = S.union s' (S.fromList (concatMap binderNames bs))
478+ in foldMap (h'' s') bs <> g'' s'' val
478479 f' s (ValueDeclaration name _ bs (Left gs)) =
479480 let s' = S.insert name s
480481 s'' = S.union s' (S.fromList (concatMap binderNames bs))