Kaynağa Gözat

allow [e] matches

Simon Krajewski 12 yıl önce
ebeveyn
işleme
c23cb09804
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      matcher.ml

+ 3 - 1
matcher.ml

@@ -1153,8 +1153,10 @@ let match_expr ctx e cases def with_type p =
 		| _ -> cases
 		| _ -> cases
 	in
 	in
 	(* type subject(s) *)
 	(* type subject(s) *)
+	let array_match = ref false in
 	let evals = match fst e with
 	let evals = match fst e with
 		| EArrayDecl el | EParenthesis(EArrayDecl el,_) ->
 		| EArrayDecl el | EParenthesis(EArrayDecl el,_) ->
+			array_match := true;
 			List.map (fun e -> type_expr ctx e Value) el
 			List.map (fun e -> type_expr ctx e Value) el
 		| _ ->
 		| _ ->
 			let e = type_expr ctx e Value in
 			let e = type_expr ctx e Value in
@@ -1212,7 +1214,7 @@ let match_expr ctx e cases def with_type p =
 		let save = save_locals ctx in
 		let save = save_locals ctx in
 		(* type case patterns *)
 		(* type case patterns *)
 		let pl,restore,with_type = try (match tl with
 		let pl,restore,with_type = try (match tl with
-				| [t] ->
+				| [t] when not !array_match ->
 					(* context type parameters are turned into monomorphs until the pattern has been typed *)
 					(* context type parameters are turned into monomorphs until the pattern has been typed *)
 					let monos = List.map (fun _ -> mk_mono()) ctx.type_params in
 					let monos = List.map (fun _ -> mk_mono()) ctx.type_params in
 					let t = apply_params ctx.type_params monos t in
 					let t = apply_params ctx.type_params monos t in