|
@@ -2549,17 +2549,24 @@ and type_expr ?(mode=MGet) ctx (e,p) (with_type:WithType.t) =
|
|
| EArrayDecl ((EBinop(OpArrow,_,_),_) as e1 :: el) ->
|
|
| EArrayDecl ((EBinop(OpArrow,_,_),_) as e1 :: el) ->
|
|
type_map_declaration ctx e1 el with_type p
|
|
type_map_declaration ctx e1 el with_type p
|
|
| EArrayDecl el ->
|
|
| EArrayDecl el ->
|
|
- begin match el,with_type with
|
|
|
|
- | [],WithType(t,_) ->
|
|
|
|
- let rec loop t = match follow t with
|
|
|
|
- | TAbstract({a_path = (["haxe";"ds"],"Map")},_) ->
|
|
|
|
- type_expr ctx (ENew(({tpackage=["haxe";"ds"];tname="Map";tparams=[];tsub=None},null_pos),[]),p) with_type
|
|
|
|
- | _ ->
|
|
|
|
- type_array_decl ctx el with_type p
|
|
|
|
- in
|
|
|
|
- loop t
|
|
|
|
|
|
+ begin match with_type with
|
|
|
|
+ | WithType(t,_) ->
|
|
|
|
+ begin match follow t with
|
|
|
|
+ | TAbstract({a_path = (["haxe";"ds"],"Map")},[tk;tv]) ->
|
|
|
|
+ begin match el with
|
|
|
|
+ | [] ->
|
|
|
|
+ type_expr ctx (ENew(({tpackage=["haxe";"ds"];tname="Map";tparams=[];tsub=None},null_pos),[]),p) with_type
|
|
|
|
+ | [(EDisplay _,_) as e1] ->
|
|
|
|
+ (* This must mean we're just typing the first key of a map declaration (issue #9133). *)
|
|
|
|
+ type_expr ctx e1 (WithType.with_type tk)
|
|
|
|
+ | _ ->
|
|
|
|
+ type_array_decl ctx el with_type p
|
|
|
|
+ end
|
|
| _ ->
|
|
| _ ->
|
|
type_array_decl ctx el with_type p
|
|
type_array_decl ctx el with_type p
|
|
|
|
+ end
|
|
|
|
+ | _ ->
|
|
|
|
+ type_array_decl ctx el with_type p
|
|
end
|
|
end
|
|
| EVars vl ->
|
|
| EVars vl ->
|
|
type_vars ctx vl p
|
|
type_vars ctx vl p
|