-
Notifications
You must be signed in to change notification settings - Fork 332
Description
I was preparing #12994 refactor relying heavily on the intersection types and I have noticed the following defect.
The intersection types can be either 'hidden' or 'visible'.
A hidden intersection type is constructed by first creating a visible intersection type value : A&B
and then hiding part of it by a cast to only a part of the full type - e.g. (value : A&B) : A
. The hidden value still 'knows' that it is both A
and B
but needs special casts to handle calling methods of B
to 'unhide' the hidden part.
The support for hidden intersection types seems all good - Component Browser shows methods for A
as well as methods for B
with a note that this will require a cast.
But apparently the visible ones are lacking - when I have a 'visible' intersection type A & B
, the Component Browser only shows methods for type A
, excluding methods from B
- even though they are available - even without any casts.
Also the Component Browser shows both the visible and hidden part of the type for a hidden type, but for the visible type it only shows the first part from the visible type.
Actual behaviour
To illustrate:
- When I have a value that was created with a method returning an
A&B
value through a hiding cast-> A
- the Component Browser correctly shows both visible and hidden parts and shows methods both onA
andB
:
- However, when I have a value created with a method returning
-> A & B
- so both parts of the intersection type should be visible, the Component Browser only showsA
and methods onA
, completely ignoring methods onB
(even though if I explicitly type the name of the method we can see in the project that it is available and can be called without any casts)
The full project can be found here: Intersection Tests.zip
Expected behaviour
Also in (2), the Component Browser should show the full type A & B
instead of just A Components
and it should show methods from both A
and B
. Inserting a method defined on B
should not need adding casts, as they are available on such a type without casts.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status