|
The Variant type when used as just Variant (no list of types) has an implementation that uses all? to check if all types in a RHS variant can be assigned to the LHS type. This fails when the RHS Variant is empty.
An empty Variant should only be assignable from a Variant as the only meaningful interpretation of a Variant without any types to perform an OR matching operation on is that it means "all types that are actually Variant".
If an empty Variant was to be interpreted as Variant[Any}, then it is essentially the same as Any, and that is surprising.
If it was to be an error to use Variant as an expression, we need to change the entire implementation how parameterized types are formed using the AST. (It has one expression that evaluates to the base Variant type, followed by an "at" expression [T1, T2,...] that constrains/widens/defines the type instance that will be created.
When fixing this, there are numerous tests that include the Variant in the list of "all types", and this change will require a special section of tests for the Variant type.
As the result when using a "naked" Variant is both conceptually wrong and confusing, this is going to be fixed on our oldest supported version in 4.x.
|