Opened 2 years ago

Last modified 2 years ago

#5413 new defect

Class specialization for short class decls

Reported by: Jesper Mattsson Owned by: Jesper Mattsson
Priority: major Milestone:
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description

There are several problems with class specializations for short class declarations:

  • If it is different from the target class, you must do getInstRestriction() on the original InstClass, not the one returned by actualInstClass().
  • If the class is an enumeration, then its specialization is lost.
  • If the target class is a primitive type, then calling getInstRestriction() on it will throw an UnsupportedOperationException.

Change History (4)

comment:1 Changed 2 years ago by Jesper Mattsson

r10006

  • Gave primitive types (i.e. InstBuiltInClassDecl) a default class specialization of type.
  • Added "class specialization must match that of target type" to requirements for creating InstSimpleClassDecls.

comment:2 Changed 2 years ago by Jesper Mattsson

After r10006, the second point remains, but has changed character - instead of throwing an exception, getInstRestriction() for i.e. connector Dig = enum(Off, On, X) will erroneously be type rather than throwing an exception.

comment:3 Changed 2 years ago by Jesper Mattsson

r10007

Reverted one of the changes in r10006 due to failing tests.

This means that only the last bullet is fixed.

comment:4 Changed 2 years ago by Jesper Mattsson

Summary: Class scpecialization for short class declsClass specialization for short class decls

r10017

Added specialization for BuiltInClassDecl, equivalent to that for InstBuiltInClassDecl.

Note: See TracTickets for help on using tickets.