Opened 12 years ago
Closed 12 years ago
#1980 closed defect (invalid)
SCodeFlatten fails to rename imports
Reported by: | Martin Sjölund | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
SCodeFlatten fails to rename imports that are part of a path
package N import N.X.x; package X Real x = 1.0; end X; end N; model M import N.X.x; Real r1 = N.x; Real r2 = x; end M;
Change History (8)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|
comment:2 by , 12 years ago
This model actually seems to work as intended. It only looked like it was failing because of using r instead of x at first, and bad error reporting for missing imports (see #1977). You'll have to submit a better model :)
comment:3 by , 12 years ago
These are lots of fun:
package N import Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; end N; model M import Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; // Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r1 = N.simpleWaterConstants; // Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r2 = simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r3 = Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; end M;
comment:4 by , 12 years ago
saveTotalSCode on M with the latest MSL 3.2.1 and a clean trunk gives:
model M Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r1 = .Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r2 = .Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r3 = Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; end M;
Seems correct to me, and the model instantiates fine it seems.
comment:5 by , 12 years ago
With saveTotalSCode I get:
model M Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r1 = N.simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r2 = simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r3 = Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; end M;
I guess I will try make clean.
comment:6 by , 12 years ago
Nope. Make clean still gives me the same output (which is different from yours).
comment:7 by , 12 years ago
I get the same output as Per for
adrpo@testone:~/om/build/bin$ cat m.mos loadModel(Modelica); getErrorString(); loadFile("m.mo"); getErrorString(); saveTotalSCode("m-total.mo", M); getErrorString(); readFile("m-total.mo"); getErrorString();
File m.mo
adrpo@testone:~/om/build/bin$ cat m.mo package N import Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; end N; model M import Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r1 = N.simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r2 = simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r3 = Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; end M;
result:
adrpo@testone:~/om/build/bin$ ./omc m.mos | grep -5 "model M" package N end N; model M Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r1 = .Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r2 = .Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; Modelica.Media.Water.ConstantPropertyLiquidWater.FluidConstants[1] r3 = Modelica.Media.Water.ConstantPropertyLiquidWater.simpleWaterConstants; end M;
comment:8 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Ok. rm -rf Compiler works, make clean did not. Go figure, it works in trunk so I'll just close this.
Renamed component r to x so that the model is valid.