Opened 10 years ago

Closed 10 years ago

Last modified 10 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 10 years ago.
example for the bug
trace.txt (586 bytes) - added by anonymous 10 years ago.
trace

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by anonymous

example for the bug

Changed 10 years ago by anonymous

trace

comment:1 Changed 10 years ago by adrpo

  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 10 years ago by anonymous

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 Changed 10 years ago by anonymous

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 Changed 10 years ago by sjoelund.se

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

Note: See TracTickets for help on using tickets.