on master help sign in
Show unreachable case warnings like other warnings
commitbab82b53960abb42585ac8e712db1d18d2f54541 authorJason Felice <jason.m.felice@gmail.com> dateWed 6 Dec 2017, 10:49 (9 years ago) parent79351ee
2 files changed+9−5
src/Idris/Elab/Clause.hs+3−4 test/layout001/expected+6−1
src/Idris/Elab/Clause.hs+3−4
@@ -28,7 +28,7 @@ import Idris.Elab.Type
2828import Idris.Elab.Utils
2929import Idris.Error
3030import Idris.Options
31−import Idris.Output (iputStrLn, pshow, sendHighlighting)
31+import Idris.Output (iWarn, pshow, sendHighlighting)
3232import Idris.PartialEval
3333import Idris.Termination
3434import Idris.Transforms
@@ -205,9 +205,8 @@ elabClauses info' fc opts n_in cs =
205205 case tree of
206206 CaseDef _ _ [] -> return ()
207207 CaseDef _ _ xs -> mapM_ (\x ->
208− iputStrLn $ show fc ++
209− ":warning - Unreachable case: " ++
210− show (delab ist x)) xs
208+ iWarn fc $ text "Unreachable case:" </> text (show (delab ist x))
209+ ) xs
211210 let knowncovering = (pcover && cov) || AssertTotal `elem` opts
212211 let defaultcase = if knowncovering
213212 then STerm Erased
test/layout001/expected+6−1
@@ -74,4 +74,9 @@ When checking an application of function Prelude.Applicative.pure:
7474 | ^
7575not end of block
7676
77−mplus3.idr:11:1-16:warning - Unreachable case: term
77+mplus3.idr:11:1-16:
78+ |
79+11 | term = ?term_rhs
80+ | ~~~~~~~~~~~~~~~~
81+Unreachable case: term
82+