From 84819ceb711f1ae83327e2006df9bb1003ccd65e Mon Sep 17 00:00:00 2001 From: qadeer Date: Thu, 18 Dec 2014 20:59:10 -0800 Subject: changed type checking of yield procedures so that they can only call other yielding procedures --- Test/linear/typecheck.bpl | 4 +++- Test/linear/typecheck.bpl.expect | 32 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'Test/linear') diff --git a/Test/linear/typecheck.bpl b/Test/linear/typecheck.bpl index 57080cb8..5c936dd0 100644 --- a/Test/linear/typecheck.bpl +++ b/Test/linear/typecheck.bpl @@ -65,9 +65,11 @@ procedure {:yields} {:layer 1} D() yield; } -procedure E({:linear_in "D"} a: X, {:linear_in "D"} b: X) returns ({:linear "D"} c: X, {:linear "D"} d: X) +procedure {:yields} {:layer 1} E({:linear_in "D"} a: X, {:linear_in "D"} b: X) returns ({:linear "D"} c: X, {:linear "D"} d: X) { + yield; c := a; + yield; } procedure {:yields} {:layer 0} F({:linear_in "D"} a: X) returns ({:linear "D"} c: X); diff --git a/Test/linear/typecheck.bpl.expect b/Test/linear/typecheck.bpl.expect index dddbd163..5466fe62 100644 --- a/Test/linear/typecheck.bpl.expect +++ b/Test/linear/typecheck.bpl.expect @@ -1,16 +1,16 @@ -typecheck.bpl(33,9): Error: Only simple assignment allowed on linear variable b -typecheck.bpl(35,6): Error: Only variable can be assigned to linear variable a -typecheck.bpl(37,6): Error: Only linear variable can be assigned to linear variable a -typecheck.bpl(41,6): Error: Linear variable of domain D2 cannot be assigned to linear variable of domain D -typecheck.bpl(47,9): Error: Linear variable x can occur only once in the right-hand-side of an assignment -typecheck.bpl(51,4): Error: Linear variable a can occur only once as an input parameter -typecheck.bpl(53,4): Error: Only variable can be passed to linear parameter b -typecheck.bpl(55,4): Error: The domains of formal and actual parameters must be the same -typecheck.bpl(57,4): Error: The domains of formal and actual parameters must be the same -typecheck.bpl(59,4): Error: Only a linear argument can be passed to linear parameter a -typecheck.bpl(64,4): Error: Linear variable a can occur only once as an input parameter of a parallel call -typecheck.bpl(71,0): Error: Output variable d must be available at a return -typecheck.bpl(80,0): Error: Global variable g must be available at a return -typecheck.bpl(85,7): Error: unavailable source for a linear read -typecheck.bpl(86,0): Error: Output variable r must be available at a return -15 type checking errors detected in typecheck.bpl +typecheck.bpl(33,9): Error: Only simple assignment allowed on linear variable b +typecheck.bpl(35,6): Error: Only variable can be assigned to linear variable a +typecheck.bpl(37,6): Error: Only linear variable can be assigned to linear variable a +typecheck.bpl(41,6): Error: Linear variable of domain D2 cannot be assigned to linear variable of domain D +typecheck.bpl(47,9): Error: Linear variable x can occur only once in the right-hand-side of an assignment +typecheck.bpl(51,4): Error: Linear variable a can occur only once as an input parameter +typecheck.bpl(53,4): Error: Only variable can be passed to linear parameter b +typecheck.bpl(55,4): Error: The domains of formal and actual parameters must be the same +typecheck.bpl(57,4): Error: The domains of formal and actual parameters must be the same +typecheck.bpl(59,4): Error: Only a linear argument can be passed to linear parameter a +typecheck.bpl(64,4): Error: Linear variable a can occur only once as an input parameter of a parallel call +typecheck.bpl(73,0): Error: Output variable d must be available at a return +typecheck.bpl(82,0): Error: Global variable g must be available at a return +typecheck.bpl(87,7): Error: unavailable source for a linear read +typecheck.bpl(88,0): Error: Output variable r must be available at a return +15 type checking errors detected in typecheck.bpl -- cgit v1.2.3