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

Commit

Permalink
Update nfinst tests.
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2293
  - #885
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 20, 2018
1 parent 79692b0 commit bf7ba0b
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
36 changes: 36 additions & 0 deletions flattening/modelica/scodeinst/ClassExtends8.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// name: ClassExtends8
// keywords:
// status: correct
// cflags: -d=newInst
//

package P1
replaceable model M
Real x;
end M;
end P1;

package P2
extends P1;

redeclare model extends M
Real y;
end M;
end P2;

model ClassExtends8
package PA = P2;
package PB = P2;

PA.M m1;
PB.M m2;
end ClassExtends8;

// Result:
// class ClassExtends8
// Real m1.x;
// Real m1.y;
// Real m2.x;
// Real m2.y;
// end ClassExtends8;
// endResult
2 changes: 2 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ ClassExtends4.mo \
ClassExtends5.mo \
ClassExtends6.mo \
ClassExtends7.mo \
ClassExtends8.mo \
ClassExtendsBuiltin1.mo \
ClassExtendsBuiltin2.mo \
ClassExtendsBuiltin3.mo \
Expand Down Expand Up @@ -504,6 +505,7 @@ RangeTypeError1.mo \
RangeTypeError2.mo \
RangeTypeError3.mo \
RecursiveExtends1.mo \
RecursiveExtends3.mo \
RedeclareClass1.mo \
RedeclareClassComponent.mo \
RedeclareComponentClass.mo \
Expand Down
26 changes: 26 additions & 0 deletions flattening/modelica/scodeinst/RecursiveExtends3.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// name: RecursiveExtends3
// keywords:
// status: incorrect
// cflags: -d=newInst
//
// Checks that the compiler catches recursive extends.
//

model A
Real x;
end A;

model RecursiveExtends3
model A = A;
A a;
end RecursiveExtends3;

// Result:
// Error processing file: RecursiveExtends3.mo
// [flattening/modelica/scodeinst/RecursiveExtends3.mo:14:3-14:14:writable] Error: Recursive short class definition of A in terms of A.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult

0 comments on commit bf7ba0b

Please sign in to comment.