From 80fbe6be5f8fa869ede53e445ffe43e63d506ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pasteur?= Date: Thu, 1 Dec 2011 13:37:58 +0100 Subject: [PATCH] Fixed linear typing of printf --- compiler/heptagon/analysis/linear_typing.ml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/heptagon/analysis/linear_typing.ml b/compiler/heptagon/analysis/linear_typing.ml index fdc5062..6bad16d 100644 --- a/compiler/heptagon/analysis/linear_typing.ml +++ b/compiler/heptagon/analysis/linear_typing.ml @@ -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