git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix tests.
commitb88c0637a8500fdbe80c34380ae9ea1946d4bb52 authorPhil Freeman <paf31@cantab.net> dateSun 22 Nov 2015, 16:39 (11 years ago) parente7430f7
3 files changed+17−6
src/Language/PureScript/AST/Traversals.hs+6−2 src/Language/PureScript/Linter.hs+3−3 src/Language/PureScript/Sugar/BindingGroups.hs+8−1
src/Language/PureScript/AST/Traversals.hs+6−2
@@ -401,8 +401,12 @@ everythingWithScope ::
401401 (S.Set Ident -> Binder -> r) ->
402402 (S.Set Ident -> CaseAlternative -> r) ->
403403 (S.Set Ident -> DoNotationElement -> r) ->
404− S.Set Ident -> Declaration -> r
405−everythingWithScope f g h i j = f''
404+ ( S.Set Ident -> Declaration -> r
405+ , S.Set Ident -> Expr -> r
406+ , S.Set Ident -> Binder -> r
407+ , S.Set Ident -> CaseAlternative -> r
408+ , S.Set Ident -> DoNotationElement -> r)
409+everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s)
406410 where
407411 -- Avoid importing Data.Monoid and getting shadowed names above
408412 (<>) = mappend
src/Language/PureScript/Linter.hs+3−3
@@ -57,13 +57,13 @@ lint (Module _ _ mn ds _) = censor (addHint (ErrorInModule mn)) $ mapM_ lintDecl
5757 lintDeclaration :: Declaration -> m ()
5858 lintDeclaration = tell . f
5959 where
60− warningsInDecl = everythingWithScope stepD stepE stepB (\_ _ -> mempty) stepDo moduleNames
60+ (warningsInDecl, _, _, _, _) = everythingWithScope stepD stepE stepB (\_ _ -> mempty) stepDo
6161
6262 f :: Declaration -> MultipleErrors
6363 f (PositionedDeclaration pos _ dec) = addHint (PositionedError pos) (f dec)
64− f dec@(ValueDeclaration name _ _ _) = addHint (ErrorInValueDeclaration name) (warningsInDecl dec <> checkTypeVarsInDecl dec)
64+ f dec@(ValueDeclaration name _ _ _) = addHint (ErrorInValueDeclaration name) (warningsInDecl moduleNames dec <> checkTypeVarsInDecl dec)
6565 f (TypeDeclaration name ty) = addHint (ErrorInTypeDeclaration name) (checkTypeVars ty)
66− f dec = warningsInDecl dec <> checkTypeVarsInDecl dec
66+ f dec = warningsInDecl moduleNames dec <> checkTypeVarsInDecl dec
6767
6868 stepD :: S.Set Ident -> Declaration -> MultipleErrors
6969 stepD _ (TypeClassDeclaration name _ _ decls) = foldMap go decls
src/Language/PureScript/Sugar/BindingGroups.hs+8−1
@@ -102,10 +102,17 @@ collapseBindingGroupsForValue (Let ds val) = Let (collapseBindingGroups ds) val
102102collapseBindingGroupsForValue other = other
103103
104104usedIdents :: ModuleName -> Declaration -> [Ident]
105−usedIdents moduleName = nub . everythingWithScope def usedNamesE def def def S.empty
105+usedIdents moduleName = nub . usedIdents' S.empty . getValue
106106 where
107107 def _ _ = []
108108
109+ getValue (ValueDeclaration _ _ [] (Right val)) = val
110+ getValue ValueDeclaration{} = internalError "Binders should have been desugared"
111+ getValue (PositionedDeclaration _ _ d) = getValue d
112+ getValue _ = internalError "Expected ValueDeclaration"
113+
114+ (_, usedIdents', _, _, _) = everythingWithScope def usedNamesE def def def
115+
109116 usedNamesE :: S.Set Ident -> Expr -> [Ident]
110117 usedNamesE scope (Var (Qualified Nothing name)) | name `S.notMember` scope = [name]
111118 usedNamesE scope (Var (Qualified (Just moduleName') name)) | moduleName == moduleName' && name `S.notMember` scope = [name]