This PR changes TypeInfo::Union and TypeInfo::Intersection to both use a separate struct: TypeUnion and TypeIntersection. It also changes the structure of these types from being linked lists into Vecs (using Punctuated). This also results in some new visitor methods: visit_type_union, visit_type_union_end, visit_type_intersection, and visit_type_intersection_end.
This PR also adds the ability to parse leading | and & in types, such as:
type T = | "A" | "B" | "C"
This involved adding a leading field to the TypeUnion and TypeIntersection structs, which contains an optional TokenReference.
Tests were updated to accommodate the changes, and leading | and & was added to the types test.
This PR changes
TypeInfo::Union
andTypeInfo::Intersection
to both use a separate struct:TypeUnion
andTypeIntersection
. It also changes the structure of these types from being linked lists intoVec
s (usingPunctuated
). This also results in some new visitor methods:visit_type_union
,visit_type_union_end
,visit_type_intersection
, andvisit_type_intersection_end
.This PR also adds the ability to parse leading
|
and&
in types, such as:This involved adding a
leading
field to theTypeUnion
andTypeIntersection
structs, which contains an optionalTokenReference
.Tests were updated to accommodate the changes, and leading
|
and&
was added to thetypes
test.