Opened 6 years ago

Last modified 3 years ago

#5474 new defect

[NF] Lookup of inner class fails

Reported by: Adrian Pop Owned by: Per Östlund
Priority: high Milestone:
Component: New Instantiation Version:
Keywords: Cc:

Description (last modified by Adrian Pop)

Trying to instantiate the inside model P fails with:

"C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/NFFrontEnd/NFLookup.mo:870:9-870:101:writable] Error: Internal error NFLookup.generateInner got top node with missing cache
[C:/home/adrpo33/dev/OpenModelica/OMCompiler/Compiler/NFFrontEnd/NFInst.mo:2318:9-2318:91:writable] Error: Internal error NFInst.instComponentExpressions got invalid component
Error: Class M.P not found in scope <top>.
"

Script to reproduce:

loadModel(Modelica); getErrorString();
loadString("
class M
  extends .Modelica.Mechanics.MultiBody.Joints.FreeMotionScalarInit;
  class P
    parameter Real x;
  end P;
end M;");  getErrorString();
instantiateModel(M.P); getErrorString();

The problem is that the lookup is done before initialization of top scope cache for inners:

  // Look up the class to instantiate and mark it as the root class.
  cls := Lookup.lookupClassName(classPath, top, Absyn.dummyInfo, checkAccessViolations = false);
  cls := InstNode.setNodeType(InstNodeType.ROOT_CLASS(InstNode.EMPTY_NODE()), cls);

  // Initialize the storage for automatically generated inner elements.
  top := InstNode.setInnerOuterCache(top, CachedData.TOP_SCOPE(NodeTree.new(), cls));

Change History (5)

comment:1 by Adrian Pop, 6 years ago

Description: modified (diff)

comment:2 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:3 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:4 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:5 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.