summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-03-04 14:14:17 +0000
committerAlasdair Armstrong2019-03-04 14:14:43 +0000
commit9ed89583d52ccff151fb75424975f2ac4e627a1b (patch)
treeed792dde4f647932d4c12880a8af72339c0ba60f
parent4be604551897b00a09c4cc5535331181caf54621 (diff)
Add location to warning in pattern completeness check
-rw-r--r--src/pattern_completeness.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pattern_completeness.ml b/src/pattern_completeness.ml
index 514eb5c0..79fc93ee 100644
--- a/src/pattern_completeness.ml
+++ b/src/pattern_completeness.ml
@@ -89,7 +89,7 @@ let is_wild = function
| GP_wild -> true
| _ -> false
-let rec generalize ctx (P_aux (p_aux, _) as pat) =
+let rec generalize ctx (P_aux (p_aux, (l, _)) as pat) =
match p_aux with
| P_lit (L_aux (L_unit, _)) ->
(* Unit pattern always matches on unit, so generalize to wildcard *)
@@ -105,7 +105,8 @@ let rec generalize ctx (P_aux (p_aux, _) as pat) =
match ctx.lookup_id id with
| Unbound -> GP_wild
| Local (Immutable, _) -> GP_wild
- | Register _ | Local (Mutable, _) -> Util.warn "Matching on register or mutable variable"; GP_wild
+ | Register _ | Local (Mutable, _) ->
+ Util.warn ("Matching on register or mutable variable at " ^ Reporting.loc_to_string l); GP_wild
| Enum _ -> GP_app (Bindings.singleton id GP_wild)
end
| P_var (pat, _) -> generalize ctx pat