Skip to content

Commit b0370a2

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Add default argument test.
Belonging to [master]: - OpenModelica/OMCompiler#2649 - OpenModelica/OpenModelica-testsuite#1031
1 parent db34e7f commit b0370a2

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// name: FuncDefaultArg2
2+
// keywords:
3+
// status: correct
4+
// cflags: -d=newInst
5+
//
6+
// Checks that default arguments are replaced with the correct expression in the
7+
// function call.
8+
//
9+
10+
function f
11+
input Real u1;
12+
input Real u2 = u1;
13+
output Real y;
14+
algorithm
15+
y := u1 + u2;
16+
end f;
17+
18+
model FuncDefaultArg2
19+
input Real a(start = 1);
20+
output Real b;
21+
equation
22+
b = f(a);
23+
end FuncDefaultArg2;
24+
25+
// Result:
26+
// function f
27+
// input Real u1;
28+
// input Real u2 = u1;
29+
// output Real y;
30+
// algorithm
31+
// y := u1 + u2;
32+
// end f;
33+
//
34+
// class FuncDefaultArg2
35+
// input Real a(start = 1.0);
36+
// output Real b;
37+
// equation
38+
// b = f(a, a);
39+
// end FuncDefaultArg2;
40+
// endResult

flattening/modelica/scodeinst/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ FuncBuiltinVectorWrongType1.mo \
433433
FuncBuiltinZeros.mo \
434434
FuncClassParam.mo \
435435
FuncDefaultArg1.mo \
436+
FuncDefaultArg2.mo \
436437
FuncDuplicateParams1.mo \
437438
FuncExtends.mo \
438439
FuncInnerParam.mo \

0 commit comments

Comments
 (0)