瀏覽代碼

use default expression's position if available

Simon Krajewski 12 年之前
父節點
當前提交
3fbc5e0b4e
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      matcher.ml

+ 6 - 1
matcher.ml

@@ -950,7 +950,12 @@ let match_expr ctx e cases def with_type p =
 	let need_val, wtype = (match with_type with NoValue -> false, None | Value -> true, None | WithType t -> true, Some t) in
 	let cases = match cases,def with
 		| [],None -> []
-		| cases,Some def -> cases @ [[(EConst(Ident "_")),p],None,def]
+		| cases,Some def ->
+			let p = match def with
+				| None -> p
+				| Some (_,p) -> p
+			in
+			cases @ [[(EConst(Ident "_")),p],None,def]
 		| _ -> cases
 	in
 	let evals = match fst e with