git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Traversal should pick up bindings in all value declarations. (#2412)
887d413Liam Goodacre
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)
474 in foldMap (f'' s') ds
474 in foldMap (f'' s') ds
475 f' s (ValueDeclaration name _ bs (Right val)) =
475 f' s (ValueDeclaration name _ bs (Right val)) =
476 let s' = S.insert name s
476 let s' = S.insert name s
477+ s'' = S.union s' (S.fromList (concatMap binderNames bs))
477− in foldMap (h'' s') bs <> g'' s' val
478+ in foldMap (h'' s') bs <> g'' s'' val
478 f' s (ValueDeclaration name _ bs (Left gs)) =
479 f' s (ValueDeclaration name _ bs (Left gs)) =
479 let s' = S.insert name s
480 let s' = S.insert name s
480 s'' = S.union s' (S.fromList (concatMap binderNames bs))
481 s'' = S.union s' (S.fromList (concatMap binderNames bs))