Skip to content

Commit a33d4f3

Browse files
perostOpenModelica-Hudson
authored andcommitted
Fix NFInst.instClass for encapsulating classes.
Belonging to [master]: - OpenModelica/OMCompiler#1951 - OpenModelica/OpenModelica-testsuite#754
1 parent 1749c2e commit a33d4f3

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Compiler/NFFrontEnd/NFInst.mo

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,23 @@ algorithm
638638
then
639639
();
640640

641-
else ();
641+
// If a class has an instance of a encapsulating class, then the encapsulating
642+
// class will have been fully instantiated to allow lookup in it. This is a
643+
// rather uncommon case hopefully, so in that case just reinstantiate the class.
644+
case (Class.INSTANCED_CLASS(), _)
645+
algorithm
646+
node := InstNode.replaceClass(Class.NOT_INSTANTIATED(), node);
647+
node := expand(node);
648+
node := instClass(node, modifier, attributes, parent);
649+
then
650+
();
651+
652+
else
653+
algorithm
654+
assert(false, getInstanceName() + " got unknown class.");
655+
then
656+
();
657+
642658
end match;
643659
end instClass;
644660

0 commit comments

Comments
 (0)