Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit aa363fe

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Minor fixes.
- Fix return type of pre, min and max. - Set ExpOrigin.WHEN bit also in when-statements. Belonging to [master]: - #2070 - OpenModelica/OpenModelica-testsuite#802
1 parent 117eefb commit aa363fe

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Compiler/NFFrontEnd/NFCall.mo

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ protected
958958
end if;
959959

960960
argtycall as ARG_TYPED_CALL(ComponentRef.CREF(node = fn_node), args, _) := typeNormalCall(call, origin, info);
961-
(call, ty) := matchTypedNormalCall(argtycall, info);
961+
(call, _) := matchTypedNormalCall(argtycall, info);
962962
call := unboxArgs(call);
963963

964964
{arg} := args;
@@ -967,6 +967,8 @@ protected
967967
{"First", "pre", "<REMOVE ME>"}, info);
968968
fail();
969969
end if;
970+
971+
ty := Util.tuple32(arg);
970972
end typePreCall;
971973

972974
function typeChangeCall
@@ -1046,6 +1048,7 @@ protected
10461048
argtycall as ARG_TYPED_CALL(_, args, _) := typeNormalCall(call, origin, info);
10471049
(call, ty, variability) := matchTypedNormalCall(argtycall, info);
10481050
call := unboxArgs(call);
1051+
ty := Type.arrayElementType(Util.tuple32(listHead(args)));
10491052
// TODO: check basic type in two argument overload.
10501053
// check arrays of simple types in one argument overload.
10511054
// fix return type.

Compiler/NFFrontEnd/NFTyping.mo

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,7 @@ algorithm
20852085
list<tuple<Expression, list<Statement>>> tybrs;
20862086
InstNode iterator;
20872087
MatchKind mk;
2088+
Integer next_origin;
20882089

20892090
case Statement.ASSIGNMENT()
20902091
algorithm
@@ -2125,11 +2126,13 @@ algorithm
21252126

21262127
case Statement.WHEN()
21272128
algorithm
2129+
next_origin := intBitOr(origin, ExpOrigin.WHEN);
2130+
21282131
tybrs := list(
21292132
match br case(cond, body)
21302133
algorithm
2131-
e1 := typeCondition(cond, origin, st.info, Error.WHEN_CONDITION_TYPE_ERROR, allowVector = true);
2132-
sts1 := list(typeStatement(bst, origin) for bst in body);
2134+
e1 := typeCondition(cond, next_origin, st.info, Error.WHEN_CONDITION_TYPE_ERROR, allowVector = true);
2135+
sts1 := list(typeStatement(bst, next_origin) for bst in body);
21332136
then (e1, sts1);
21342137
end match
21352138
for br in st.branches);

0 commit comments

Comments
 (0)