on master help sign in
Show unreachable case warnings like other warnings
bab82b5Jason Felice
src/Idris/Elab/Clause.hs+3−4
@@ -28,7 +28,7 @@ import Idris.Elab.Type
28import Idris.Elab.Utils
28import Idris.Elab.Utils
29import Idris.Error
29import Idris.Error
30import Idris.Options
30import Idris.Options
31−import Idris.Output (iputStrLn, pshow, sendHighlighting)
31+import Idris.Output (iWarn, pshow, sendHighlighting)
32import Idris.PartialEval
32import Idris.PartialEval
33import Idris.Termination
33import Idris.Termination
34import Idris.Transforms
34import Idris.Transforms
@@ -205,9 +205,8 @@ elabClauses info' fc opts n_in cs =
205 case tree of
205 case tree of
206 CaseDef _ _ [] -> return ()
206 CaseDef _ _ [] -> return ()
207 CaseDef _ _ xs -> mapM_ (\x ->
207 CaseDef _ _ xs -> mapM_ (\x ->
208− iputStrLn $ show fc ++
209− ":warning - Unreachable case: " ++
208+ iWarn fc $ text "Unreachable case:" </> text (show (delab ist x))
210− show (delab ist x)) xs
209+ ) xs
211 let knowncovering = (pcover && cov) || AssertTotal `elem` opts
210 let knowncovering = (pcover && cov) || AssertTotal `elem` opts
212 let defaultcase = if knowncovering
211 let defaultcase = if knowncovering
213 then STerm Erased
212 then STerm Erased
test/layout001/expected+6−1
@@ -74,4 +74,9 @@ When checking an application of function Prelude.Applicative.pure:
74 | ^
74 | ^
75not end of block
75not end of block
76
76
77+mplus3.idr:11:1-16:
78+ |
79+11 | term = ?term_rhs
80+ | ~~~~~~~~~~~~~~~~
77−mplus3.idr:11:1-16:warning - Unreachable case: term
81+Unreachable case: term
82+