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

Commit f06dd11

Browse files
perostOpenModelica-Hudson
authored andcommitted
Update nfinst tests.
Belonging to [master]: - OpenModelica/OMCompiler#2077 - #806
1 parent e322106 commit f06dd11

6 files changed

Lines changed: 123 additions & 2 deletions

File tree

flattening/modelica/scodeinst/ExtendsVisibility4.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ end ExtendsVisibility4;
2323
// Result:
2424
// Error processing file: ExtendsVisibility4.mo
2525
// [flattening/modelica/scodeinst/ExtendsVisibility4.mo:8:3-10:8:writable] Error: Illegal access of protected element f.
26-
// [flattening/modelica/scodeinst/ExtendsVisibility4.mo:19:3-19:17:writable] Error: Variable b.f not found in scope ExtendsVisibility4.
26+
// [flattening/modelica/scodeinst/ExtendsVisibility4.mo:19:3-19:17:writable] Error: Function b.f not found in scope ExtendsVisibility4.
2727
//
2828
// # Error encountered! Exiting...
2929
// # Please check the error message and the flags.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// name: ExternalObject3
2+
// keywords:
3+
// status: correct
4+
// cflags: -d=newInst
5+
//
6+
//
7+
8+
class ExtObj
9+
extends ExternalObject;
10+
11+
function constructor
12+
input Integer i;
13+
output ExtObj obj;
14+
external "C" obj = initObject();
15+
end constructor;
16+
17+
function destructor
18+
input ExtObj obj;
19+
external "C" destroyObject(obj);
20+
end destructor;
21+
end ExtObj;
22+
23+
model ExternalObject3
24+
ExtObj eo1 = ExtObj(10);
25+
end ExternalObject3;
26+
27+
// Result:
28+
// function ExtObj.constructor
29+
// input Integer i;
30+
// output ExtObj obj;
31+
//
32+
// external "C" obj = initObject();
33+
// end ExtObj.constructor;
34+
//
35+
// function ExtObj.destructor
36+
// input ExtObj obj;
37+
//
38+
// external "C" destroyObject(obj);
39+
// end ExtObj.destructor;
40+
//
41+
// class ExternalObject3
42+
// ExtObj eo1 = ExtObj.constructor(10);
43+
// end ExternalObject3;
44+
// endResult
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// name: ExternalObjectStructorCall1
2+
// keywords:
3+
// status: incorrect
4+
// cflags: -d=newInst
5+
//
6+
// Tests that it's not possible to call an external object constructor
7+
// explicitly.
8+
//
9+
10+
class ExtObj
11+
extends ExternalObject;
12+
13+
function constructor
14+
input Integer i;
15+
output ExtObj obj;
16+
external "C" obj = initObject();
17+
end constructor;
18+
19+
function destructor
20+
input ExtObj obj;
21+
external "C" destroyObject(obj);
22+
end destructor;
23+
end ExtObj;
24+
25+
model ExternalObjectStructorCall1
26+
ExtObj eo1 = ExtObj.constructor(10);
27+
end ExternalObjectStructorCall1;
28+
29+
// Result:
30+
// Error processing file: ExternalObjectStructorCall1.mo
31+
// [flattening/modelica/scodeinst/ExternalObjectStructorCall1.mo:26:3-26:38:writable] Error: Function ExtObj.constructor not found in scope ExternalObjectStructorCall1.
32+
//
33+
// # Error encountered! Exiting...
34+
// # Please check the error message and the flags.
35+
//
36+
// Execution failed!
37+
// endResult
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// name: ExternalObjectStructorCall2
2+
// keywords:
3+
// status: incorrect
4+
// cflags: -d=newInst
5+
//
6+
// Tests that it's not possible to call an external object constructor
7+
// explicitly.
8+
//
9+
10+
class ExtObj
11+
extends ExternalObject;
12+
13+
function constructor
14+
input Integer i;
15+
output ExtObj obj;
16+
external "C" obj = initObject();
17+
end constructor;
18+
19+
function destructor
20+
input ExtObj obj;
21+
external "C" destroyObject(obj);
22+
end destructor;
23+
end ExtObj;
24+
25+
model ExternalObjectStructorCall2
26+
ExtObj eo1 = ExtObj.destructor();
27+
end ExternalObjectStructorCall2;
28+
29+
// Result:
30+
// Error processing file: ExternalObjectStructorCall2.mo
31+
// [flattening/modelica/scodeinst/ExternalObjectStructorCall2.mo:26:3-26:35:writable] Error: Function ExtObj.destructor not found in scope ExternalObjectStructorCall2.
32+
//
33+
// # Error encountered! Exiting...
34+
// # Please check the error message and the flags.
35+
//
36+
// Execution failed!
37+
// endResult

flattening/modelica/scodeinst/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,12 @@ ExternalFunctionInvalidLang1.mo \
190190
ExternalFunctionInvalidSection1.mo \
191191
ExternalObject1.mo \
192192
ExternalObject2.mo \
193+
ExternalObject3.mo \
193194
ExternalObjectInvalidElement1.mo \
194195
ExternalObjectInvalidStructor1.mo \
195196
ExternalObjectMissingStructor1.mo \
197+
ExternalObjectStructorCall1.mo \
198+
ExternalObjectStructorCall2.mo \
196199
ForConnect1.mo \
197200
ForEquation1.mo \
198201
ForEquation2.mo \

flattening/modelica/scodeinst/Visibility4.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ end Visibility4;
1818
// Result:
1919
// Error processing file: Visibility4.mo
2020
// [flattening/modelica/scodeinst/Visibility4.mo:8:13-10:8:writable] Error: Illegal access of protected element f.
21-
// [flattening/modelica/scodeinst/Visibility4.mo:15:3-15:17:writable] Error: Variable a.f not found in scope Visibility4.
21+
// [flattening/modelica/scodeinst/Visibility4.mo:15:3-15:17:writable] Error: Function a.f not found in scope Visibility4.
2222
//
2323
// # Error encountered! Exiting...
2424
// # Please check the error message and the flags.

0 commit comments

Comments
 (0)