Răsfoiți Sursa

support `var n` as pattern (see #5011)

Simon Krajewski 9 ani în urmă
părinte
comite
5e5ace2187
1 a modificat fișierele cu 3 adăugiri și 0 ștergeri
  1. 3 0
      src/typing/matcher.ml

+ 3 - 0
src/typing/matcher.ml

@@ -275,6 +275,9 @@ module Pattern = struct
 					| _ ->
 					| _ ->
 						handle_ident i
 						handle_ident i
 				end
 				end
+			| EVars([s,None,None]) ->
+				let v = add_local s in
+				PatVariable v
 			| ECall(e1,el) ->
 			| ECall(e1,el) ->
 				let e1 = type_expr ctx e1 (WithType t) in
 				let e1 = type_expr ctx e1 (WithType t) in
 				begin match e1.eexpr,follow e1.etype with
 				begin match e1.eexpr,follow e1.etype with