﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5474	[NF] Lookup of inner class fails	Adrian Pop	Per Östlund	"Trying to instantiate the inner 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:
{{{#!mo
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:

{{{#!mo
  // 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));
}}}


"	defect	new	high	1.14.0	New Instantiation				
