Commit a7dd606d authored by dbarbera's avatar dbarbera
Browse files

Fix type analysis for not expressions with reference element types.

parent b3a85b8e
......@@ -1212,7 +1212,8 @@ def not_expression(root, context):
expr.exprType = BOOLEAN
elif bty.kind == 'BitStringType':
expr.exprType = expr.expr.exprType
elif bty.kind == 'SequenceOfType' and bty.type.kind == 'BooleanType':
elif bty.kind == 'SequenceOfType' and \
find_basic_type(bty.type).kind == 'BooleanType':
expr.exprType = expr.expr.exprType
else:
msg = 'Bitwise operators only work with booleans '\
......
......@@ -147,51 +147,57 @@ DCL boolSeqOf3 BoolSeqOf;
CALL assert(boolSeqOf3(0), 'boolSeqOf3(0)');
/* CIF PROCEDURECALL (-86, 3250), (274, 35) */
CALL assert(boolSeqOf3(1), 'boolSeqOf3(1)');
/* CIF TASK (-148, 3300), (399, 35) */
/* CIF TASK (-60, 3300), (223, 35) */
TASK boolSeqOf3 := not boolSeqOf1;
/* CIF PROCEDURECALL (-110, 3350), (322, 35) */
CALL assert(not boolSeqOf3(0), 'not boolSeqOf3(0)');
/* CIF PROCEDURECALL (-86, 3400), (274, 35) */
CALL assert(boolSeqOf3(1), 'boolSeqOf3(1)');
/* CIF TASK (-148, 3450), (399, 35) */
TASK '------------------------------- Unary expressions -------------------------------';
/* CIF TASK (3, 3350), (95, 35) */
/* CIF TASK (3, 3500), (95, 35) */
TASK b := false;
/* CIF PROCEDURECALL (-29, 3400), (160, 35) */
/* CIF PROCEDURECALL (-29, 3550), (160, 35) */
CALL assert(not b, 'not b');
/* CIF TASK (14, 3450), (73, 35) */
/* CIF TASK (14, 3600), (73, 35) */
TASK i := 10;
/* CIF PROCEDURECALL (-37, 3500), (177, 35) */
/* CIF PROCEDURECALL (-37, 3650), (177, 35) */
CALL assert(-i = -10, '-i = -10');
/* CIF TASK (-151, 3550), (405, 35) */
/* CIF TASK (-151, 3700), (405, 35) */
TASK '------------------------------- Primary Expression -------------------------------';
/* CIF PROCEDURECALL (-84, 3600), (271, 35) */
/* CIF PROCEDURECALL (-84, 3750), (271, 35) */
CALL assert(((1 + 1) * 4) = 8, '((1 + 1) * 4) = 8');
/* CIF PROCEDURECALL (-157, 3650), (417, 35) */
/* CIF PROCEDURECALL (-157, 3800), (417, 35) */
CALL assert(if true then 1 else 2 fi = 1, 'if true then 1 else 2 fi = 1');
/* CIF PROCEDURECALL (-183, 3700), (468, 35) */
/* CIF PROCEDURECALL (-183, 3850), (468, 35) */
CALL assert(if false then 1.0 else 2.0 fi = 2.0, 'if false then 1.0 else 2.0 fi = 2.0');
/* CIF PROCEDURECALL (-475, 3750), (1052, 35) */
/* CIF PROCEDURECALL (-475, 3900), (1052, 35) */
CALL assert(if false then false else (if true then (if false then false else true fi) else false fi) fi, 'if false then false else (if true then (if false then false else true fi) else false fi) fi');
/* CIF TASK (-183, 3800), (468, 35) */
/* CIF TASK (-183, 3950), (468, 35) */
TASK '------------------------------- Extended Primary Expressions -------------------------------';
/* CIF TASK (-30, 3850), (163, 35) */
/* CIF TASK (-30, 4000), (163, 35) */
TASK fixSeqOf1 := {2, 3, 4};
/* CIF PROCEDURECALL (-95, 3900), (293, 35) */
/* CIF PROCEDURECALL (-95, 4050), (293, 35) */
CALL assert(fixSeqOf1(1) = 3, 'fixSeqOf1(1) = 3');
/* CIF TASK (-31, 3950), (164, 35) */
/* CIF TASK (-31, 4100), (164, 35) */
TASK varSeqOf1 := {2, 3, 4};
/* CIF PROCEDURECALL (-99, 4000), (300, 35) */
/* CIF PROCEDURECALL (-99, 4150), (300, 35) */
CALL assert(varSeqOf1(1) = 3, 'varSeqOf1(1) = 3');
/* CIF TASK (-68, 4050), (239, 35) */
/* CIF TASK (-68, 4200), (239, 35) */
TASK seq := {i 1, b true, f 1.0, s 'HELLO'};
/* CIF PROCEDURECALL (-47, 4100), (196, 35) */
/* CIF PROCEDURECALL (-47, 4250), (196, 35) */
CALL assert(seq!i = 1, 'seq!i = 1');
/* CIF PROCEDURECALL (-69, 4150), (241, 35) */
/* CIF PROCEDURECALL (-69, 4300), (241, 35) */
CALL assert(seq!b = true, 'seq!b = true');
/* CIF PROCEDURECALL (-59, 4200), (221, 35) */
/* CIF PROCEDURECALL (-59, 4350), (221, 35) */
CALL assert(seq!f = 1.0, 'seq!f = 1.0');
/* CIF PROCEDURECALL (-93, 4250), (289, 35) */
/* CIF PROCEDURECALL (-93, 4400), (289, 35) */
CALL assert(seq!s = 'HELLO', 'seq!s = "HELLO"');
/* CIF TASK (-51, 4300), (204, 35) */
/* CIF TASK (-51, 4450), (204, 35) */
TASK nestedSeq := {a {b {c {d 9}}}};
/* CIF PROCEDURECALL (-126, 4350), (354, 35) */
/* CIF PROCEDURECALL (-126, 4500), (354, 35) */
CALL assert(nestedSeq!a!b!c!d = 9, 'nestedSeq!a!b!c!d = 9');
/* CIF NEXTSTATE (1, 4400), (100, 50) */
/* CIF NEXTSTATE (1, 4550), (100, 50) */
NEXTSTATE Wait;
ENDSTATE;
ENDPROCESS expressions;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment