git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix tests.
b88c063Phil Freeman
src/Language/PureScript/AST/Traversals.hs+6−2
@@ -401,8 +401,12 @@ everythingWithScope ::
401 (S.Set Ident -> Binder -> r) ->
401 (S.Set Ident -> Binder -> r) ->
402 (S.Set Ident -> CaseAlternative -> r) ->
402 (S.Set Ident -> CaseAlternative -> r) ->
403 (S.Set Ident -> DoNotationElement -> r) ->
403 (S.Set Ident -> DoNotationElement -> r) ->
404− S.Set Ident -> Declaration -> r
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)
405−everythingWithScope f g h i j = f''
409+everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s)
406 where
410 where
407 -- Avoid importing Data.Monoid and getting shadowed names above
411 -- Avoid importing Data.Monoid and getting shadowed names above
408 (<>) = mappend
412 (<>) = mappend
src/Language/PureScript/Linter.hs+3−3
@@ -57,13 +57,13 @@ lint (Module _ _ mn ds _) = censor (addHint (ErrorInModule mn)) $ mapM_ lintDecl
57 lintDeclaration :: Declaration -> m ()
57 lintDeclaration :: Declaration -> m ()
58 lintDeclaration = tell . f
58 lintDeclaration = tell . f
59 where
59 where
60− warningsInDecl = everythingWithScope stepD stepE stepB (\_ _ -> mempty) stepDo moduleNames
60+ (warningsInDecl, _, _, _, _) = everythingWithScope stepD stepE stepB (\_ _ -> mempty) stepDo
61
61
62 f :: Declaration -> MultipleErrors
62 f :: Declaration -> MultipleErrors
63 f (PositionedDeclaration pos _ dec) = addHint (PositionedError pos) (f dec)
63 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)
65 f (TypeDeclaration name ty) = addHint (ErrorInTypeDeclaration name) (checkTypeVars ty)
65 f (TypeDeclaration name ty) = addHint (ErrorInTypeDeclaration name) (checkTypeVars ty)
66− f dec = warningsInDecl dec <> checkTypeVarsInDecl dec
66+ f dec = warningsInDecl moduleNames dec <> checkTypeVarsInDecl dec
67
67
68 stepD :: S.Set Ident -> Declaration -> MultipleErrors
68 stepD :: S.Set Ident -> Declaration -> MultipleErrors
69 stepD _ (TypeClassDeclaration name _ _ decls) = foldMap go decls
69 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
102collapseBindingGroupsForValue other = other
102collapseBindingGroupsForValue other = other
103
103
104usedIdents :: ModuleName -> Declaration -> [Ident]
104usedIdents :: ModuleName -> Declaration -> [Ident]
105−usedIdents moduleName = nub . everythingWithScope def usedNamesE def def def S.empty
105+usedIdents moduleName = nub . usedIdents' S.empty . getValue
106 where
106 where
107 def _ _ = []
107 def _ _ = []
108
108
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+
109 usedNamesE :: S.Set Ident -> Expr -> [Ident]
116 usedNamesE :: S.Set Ident -> Expr -> [Ident]
110 usedNamesE scope (Var (Qualified Nothing name)) | name `S.notMember` scope = [name]
117 usedNamesE scope (Var (Qualified Nothing name)) | name `S.notMember` scope = [name]
111 usedNamesE scope (Var (Qualified (Just moduleName') name)) | moduleName == moduleName' && name `S.notMember` scope = [name]
118 usedNamesE scope (Var (Qualified (Just moduleName') name)) | moduleName == moduleName' && name `S.notMember` scope = [name]