Replies: 1 comment
-
Currently allowed cases Intersections with readonly
Error intersections
Intersections that are going to be supported with this feature All the intersections that the intersection is nonempty
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We currently only support limited combinations for intersection types (i.e., readonly intersections and error intersections).
But according to the spec, this support should be available more generically. E.g., - the intersection of two records.
The reason to introduce
IntersectableReferenceType.java
in the implementation was a requirement to get the intersection type given the effective type since in some cases intersection type information was unavailable.This happens when there are places we return only the effective type. We decided to pass the Complete intersection type instead and get the effective type from the intersection type when needed via
getReferredType
method and removed theIntersectableReferenceType.java.
. This is because if effective types of two intersections are the same typeT
then,T
cannot hold more than one intersection type detail.eg:
Since the effective of both the type definitions is Foo, we don’t create a new type as the effective type since Foo is an existing type and we directly use it as the effective type. But Foo can only hold one intersection type.
Please share your thoughts on this.
Related discussion doc https://docs.google.com/document/d/1hKGrr3DF3TEk7LaGURmRToWyxNVekkM9cYcL-E-rRlM
Beta Was this translation helpful? Give feedback.
All reactions