It should be allowed to cast datatype to compatible enumeration. Example:
enumeration IndicatorMode as UInt8
{
OFF = 0
SOLID = 1
BLINK_SLOW = 2
BLINK_FAST = 3
}
var myint : UInt8 = 2
var myvalue : IndicatorMode = myint as IndicatorMode
Should be allowed by the checker even if there is the risk that the integer is not within range: with the explicit cast the developer has to make sure it is valid and is taking the responsibility.
It should be allowed to cast datatype to compatible enumeration. Example:
enumeration IndicatorMode as UInt8 { OFF = 0 SOLID = 1 BLINK_SLOW = 2 BLINK_FAST = 3 }
var myint : UInt8 = 2
var myvalue : IndicatorMode = myint as IndicatorMode
Should be allowed by the checker even if there is the risk that the integer is not within range: with the explicit cast the developer has to make sure it is valid and is taking the responsibility.