From e3a3648e22c6f04bef825842b53117c63f7b529b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Peem=C3=B6ller?= Date: Mon, 11 Aug 2014 12:01:27 +0200 Subject: [PATCH] Temporarily disabled overlapping warnings (broken) --- src/Checks/WarnCheck.hs | 15 ++++++++------- test/OverlappingPatterns.curry | 14 +++++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Checks/WarnCheck.hs b/src/Checks/WarnCheck.hs index 493e86fc..0f72fc83 100644 --- a/src/Checks/WarnCheck.hs +++ b/src/Checks/WarnCheck.hs @@ -280,8 +280,8 @@ checkFunctionPatternMatch p f eqs = do warnMissingPattern p loc nonExhaustive unless (null overlapped) $ warnFor WarnNondetPatterns $ report $ warnOverlapPattern p loc (idName f) "=" overlapped - when nondet $ warnFor WarnOverlapping $ report $ - warnNondetOverlapping p ("Function " ++ escName f) +-- when nondet $ warnFor WarnOverlapping $ report $ +-- warnNondetOverlapping p ("Function " ++ escName f) -- Check an equation for warnings. -- This is done in a seperate scope as the left-hand-side may introduce @@ -426,9 +426,10 @@ getTyScheme q = do "Checks.WarnCheck.getTyScheme: " ++ show q warnMissingTypeSignature :: ModuleIdent -> Ident -> TypeScheme -> Message -warnMissingTypeSignature mid i tys = posMessage i $ hsep (map text - ["Top-level binding with no type signature:", showIdent i, "::"]) - <+> ppTypeScheme mid tys +warnMissingTypeSignature mid i tys = posMessage i $ fsep + [ text "Top-level binding with no type signature:" + , text (showIdent i) <+> text "::" <+> ppTypeScheme mid tys + ] -- ----------------------------------------------------------------------------- -- Check for overlapping module alias names @@ -474,8 +475,8 @@ checkCaseAlts ct alts@(Alt p _ _ : _) = do warnMissingPattern p loc nonExhaustive unless (null overlapped) $ warnFor WarnNondetPatterns $ report $ warnOverlapPattern p loc "" "->" overlapped - when nondet $ warnFor WarnOverlapping $ report $ - warnNondetOverlapping p ("A fcase expression") +-- when nondet $ warnFor WarnOverlapping $ report $ +-- warnNondetOverlapping p ("A fcase expression") Rigid -> do unless (null nonExhaustive) $ warnFor WarnIncompletePatterns $ report $ warnMissingPattern p loc nonExhaustive diff --git a/test/OverlappingPatterns.curry b/test/OverlappingPatterns.curry index e7433dd9..7f934362 100644 --- a/test/OverlappingPatterns.curry +++ b/test/OverlappingPatterns.curry @@ -1,15 +1,19 @@ -h x = fcase x of +f [] _ = Nothing +f (_ : _) [] = Nothing +f ((_, _) : _) ((_, _) : _) = Nothing + +g x = fcase x of "" -> 0 [] -> 1 -i x = fcase x of +g x = fcase x of [_] -> 0 (_:[]) -> 1 _ -> 2 +i x = x +i y = y + j [] = 0 j (_:_) = 0 j x = 1 - -h x = x -h y = y -- GitLab