#1184 closed defect (fixed)
Problem with name lookup when using classDirectory()
Reported by: | Jan Brugård | Owned by: | Jan Brugård |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | Backend | Version: | |
Keywords: | Cc: | Jan Brugård |
Description
Consider the following package:
package Utilities "Utility classes usually not directly utilized by the user" extends Icons.Package; constant String RootDir=Modelica.Utilities.Files.fullPathName(classDirectory() + ".."); package Icons extends Package; partial class Package "Icon for a package class" annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}, grid={1,1}), graphics={Rectangle(extent={{-60,100},{100,-60}}, lineColor={0,0,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid),Polygon(points={{-100,60},{-60,100},{-60,60},{-100,60}}, lineColor={0,0,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid),Polygon(points={{60,-60},{100,-60},{60,-100},{60,-60}}, lineColor={0,0,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid),Rectangle(extent={{-100,60},{60,-100}}, lineColor={0,0,255}, fillColor={215,215,215}, fillPattern=FillPattern.Solid)})); end Package; end Icons; end Utilities;
Name lookup of Icons.Package in Utilities fails. However it the declaration is changed to
extends Utilities.Icons.Package;
or if the declaration of the constant is removed or changed so it does not use classDirectory(), the lookup works.
The function classDirectory() is not standardized, but nevertheless name lookup of the icon should not be affected!
Change History (4)
comment:1 by , 15 years ago
comment:2 by , 10 years ago
Cc: | brugard, → brugard |
---|---|
Component: | → Backend |
Resolution: | fixed |
Status: | closed → reopened |
The expression in the ticket description,
classDirectory() + ".."
assumes that classDirectory()
yields a string that ends with a directory separator. The current implementation yields a string without trailing separator.
Besides, some commercial libraries use classDirectory()
under the assumption that the resulting directory name is absolute, contrary to the current implementation.
Finally, the test Extends7.mo (currently in flattening/modelica/extends) does not even mention classDirectory
, so it is not a relevant test for this ticket.
comment:3 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Open a new ticket, do not resurrect 4-year old tickets from the dead: this was not a ticket to support classDirectory()
; it was to not fail in some cases for extends.
Seems to have been fixed along with the other changes made to instantiation of extends. Testcase mofiles/Extends7.mo has been added for regression testing.