Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2663 closed defect (invalid)

Subscripting modifiers is not allowed.

Reported by: matthias.pfafferodt@… Owned by: somebody
Priority: high Milestone: 1.9.1
Component: Frontend Version: trunk
Keywords: Cc: matthias.pfafferodt@…

Description

I got the error 'Subscripting modifiers is not allowed. Apply the modification on the whole identifier using an array-expression or an each-modifier.
'. Example and debug output attached.

#> omc +showErrorMessages +d=failtrace OM_Bug_01.mo > trace.txt 2>&1

Run with OpenModelica version OpenModelica-1.9.1.svn.19989

The test case runs fine with Dymola.

Attachments (2)

OM_Bug_01.mo (492 bytes ) - added by anonymous 11 years ago.
example for the bug
trace.txt (586 bytes ) - added by anonymous 11 years ago.
trace

Download all attachments as: .zip

Change History (6)

by anonymous, 11 years ago

Attachment: OM_Bug_01.mo added

example for the bug

by anonymous, 11 years ago

Attachment: trace.txt added

trace

comment:1 by Adrian Pop, 11 years ago

Resolution: invalid
Status: newclosed

You model has:

record test = OM_Bug_01.Data 
  (i=1, 
   Enum[:]={Modelica.Blocks.Types.AnalogFilter.Bessel,
            Modelica.Blocks.Types.AnalogFilter.Bessel});

From the grammar of Modelica in Modelica specification 3.2 revision 2:
https://modelica.org/documents/ModelicaSpec32Revision2.pdf

element_modification : 
 name [ modification ] string_comment

name : 
 [ "." ] IDENT { "." IDENT }

modification : 
 class_modification [ "=" expression ] 
 | "=" expression 
 | ":=" expression 
 
class_modification : 
 "(" [ argument_list ] ")" 

The grammar *DOES NOT ALLOW* for array dimensions in the modifer name!

If Dymola supports it, that doesn't mean is conform to the specification.

comment:2 by anonymous, 11 years ago

Thanks for the comment! I did not know that this is not allowed ...

Could you give me a hint how to change the value of the variable 'Enum' in that case?

comment:3 by anonymous, 11 years ago

OK - I found the solution on page 71 ...

model C

parameter Real a [3];
parameter Real d;

end C;
model B

C c[5](each a ={1,2,3}, d={1,2,3,4,5});

end B;

comment:4 by Martin Sjölund, 11 years ago

You can also use E = ... rather than E[:] = ...

Note: See TracTickets for help on using tickets.