فهرست منبع

better error message on unused default pattern

Simon Krajewski 12 سال پیش
والد
کامیت
55e8880ae0
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      matcher.ml

+ 3 - 1
matcher.ml

@@ -1084,7 +1084,9 @@ let match_expr ctx e cases def with_type p =
 	begin try
 		let dt = compile mctx stl pl in
 		if Common.defined ctx.com Define.MatchDebug then print_endline (s_dt "" dt);
-		PMap.iter (fun _ out -> if out.o_num_paths = 0 then display_error ctx "This pattern is unused" out.o_pos) mctx.outcomes;
+		PMap.iter (fun _ out -> if out.o_num_paths = 0 then begin
+			if out.o_pos == p then display_error ctx "The default pattern is unused" p
+			else display_error ctx "This pattern is unused" out.o_pos end) mctx.outcomes;
 		let t = if not need_val then
 			mk_mono()
 		else