Fixed linear typing of printf

This commit is contained in:
Cédric Pasteur 2011-12-01 13:37:58 +01:00 committed by Léonard Gérard
parent 54cde301f6
commit 80fbe6be5f

View file

@ -492,6 +492,9 @@ and collect_app env op e_list = match op with
let _, e2, e3 = assert_3 e_list in
VarsCollection.union (collect_exp env e2) (collect_exp env e3)
| Efun { qual = Module "Iostream"; name = "fprintf" | "printf" } ->
VarsCollection.prod []
| Efun f | Enode f ->
let ty_desc = Modules.find_value f in
let inputs_lins = linearities_of_arg_list ty_desc.node_inputs in
@ -563,6 +566,10 @@ and typing_app env op e_list = match op with
(** Check that the application of op to e_list can have the linearity
expected_lin. *)
and expect_app env expected_lin op e_list = match op with
| Efun { qual = Module "Iostream"; name = "fprintf" | "printf" } ->
let env = List.fold_left (fun env -> safe_expect env Ltop) env e_list in
Ltuple [], env
| Efun f | Enode f ->
let ty_desc = Modules.find_value f in
let inputs_lins = linearities_of_arg_list ty_desc.node_inputs in