SysML 2.0b3 FTF Avatar
  1. OMG Issue

SYSML2_ — Invalid values can be assigned to an enum

  • Key: SYSML2_-229
  • Status: open  
  • Source: oose Innovative Informatik eG ( Mr. Tim Weilkiens)
  • Summary:

    In the following example:

    enum def Enum2 :> ScalarValues::Integer {a=1; b=2;}
    attribute x1 : Enum2 = Enum2::a;
    attribute x2 : Enum2 = 1;
    attribute x3 : Enum2 = 42;
    

    x3 is invalid, but currently, there is no validation for it.

    Mr. Ed Seidewitz wrote:
    x3 is semantically invalid, since 42 is not a legal value for Enum2, but there is currently no static validation check for it. This cannot be checked statically in general, because the bound value could be any expression returning an Integer, the value of which may not be determinable without doing a complete execution/evaluation of the model (we don’t currently have a general way to report “runtime” semantic errors like this, other than that the model will be formally “unsatisfiable”). It might be possible to add a validation constraint for the case in which the both the enumerated values and the bound value in the attribute usage are model-level evaluable expressions (which would catch the case of your x3), though the OCL could be a bit complicated. If you think it is worth it, you could file a SysML v2 Jira issue for this, though it probably not be addressed in the FTF (though we could possibly address it on the KerML side when resolving KERML_-245 to add enumeration syntax to KerML).

  • Reported: SysML 2.0b2 — Wed, 26 Jun 2024 09:58 GMT
  • Updated: Wed, 26 Jun 2024 09:58 GMT