Skip to content

Commit 2246c30

Browse files
committed
---
yaml --- r: 333 b: refs/heads/master c: 34016d3 h: refs/heads/master i: 331: 853b00c v: v3
1 parent f46bd98 commit 2246c30

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 66181ce2ccbcca03d68b9340294dc5169da2e29e
2+
refs/heads/master: 34016d323c4268de5f34301021627f4a23ddd20e

trunk/src/boot/me/type.ml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,29 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) =
719719
None -> None
720720
| Some arg -> Some (check_atom arg)
721721
in
722+
let rec replace_args ty =
723+
match ty with
724+
Ast.TY_fn (ty_sig, ty_fn_aux) ->
725+
let orig_slots = ty_sig.Ast.sig_input_slots in
726+
let take_arg i =
727+
match args.(i) with
728+
None -> Some orig_slots.(i)
729+
| Some _ -> None
730+
in
731+
let new_slots = Array.init (Array.length args) take_arg in
732+
let new_slots = Common.arr_filter_some new_slots in
733+
let ty_sig =
734+
{ ty_sig with Ast.sig_input_slots = new_slots }
735+
in
736+
Ast.TY_fn (ty_sig, ty_fn_aux)
737+
| Ast.TY_mutable ty' -> Ast.TY_mutable (replace_args ty')
738+
| Ast.TY_constrained (ty', constrs) ->
739+
Ast.TY_constrained (replace_args ty', constrs)
740+
| _ -> Common.bug () "replace_args: unexpected type"
741+
in
722742
let callee_ty = check_lval callee in
723743
ignore (demand_fn (Array.map check_arg args) callee_ty);
724-
infer_lval callee_ty bound
744+
infer_lval (replace_args callee_ty) bound
725745

726746
| Ast.STMT_recv (dst, src) ->
727747
infer_lval (demand_port (check_lval src)) dst

0 commit comments

Comments
 (0)