Opened 15 years ago
Last modified 15 years ago
#1190 closed defect (fixed)
Function default parameters and unknown dimensions
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Instantiation | Version: | 1.5.0RC2 |
Keywords: | Cc: | Martin Sjölund, |
Description
The issue here is of course that constants in Modelica aren't constants at
all. They can be modified when extending, etc (how fun!).
So consider the model below. Right now, OpenModelica will look at
reference_X and say: This function takes input Integer[3]. And will then
happily cache the result. Then we try to call this function below with
an Integer[4], and we get an error. We could also extend from this model
twice and setting reference_X to different dimensions in both :)
model evil constant Integer[:] reference_X = {1,2,3}; function set input Integer X[:] = reference_X; output Integer x1; algorithm x1 := X[1]; end set; Integer res1; equation res1 = set({4,5,6,7}); end evil;
Note:
See TracTickets
for help on using tickets.
Fixed the formatting of the model.