Opened 17 years ago
Closed 7 years ago
#132 closed defect (fixed)
Functions are not inherited correctly when extending packages
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | critical | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: | Francesco Casella, Adrian Pop |
Description
Attachments (1)
Change History (12)
by , 17 years ago
Attachment: | TestPackageInheritance.mo added |
---|
comment:1 by , 17 years ago
Created an attachment (id=21)
Modelica package with test cases
When extending packages, the information about replaceable functions in the base class is not handled correctly.
When trying to simulate TestPackageInheritance.Test.Test_f, the following error is obtained:
Class MyPackage.f (its type) not found in scope TestPackageInheritance.Test.Test_f.
while MyPackage should inherit the definition of f from BasePackage
When trying to simulate TestPackageInheritance.Test.Test_h_wrong, the compiler should report an error, since the redeclaration of f in WrongPackage is illegal; conversely, OMC accept the declaration and allows to simulate the model.
comment:2 by , 12 years ago
Component: | → Backend |
---|
I tried the test package with the scodeInstShortcut flag.
Test_f now works correctly
Test_g fails with: Error building simulator.
Test_h works correctly
Test_f_modified doesn't work correctly (y should be equal to -1, not to one)
Test_f_wrong should not compile (because WrongPackage.f is not compatible with BasePackage.f), but it actually compiles and run
comment:3 by , 12 years ago
Component: | Backend → Frontend |
---|---|
Owner: | changed from | to
Status: | new → assigned |
follow-up: 6 comment:5 by , 12 years ago
Partially fixed in r16060. We don't check for subtyping of redeclared elements yet.
comment:6 by , 9 years ago
comment:7 by , 9 years ago
Milestone: | → Future |
---|
comment:8 by , 8 years ago
Milestone: | Future → 2.0.0 |
---|
comment:9 by , 7 years ago
Component: | Frontend → New Instantiation |
---|
I guess the new FE should handle these cases correctly.
@perost, as you are currently working on redeclare, can you also try this test case?
comment:10 by , 7 years ago
Owner: | changed from | to
---|
comment:11 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I ran the tests with -d=newInst using v1.13.0-dev-651-gd4122a2d8 (64-bit)
The first four tests work as expected and produce the correct result.
The last test should fail, because WrongPackage.f should be a subtype of BasePackage.f but it isn't. Unfortunately, OMC still does not detect this problem.
I opened #4901 on this specific issue.
Modelica package with test cases