Commit 5c6b4664 authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Added a flag for enabling/disabling warnings for missing type signatures

parent edf79a9a
...@@ -407,7 +407,7 @@ checkFieldExpression (Field _ _ e) = checkExpr e -- Hier auch "visitId ident" ? ...@@ -407,7 +407,7 @@ checkFieldExpression (Field _ _ e) = checkExpr e -- Hier auch "visitId ident" ?
-- during syntax checking -- during syntax checking
checkMissingTypeSignatures :: [Decl] -> WCM () checkMissingTypeSignatures :: [Decl] -> WCM ()
checkMissingTypeSignatures decls = do checkMissingTypeSignatures decls = warnFor WarnMissingSignatures $ do
let typedFs = [f | TypeSig _ fs _ <- decls, f <- fs] let typedFs = [f | TypeSig _ fs _ <- decls, f <- fs]
untypedFs = [f | FunctionDecl _ f _ <- decls, f `notElem` typedFs] untypedFs = [f | FunctionDecl _ f _ <- decls, f `notElem` typedFs]
unless (null untypedFs) $ do unless (null untypedFs) $ do
......
...@@ -158,13 +158,15 @@ data WarnFlag ...@@ -158,13 +158,15 @@ data WarnFlag
| WarnOverlapping -- ^ Warn for overlapping rules/alternatives | WarnOverlapping -- ^ Warn for overlapping rules/alternatives
| WarnIncompletePatterns -- ^ Warn for incomplete pattern matching | WarnIncompletePatterns -- ^ Warn for incomplete pattern matching
| WarnNondetPatterns -- ^ Warn for non-deterministic pattern matching | WarnNondetPatterns -- ^ Warn for non-deterministic pattern matching
| WarnMissingSignatures -- ^ Warn for missing type signatures
deriving (Eq, Bounded, Enum, Show) deriving (Eq, Bounded, Enum, Show)
-- |Warning flags enabled by default -- |Warning flags enabled by default
stdWarnFlags :: [WarnFlag] stdWarnFlags :: [WarnFlag]
stdWarnFlags = stdWarnFlags =
[ WarnMultipleImports , WarnDisjoinedRules, WarnUnusedBindings [ WarnMultipleImports , WarnDisjoinedRules, WarnUnusedBindings
, WarnNameShadowing , WarnOverlapping , WarnIncompletePatterns , WarnNameShadowing , WarnOverlapping , WarnIncompletePatterns
, WarnMissingSignatures
] ]
-- |Description and flag of warnings flags -- |Description and flag of warnings flags
...@@ -184,6 +186,8 @@ warnFlags = ...@@ -184,6 +186,8 @@ warnFlags =
, "incomplete pattern matching") , "incomplete pattern matching")
, ( WarnNondetPatterns , "nondet-patterns" , ( WarnNondetPatterns , "nondet-patterns"
, "Nondeterministic patterns" ) , "Nondeterministic patterns" )
, ( WarnMissingSignatures , "missing-signatures"
, "missing type signatures" )
] ]
-- |Dump level -- |Dump level
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment