-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Currently, if one sets a PartialArray to have an element of type A and another element of type ArrayLikeBlock{A} (quite a common situation) the element type of the array becomes Any. This is a bit unfortunate, because if the type was kept as a Union{A, ArrayLikeBlock{A}} then getindex could infer its return type to be A, and we would have better type stability.
The fix for this would be to define our own typejoin alternative, that special cases ArrayLikeBlock to create Union types. This would be a lot like what the (unexported) Base.promote_typejoin does (see here) for Nothing and Missing. However we can't directly copy over that implementation because our special case type is an abstract type with type parameters, and we need to think through how to do this properly.
This is purely a performance optimisation, improving type stability for cases where some variables in an array are set with ranges and others are set as individual elements, and thus not very high priority.