|
@@ -537,21 +537,31 @@ class inline_state ctx ethis params cf f p = object(self)
|
|
| _ -> unify_func());
|
|
| _ -> unify_func());
|
|
end;
|
|
end;
|
|
let vars = Hashtbl.create 0 in
|
|
let vars = Hashtbl.create 0 in
|
|
- let rec map_var v =
|
|
|
|
|
|
+ let rec map_var map_type v =
|
|
if not (Hashtbl.mem vars v.v_id) then begin
|
|
if not (Hashtbl.mem vars v.v_id) then begin
|
|
Hashtbl.add vars v.v_id ();
|
|
Hashtbl.add vars v.v_id ();
|
|
if not (self#read v).i_outside then begin
|
|
if not (self#read v).i_outside then begin
|
|
v.v_type <- map_type v.v_type;
|
|
v.v_type <- map_type v.v_type;
|
|
match v.v_extra with
|
|
match v.v_extra with
|
|
| Some(tl,Some e) ->
|
|
| Some(tl,Some e) ->
|
|
- v.v_extra <- Some(tl,Some (map_expr_type e));
|
|
|
|
|
|
+ v.v_extra <- Some(tl,Some (map_expr_type map_type e));
|
|
| _ ->
|
|
| _ ->
|
|
()
|
|
()
|
|
end
|
|
end
|
|
end;
|
|
end;
|
|
v
|
|
v
|
|
- and map_expr_type e = Type.map_expr_type map_expr_type map_type map_var e in
|
|
|
|
- map_expr_type e
|
|
|
|
|
|
+ and map_expr_type map_type e =
|
|
|
|
+ (*
|
|
|
|
+ No need to change typing of arguments of inlined call
|
|
|
|
+ because they were already properly typed prior to inlining.
|
|
|
|
+ *)
|
|
|
|
+ let map_type =
|
|
|
|
+ if List.memq e params then (fun t -> t)
|
|
|
|
+ else map_type
|
|
|
|
+ in
|
|
|
|
+ Type.map_expr_type (map_expr_type map_type) map_type (map_var map_type) e
|
|
|
|
+ in
|
|
|
|
+ map_expr_type map_type e
|
|
end
|
|
end
|
|
|
|
|
|
let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=false) force =
|
|
let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=false) force =
|