Opened 9 years ago
Closed 9 years ago
#3380 closed defect (fixed)
Save bug with replaceable
Reported by: | Owned by: | Adeel Asghar | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.9.3 |
Component: | OMEdit | Version: | trunk |
Keywords: | Replaceable, Package | Cc: |
Description (last modified by )
I created a model with a replaceable function inside.
When i try to save this model (included in a package with multiple files saving option), the .mo created delete the line "replaceable function ..." in the model.
Here is an example, to be placed in a package with multiple file saving option:
package Test function Functiona output Real y; algorithm y := 1; end Functiona; model Testa replaceable function func = Functiona; Real y; equation y = Functiona(); end Testa; end Test;
Change History (8)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
follow-up: 3 comment:2 by , 9 years ago
comment:3 by , 9 years ago
Replying to sjoelund.se:
OMEdit issues the following commands:
setSourceFile(Test, "/home/marsj/tmp/Test/package.mo") true save(Test) true setSourceFile(Test.Functiona, "/home/marsj/tmp/Test/Functiona.mo") true save(Test.Functiona) true setSourceFile(Test.Testa, "/home/marsj/tmp/Test/Testa.mo") true save(Test.Testa) true setSourceFile(Test.Testa.func, "/home/marsj/tmp/Test/func.mo") true save(Test.Testa.func) falseNo error-message is generated for the failed save() command.
Hello, and thank you for treating my problem.
I am not saying that the save fails. The save works but when i look inside Testa.mo, the line "replaceable function func = Functiona;" disappears. Hence when i try to re-load my package, as the replaceable line disapeared, i cant redeclare the function anymore.
I see that the model runs even after deleting the line but it is a mistake from myself since Testa should use func() and not Functiona() :
model Testa replaceable function func = Functiona; Real y; equation y = func(); end Testa;
In this configuration, the deletion of the second line (with replaceable function func = Functiona;) makes the model bug.
comment:4 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
I know, just added the log to see which command was going wrong. OMEdit expects the file Test.Testa.func to be created, but it is not.
comment:6 by , 9 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Replying to sjoelund.se:
Fixed in git.
I tried the today nightly build.
Test.Testa.func.mo is now created although it should not.
The line with replaceable in Testa disappears again.
And I have now some issue when saving the package:
[1] 09:45:39 Grammaire Erreur [U:/ETUDES/MODELICA/Tests/Test/func.mo: 3:1-3:26]: Expected the package to have within Test; but got within Test.Testa;. [2] 09:45:39 Ecriture Erreur Failed to load package Test () using MODELICAPATH U:\ETUDES\MODELICA\Tests\;C:/OpenModelica1.9.3Nightly/lib/omlibrary.
comment:7 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | reopened → assigned |
Adeel: OMEdit sets the wrong source file for the function. Also, prefixes are stripped from stored definitions. So OMEdit should not try to save the element in a separate file.
OMEdit issues the following commands:
No error-message is generated for the failed save() command.