﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1203	Replaceable package behaves different when encapsulated in a package	perob88	perob88	"Consider the following set of definitions. It is somewhat similar to the media library building blocks.
{{{#!mo
partial package partialStuff
  constant Integer nz = 1;
end partialStuff;
 
package simpleStuff
  extends testPackage.partialStuff(nz = 2);
end simpleStuff;
 
class modelComponent
  replaceable package theStuff = testPackage.partialStuff;
  Real compVar;
equation
  compVar = theStuff.nz;
end modelComponent;
}}}
Now let's instatiate the following model 
{{{#!mo
model myModel
  package theStuff = simpleStuff;
  modelComponent comp(redeclare package theStuff = theStuff);
end myModel;
}}}
This yields: OMC-ERROR: ""Error: Class myModel.theStuff not found in scope modelComponent.theStuff.

Encapsulating everything inside another package:
{{{#!mo
package testPackage
...
...
...
...
end testPackage
}}}
followed by instantiateModel(testPackage.myModel) gives correct results. 

A third variant where the only difference is another level of instantiation gives the wrong results but no compiler complaints...:
{{{#!mo
class myModel
  replaceable package theStuff = partialStuff;
  modelComponent comp(redeclare package theStuff = theStuff);
end myModel;

model myModel2
  myModel modelInst(redeclare package theStuff = simpleStuff);
end myModel2;

instantiateModel(myModel2)
.. 
..
equation
  modelInst.comp.compVar = 1.0;
}}}
Here the problem is that compVar should be 2.0 instead of 1.0"	defect	closed	high		Frontend	1.5.0RC2	fixed		
