@@ -279,6 +279,7 @@ module Pattern = struct
let v = add_local s in
PatVariable v
| ECall(e1,el) ->
+ let t = tfun (List.map (fun _ -> mk_mono()) el) t in
let e1 = type_expr ctx e1 (WithType t) in
begin match e1.eexpr,follow e1.etype with
| TField(_, FEnum(en,ef)),TFun(_,TEnum(_,tl)) ->
@@ -4003,6 +4003,9 @@ and maybe_type_against_enum ctx f with_type p =
| [t] -> loop t
| _ -> raise Exit
end
+ (* We might type against an enum constructor. *)
+ | TFun(_,tr) ->
+ loop tr
| _ ->
raise Exit
in
@@ -0,0 +1 @@
+--display Main.hx@156@type
@@ -0,0 +1,3 @@
+<type>
+v : Int -> haxe.ds.Option<Int>
+</type>