Error incorrectly reported when setting value on specialization of numeric attribute def

Modeler (v0.8.4) incorrectedly does not accept binding or assigning literal values to attributes that are specializations of numeric types (attribute defs). The error messages are added in line comments after the statements that raise them. Summary:

attribute def SubReal :> Real;
attribute x2: SubReal := 1.0;  // Raises error: ScalarValues::Rational does not conform to TestSpecializationOfNumbers::SubRealsyside(type-error)

More extensive .sysml test file can be provided.

That’s intended because SubReal is a different type than Real. I.e. there is no way to create new literal types. This looks like a case for using alias:

alias SubReal for Real;
attribute x2: SubReal := 1.0;

Note, this is similar to new type pattern in Rust (New Type Idiom - Rust By Example and Newtype - Rust Design Patterns), and consistent with every typed programming language.