Skip to content

Emit correct locations for warnings about unreachable case branches

Fredrik Wieczerkowski requested to merge pretty-unreachability-warnings into master

Fixes #84 (closed).

This branch improves warnings for unreachable patterns by referring to the line of the first unreachable branch (rather than the first branch in the case expression). Consider the following example:

module Test where

f x = case x of
    1 -> 2
    _ -> 3
    _ -> 4
    _ -> 5
..\curry-playground\Test.curry, line 6.5: Warning:
    Pattern matches are potentially unreachable
    In a case alternative:
      _
      _ -> ...

Additionally, fcase warnings now refer to the first line of the entire expression, not the first branch:

module Test where

f x = fcase x of
    _ -> True
    _ -> False
..\curry-playground\Test.curry, line 3.7: Warning:
    An fcase expression is potentially non-deterministic due to overlapping rules
Edited by Fredrik Wieczerkowski

Merge request reports