From 50b91ac7fadf1da7669e03f44230d140b0c82458 Mon Sep 17 00:00:00 2001 From: camc314 <18101008+camc314@users.noreply.github.com> Date: Tue, 5 Aug 2025 05:55:41 +0000 Subject: [PATCH] feat(ast)!: remove `IdentifierReference` from `qualifier` field of `TSImportType` (#12799) closes #12042, #12797 --- crates/oxc_ast/src/ast/ts.rs | 30 +- crates/oxc_ast/src/ast_kind_impl.rs | 1 + .../oxc_ast/src/generated/assert_layouts.rs | 20 + crates/oxc_ast/src/generated/ast_builder.rs | 85 ++- crates/oxc_ast/src/generated/ast_kind.rs | 44 +- .../oxc_ast/src/generated/derive_clone_in.rs | 46 ++ .../src/generated/derive_content_eq.rs | 17 + crates/oxc_ast/src/generated/derive_dummy.rs | 22 + crates/oxc_ast/src/generated/derive_estree.rs | 20 + .../src/generated/derive_get_address.rs | 11 + .../oxc_ast/src/generated/derive_get_span.rs | 16 + .../src/generated/derive_get_span_mut.rs | 16 + .../oxc_ast/src/generated/derive_take_in.rs | 4 + .../oxc_ast_macros/src/generated/structs.rs | 513 +++++++++--------- .../src/generated/utf8_to_utf16_converter.rs | 6 + crates/oxc_ast_visit/src/generated/visit.rs | 39 +- .../oxc_ast_visit/src/generated/visit_mut.rs | 39 +- crates/oxc_codegen/src/gen.rs | 21 + .../oxc_formatter/src/generated/ast_nodes.rs | 103 +++- crates/oxc_formatter/src/generated/format.rs | 15 + .../src/generated/format_write.rs | 26 + crates/oxc_formatter/src/write/mod.rs | 6 + crates/oxc_parser/src/ts/types.rs | 17 +- .../import-type-with-type-params.snap | 2 +- .../oxc_semantic/tests/integration/modules.rs | 30 + crates/oxc_traverse/src/generated/ancestor.rs | 161 ++++-- .../src/generated/scopes_collector.rs | 10 + crates/oxc_traverse/src/generated/traverse.rs | 30 + crates/oxc_traverse/src/generated/walk.rs | 47 +- napi/parser/generated/deserialize/js.js | 33 +- napi/parser/generated/deserialize/ts.js | 33 +- napi/parser/generated/lazy/constructors.js | 76 ++- napi/parser/generated/lazy/types.js | 35 +- napi/parser/generated/lazy/walk.js | 71 ++- npm/oxc-types/types.d.ts | 11 +- .../coverage/snapshots/estree_typescript.snap | 10 +- tasks/coverage/snapshots/semantic_babel.snap | 50 +- .../snapshots/semantic_typescript.snap | 59 +- 38 files changed, 1298 insertions(+), 477 deletions(-) diff --git a/crates/oxc_ast/src/ast/ts.rs b/crates/oxc_ast/src/ast/ts.rs index fac1d2248e787..4b019a7f7832f 100644 --- a/crates/oxc_ast/src/ast/ts.rs +++ b/crates/oxc_ast/src/ast/ts.rs @@ -1359,10 +1359,38 @@ pub struct TSImportType<'a> { pub span: Span, pub argument: TSType<'a>, pub options: Option>>, - pub qualifier: Option>, + pub qualifier: Option>, pub type_arguments: Option>>, } +/// TypeScript Import Type Qualifier +/// +/// The qualifier part of an import type that doesn't create references. +/// In `import("./a").b.c`, the `.b.c` part is the qualifier. +/// +/// Unlike `TSTypeName`, this doesn't use `IdentifierReference` because +/// these are not references to identifiers in scope, but rather property +/// accesses on the imported module type. +#[ast(visit)] +#[derive(Debug)] +#[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)] +pub enum TSImportTypeQualifier<'a> { + Identifier(Box<'a, IdentifierName<'a>>) = 0, + QualifiedName(Box<'a, TSImportTypeQualifiedName<'a>>) = 1, +} + +/// TypeScript Import Type Qualified Name +/// +/// A qualified name in an import type (e.g., `a.b.c` in `import("./module").a.b.c`) +#[ast(visit)] +#[derive(Debug)] +#[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] +pub struct TSImportTypeQualifiedName<'a> { + pub span: Span, + pub left: TSImportTypeQualifier<'a>, + pub right: IdentifierName<'a>, +} + /// TypeScript Function Type /// /// ## Examples diff --git a/crates/oxc_ast/src/ast_kind_impl.rs b/crates/oxc_ast/src/ast_kind_impl.rs index 0e82550a3635e..bb40306b96cf1 100644 --- a/crates/oxc_ast/src/ast_kind_impl.rs +++ b/crates/oxc_ast/src/ast_kind_impl.rs @@ -502,6 +502,7 @@ impl AstKind<'_> { "AssignmentTargetPropertyIdentifier".into() } Self::AssignmentTargetPropertyProperty(_) => "AssignmentTargetPropertyProperty".into(), + Self::TSImportTypeQualifiedName(_) => "TSImportTypeQualifiedName".into(), } } } diff --git a/crates/oxc_ast/src/generated/assert_layouts.rs b/crates/oxc_ast/src/generated/assert_layouts.rs index cd72040702331..137216d565350 100644 --- a/crates/oxc_ast/src/generated/assert_layouts.rs +++ b/crates/oxc_ast/src/generated/assert_layouts.rs @@ -1447,6 +1447,16 @@ const _: () = { assert!(offset_of!(TSImportType, qualifier) == 32); assert!(offset_of!(TSImportType, type_arguments) == 48); + assert!(size_of::() == 16); + assert!(align_of::() == 8); + + // Padding: 0 bytes + assert!(size_of::() == 48); + assert!(align_of::() == 8); + assert!(offset_of!(TSImportTypeQualifiedName, span) == 0); + assert!(offset_of!(TSImportTypeQualifiedName, left) == 8); + assert!(offset_of!(TSImportTypeQualifiedName, right) == 24); + // Padding: 4 bytes assert!(size_of::() == 48); assert!(align_of::() == 8); @@ -3042,6 +3052,16 @@ const _: () = { assert!(offset_of!(TSImportType, qualifier) == 20); assert!(offset_of!(TSImportType, type_arguments) == 28); + assert!(size_of::() == 8); + assert!(align_of::() == 4); + + // Padding: 0 bytes + assert!(size_of::() == 32); + assert!(align_of::() == 4); + assert!(offset_of!(TSImportTypeQualifiedName, span) == 0); + assert!(offset_of!(TSImportTypeQualifiedName, left) == 8); + assert!(offset_of!(TSImportTypeQualifiedName, right) == 16); + // Padding: 0 bytes assert!(size_of::() == 28); assert!(align_of::() == 4); diff --git a/crates/oxc_ast/src/generated/ast_builder.rs b/crates/oxc_ast/src/generated/ast_builder.rs index 22e216d09cba3..bb6d49753a419 100644 --- a/crates/oxc_ast/src/generated/ast_builder.rs +++ b/crates/oxc_ast/src/generated/ast_builder.rs @@ -10486,7 +10486,7 @@ impl<'a> AstBuilder<'a> { span: Span, argument: TSType<'a>, options: T1, - qualifier: Option>, + qualifier: Option>, type_arguments: T2, ) -> TSType<'a> where @@ -13665,7 +13665,7 @@ impl<'a> AstBuilder<'a> { span: Span, argument: TSType<'a>, options: T1, - qualifier: Option>, + qualifier: Option>, type_arguments: T2, ) -> TSTypeQueryExprName<'a> where @@ -13698,7 +13698,7 @@ impl<'a> AstBuilder<'a> { span: Span, argument: TSType<'a>, options: T1, - qualifier: Option>, + qualifier: Option>, type_arguments: T2, ) -> TSImportType<'a> where @@ -13731,7 +13731,7 @@ impl<'a> AstBuilder<'a> { span: Span, argument: TSType<'a>, options: T1, - qualifier: Option>, + qualifier: Option>, type_arguments: T2, ) -> Box<'a, TSImportType<'a>> where @@ -13744,6 +13744,83 @@ impl<'a> AstBuilder<'a> { ) } + /// Build a [`TSImportTypeQualifier::Identifier`]. + /// + /// This node contains an [`IdentifierName`] that will be stored in the memory arena. + /// + /// ## Parameters + /// * `span`: The [`Span`] covering this node + /// * `name` + #[inline] + pub fn ts_import_type_qualifier_identifier( + self, + span: Span, + name: A1, + ) -> TSImportTypeQualifier<'a> + where + A1: Into>, + { + TSImportTypeQualifier::Identifier(self.alloc_identifier_name(span, name)) + } + + /// Build a [`TSImportTypeQualifier::QualifiedName`]. + /// + /// This node contains a [`TSImportTypeQualifiedName`] that will be stored in the memory arena. + /// + /// ## Parameters + /// * `span`: The [`Span`] covering this node + /// * `left` + /// * `right` + #[inline] + pub fn ts_import_type_qualifier_qualified_name( + self, + span: Span, + left: TSImportTypeQualifier<'a>, + right: IdentifierName<'a>, + ) -> TSImportTypeQualifier<'a> { + TSImportTypeQualifier::QualifiedName( + self.alloc_ts_import_type_qualified_name(span, left, right), + ) + } + + /// Build a [`TSImportTypeQualifiedName`]. + /// + /// If you want the built node to be allocated in the memory arena, + /// use [`AstBuilder::alloc_ts_import_type_qualified_name`] instead. + /// + /// ## Parameters + /// * `span`: The [`Span`] covering this node + /// * `left` + /// * `right` + #[inline] + pub fn ts_import_type_qualified_name( + self, + span: Span, + left: TSImportTypeQualifier<'a>, + right: IdentifierName<'a>, + ) -> TSImportTypeQualifiedName<'a> { + TSImportTypeQualifiedName { span, left, right } + } + + /// Build a [`TSImportTypeQualifiedName`], and store it in the memory arena. + /// + /// Returns a [`Box`] containing the newly-allocated node. + /// If you want a stack-allocated node, use [`AstBuilder::ts_import_type_qualified_name`] instead. + /// + /// ## Parameters + /// * `span`: The [`Span`] covering this node + /// * `left` + /// * `right` + #[inline] + pub fn alloc_ts_import_type_qualified_name( + self, + span: Span, + left: TSImportTypeQualifier<'a>, + right: IdentifierName<'a>, + ) -> Box<'a, TSImportTypeQualifiedName<'a>> { + Box::new_in(self.ts_import_type_qualified_name(span, left, right), self.allocator) + } + /// Build a [`TSFunctionType`]. /// /// If you want the built node to be allocated in the memory arena, diff --git a/crates/oxc_ast/src/generated/ast_kind.rs b/crates/oxc_ast/src/generated/ast_kind.rs index 1216816e90dc8..d956a68e6a421 100644 --- a/crates/oxc_ast/src/generated/ast_kind.rs +++ b/crates/oxc_ast/src/generated/ast_kind.rs @@ -183,23 +183,24 @@ pub enum AstType { TSInferType = 166, TSTypeQuery = 167, TSImportType = 168, - TSFunctionType = 169, - TSConstructorType = 170, - TSMappedType = 171, - TSTemplateLiteralType = 172, - TSAsExpression = 173, - TSSatisfiesExpression = 174, - TSTypeAssertion = 175, - TSImportEqualsDeclaration = 176, - TSExternalModuleReference = 177, - TSNonNullExpression = 178, - Decorator = 179, - TSExportAssignment = 180, - TSNamespaceExportDeclaration = 181, - TSInstantiationExpression = 182, - JSDocNullableType = 183, - JSDocNonNullableType = 184, - JSDocUnknownType = 185, + TSImportTypeQualifiedName = 169, + TSFunctionType = 170, + TSConstructorType = 171, + TSMappedType = 172, + TSTemplateLiteralType = 173, + TSAsExpression = 174, + TSSatisfiesExpression = 175, + TSTypeAssertion = 176, + TSImportEqualsDeclaration = 177, + TSExternalModuleReference = 178, + TSNonNullExpression = 179, + Decorator = 180, + TSExportAssignment = 181, + TSNamespaceExportDeclaration = 182, + TSInstantiationExpression = 183, + JSDocNullableType = 184, + JSDocNonNullableType = 185, + JSDocUnknownType = 186, } /// Untyped AST Node Kind @@ -388,6 +389,8 @@ pub enum AstKind<'a> { TSInferType(&'a TSInferType<'a>) = AstType::TSInferType as u8, TSTypeQuery(&'a TSTypeQuery<'a>) = AstType::TSTypeQuery as u8, TSImportType(&'a TSImportType<'a>) = AstType::TSImportType as u8, + TSImportTypeQualifiedName(&'a TSImportTypeQualifiedName<'a>) = + AstType::TSImportTypeQualifiedName as u8, TSFunctionType(&'a TSFunctionType<'a>) = AstType::TSFunctionType as u8, TSConstructorType(&'a TSConstructorType<'a>) = AstType::TSConstructorType as u8, TSMappedType(&'a TSMappedType<'a>) = AstType::TSMappedType as u8, @@ -595,6 +598,7 @@ impl GetSpan for AstKind<'_> { Self::TSInferType(it) => it.span(), Self::TSTypeQuery(it) => it.span(), Self::TSImportType(it) => it.span(), + Self::TSImportTypeQualifiedName(it) => it.span(), Self::TSFunctionType(it) => it.span(), Self::TSConstructorType(it) => it.span(), Self::TSMappedType(it) => it.span(), @@ -788,6 +792,7 @@ impl GetAddress for AstKind<'_> { Self::TSInferType(it) => Address::from_ptr(it), Self::TSTypeQuery(it) => Address::from_ptr(it), Self::TSImportType(it) => Address::from_ptr(it), + Self::TSImportTypeQualifiedName(it) => Address::from_ptr(it), Self::TSFunctionType(it) => Address::from_ptr(it), Self::TSConstructorType(it) => Address::from_ptr(it), Self::TSMappedType(it) => Address::from_ptr(it), @@ -1663,6 +1668,11 @@ impl<'a> AstKind<'a> { if let Self::TSImportType(v) = self { Some(v) } else { None } } + #[inline] + pub fn as_ts_import_type_qualified_name(self) -> Option<&'a TSImportTypeQualifiedName<'a>> { + if let Self::TSImportTypeQualifiedName(v) = self { Some(v) } else { None } + } + #[inline] pub fn as_ts_function_type(self) -> Option<&'a TSFunctionType<'a>> { if let Self::TSFunctionType(v) = self { Some(v) } else { None } diff --git a/crates/oxc_ast/src/generated/derive_clone_in.rs b/crates/oxc_ast/src/generated/derive_clone_in.rs index 2f23d0bb5c0ed..d3d3bc4e2f63c 100644 --- a/crates/oxc_ast/src/generated/derive_clone_in.rs +++ b/crates/oxc_ast/src/generated/derive_clone_in.rs @@ -7448,6 +7448,52 @@ impl<'new_alloc> CloneIn<'new_alloc> for TSImportType<'_> { } } +impl<'new_alloc> CloneIn<'new_alloc> for TSImportTypeQualifier<'_> { + type Cloned = TSImportTypeQualifier<'new_alloc>; + + fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned { + match self { + Self::Identifier(it) => { + TSImportTypeQualifier::Identifier(CloneIn::clone_in(it, allocator)) + } + Self::QualifiedName(it) => { + TSImportTypeQualifier::QualifiedName(CloneIn::clone_in(it, allocator)) + } + } + } + + fn clone_in_with_semantic_ids(&self, allocator: &'new_alloc Allocator) -> Self::Cloned { + match self { + Self::Identifier(it) => TSImportTypeQualifier::Identifier( + CloneIn::clone_in_with_semantic_ids(it, allocator), + ), + Self::QualifiedName(it) => TSImportTypeQualifier::QualifiedName( + CloneIn::clone_in_with_semantic_ids(it, allocator), + ), + } + } +} + +impl<'new_alloc> CloneIn<'new_alloc> for TSImportTypeQualifiedName<'_> { + type Cloned = TSImportTypeQualifiedName<'new_alloc>; + + fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned { + TSImportTypeQualifiedName { + span: CloneIn::clone_in(&self.span, allocator), + left: CloneIn::clone_in(&self.left, allocator), + right: CloneIn::clone_in(&self.right, allocator), + } + } + + fn clone_in_with_semantic_ids(&self, allocator: &'new_alloc Allocator) -> Self::Cloned { + TSImportTypeQualifiedName { + span: CloneIn::clone_in_with_semantic_ids(&self.span, allocator), + left: CloneIn::clone_in_with_semantic_ids(&self.left, allocator), + right: CloneIn::clone_in_with_semantic_ids(&self.right, allocator), + } + } +} + impl<'new_alloc> CloneIn<'new_alloc> for TSFunctionType<'_> { type Cloned = TSFunctionType<'new_alloc>; diff --git a/crates/oxc_ast/src/generated/derive_content_eq.rs b/crates/oxc_ast/src/generated/derive_content_eq.rs index ab519651c5a1c..f3f77b773c4d5 100644 --- a/crates/oxc_ast/src/generated/derive_content_eq.rs +++ b/crates/oxc_ast/src/generated/derive_content_eq.rs @@ -2330,6 +2330,23 @@ impl ContentEq for TSImportType<'_> { } } +impl ContentEq for TSImportTypeQualifier<'_> { + fn content_eq(&self, other: &Self) -> bool { + match (self, other) { + (Self::Identifier(a), Self::Identifier(b)) => a.content_eq(b), + (Self::QualifiedName(a), Self::QualifiedName(b)) => a.content_eq(b), + _ => false, + } + } +} + +impl ContentEq for TSImportTypeQualifiedName<'_> { + fn content_eq(&self, other: &Self) -> bool { + ContentEq::content_eq(&self.left, &other.left) + && ContentEq::content_eq(&self.right, &other.right) + } +} + impl ContentEq for TSFunctionType<'_> { fn content_eq(&self, other: &Self) -> bool { ContentEq::content_eq(&self.type_parameters, &other.type_parameters) diff --git a/crates/oxc_ast/src/generated/derive_dummy.rs b/crates/oxc_ast/src/generated/derive_dummy.rs index 6307e54836e3b..328451624c5f2 100644 --- a/crates/oxc_ast/src/generated/derive_dummy.rs +++ b/crates/oxc_ast/src/generated/derive_dummy.rs @@ -2637,6 +2637,28 @@ impl<'a> Dummy<'a> for TSImportType<'a> { } } +impl<'a> Dummy<'a> for TSImportTypeQualifier<'a> { + /// Create a dummy [`TSImportTypeQualifier`]. + /// + /// Has cost of making 1 allocation (24 bytes). + fn dummy(allocator: &'a Allocator) -> Self { + Self::Identifier(Dummy::dummy(allocator)) + } +} + +impl<'a> Dummy<'a> for TSImportTypeQualifiedName<'a> { + /// Create a dummy [`TSImportTypeQualifiedName`]. + /// + /// Has cost of making 1 allocation (24 bytes). + fn dummy(allocator: &'a Allocator) -> Self { + Self { + span: Dummy::dummy(allocator), + left: Dummy::dummy(allocator), + right: Dummy::dummy(allocator), + } + } +} + impl<'a> Dummy<'a> for TSFunctionType<'a> { /// Create a dummy [`TSFunctionType`]. /// diff --git a/crates/oxc_ast/src/generated/derive_estree.rs b/crates/oxc_ast/src/generated/derive_estree.rs index a4ec629d1138b..dc33695d7ab11 100644 --- a/crates/oxc_ast/src/generated/derive_estree.rs +++ b/crates/oxc_ast/src/generated/derive_estree.rs @@ -2984,6 +2984,26 @@ impl ESTree for TSImportType<'_> { } } +impl ESTree for TSImportTypeQualifier<'_> { + fn serialize(&self, serializer: S) { + match self { + Self::Identifier(it) => it.serialize(serializer), + Self::QualifiedName(it) => it.serialize(serializer), + } + } +} + +impl ESTree for TSImportTypeQualifiedName<'_> { + fn serialize(&self, serializer: S) { + let mut state = serializer.serialize_struct(); + state.serialize_field("type", &JsonSafeString("TSImportTypeQualifiedName")); + state.serialize_field("left", &self.left); + state.serialize_field("right", &self.right); + state.serialize_span(self.span); + state.end(); + } +} + impl ESTree for TSFunctionType<'_> { fn serialize(&self, serializer: S) { let mut state = serializer.serialize_struct(); diff --git a/crates/oxc_ast/src/generated/derive_get_address.rs b/crates/oxc_ast/src/generated/derive_get_address.rs index 25430edebd691..d0bac8ebea5c5 100644 --- a/crates/oxc_ast/src/generated/derive_get_address.rs +++ b/crates/oxc_ast/src/generated/derive_get_address.rs @@ -770,6 +770,17 @@ impl GetAddress for TSTypeQueryExprName<'_> { } } +impl GetAddress for TSImportTypeQualifier<'_> { + // `#[inline]` because compiler should boil this down to a single assembly instruction + #[inline] + fn address(&self) -> Address { + match self { + Self::Identifier(it) => GetAddress::address(it), + Self::QualifiedName(it) => GetAddress::address(it), + } + } +} + impl GetAddress for TSModuleReference<'_> { // `#[inline]` because compiler should boil this down to a single assembly instruction #[inline] diff --git a/crates/oxc_ast/src/generated/derive_get_span.rs b/crates/oxc_ast/src/generated/derive_get_span.rs index 3c626d2059763..e44bba5e5d69f 100644 --- a/crates/oxc_ast/src/generated/derive_get_span.rs +++ b/crates/oxc_ast/src/generated/derive_get_span.rs @@ -2026,6 +2026,22 @@ impl GetSpan for TSImportType<'_> { } } +impl GetSpan for TSImportTypeQualifier<'_> { + fn span(&self) -> Span { + match self { + Self::Identifier(it) => GetSpan::span(&**it), + Self::QualifiedName(it) => GetSpan::span(&**it), + } + } +} + +impl GetSpan for TSImportTypeQualifiedName<'_> { + #[inline] + fn span(&self) -> Span { + self.span + } +} + impl GetSpan for TSFunctionType<'_> { #[inline] fn span(&self) -> Span { diff --git a/crates/oxc_ast/src/generated/derive_get_span_mut.rs b/crates/oxc_ast/src/generated/derive_get_span_mut.rs index 073a374e77bc2..45a3ccd73626e 100644 --- a/crates/oxc_ast/src/generated/derive_get_span_mut.rs +++ b/crates/oxc_ast/src/generated/derive_get_span_mut.rs @@ -2026,6 +2026,22 @@ impl GetSpanMut for TSImportType<'_> { } } +impl GetSpanMut for TSImportTypeQualifier<'_> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => GetSpanMut::span_mut(&mut **it), + Self::QualifiedName(it) => GetSpanMut::span_mut(&mut **it), + } + } +} + +impl GetSpanMut for TSImportTypeQualifiedName<'_> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpanMut for TSFunctionType<'_> { #[inline] fn span_mut(&mut self) -> &mut Span { diff --git a/crates/oxc_ast/src/generated/derive_take_in.rs b/crates/oxc_ast/src/generated/derive_take_in.rs index b593e63880233..ae3529392b069 100644 --- a/crates/oxc_ast/src/generated/derive_take_in.rs +++ b/crates/oxc_ast/src/generated/derive_take_in.rs @@ -434,6 +434,10 @@ impl<'a> TakeIn<'a> for TSTypeQueryExprName<'a> {} impl<'a> TakeIn<'a> for TSImportType<'a> {} +impl<'a> TakeIn<'a> for TSImportTypeQualifier<'a> {} + +impl<'a> TakeIn<'a> for TSImportTypeQualifiedName<'a> {} + impl<'a> TakeIn<'a> for TSFunctionType<'a> {} impl<'a> TakeIn<'a> for TSConstructorType<'a> {} diff --git a/crates/oxc_ast_macros/src/generated/structs.rs b/crates/oxc_ast_macros/src/generated/structs.rs index ef5fcd4c22917..772d9ed012efb 100644 --- a/crates/oxc_ast_macros/src/generated/structs.rs +++ b/crates/oxc_ast_macros/src/generated/structs.rs @@ -9,300 +9,301 @@ pub static STRUCTS: phf::Map<&'static str, StructDetails> = ::phf::Map { key: 16287231350648472473, disps: &[ (0, 0), - (0, 45), - (0, 37), - (0, 18), - (0, 48), - (0, 35), - (1, 52), - (0, 96), - (9, 103), - (0, 224), - (1, 186), - (0, 24), + (0, 16), + (0, 95), + (0, 6), + (1, 214), + (1, 83), + (0, 36), + (2, 182), + (1, 62), (0, 15), - (0, 40), - (0, 126), + (1, 172), + (0, 12), + (1, 22), + (1, 52), + (0, 130), (0, 3), - (0, 25), - (2, 3), - (17, 202), - (0, 44), - (1, 114), - (0, 4), - (0, 60), - (4, 210), - (1, 33), - (0, 23), - (0, 15), - (0, 53), - (0, 48), - (0, 208), - (1, 221), - (0, 179), - (3, 90), + (0, 30), + (2, 79), + (2, 67), + (0, 105), + (2, 230), + (0, 7), + (0, 52), + (0, 113), + (0, 2), + (1, 199), (0, 0), - (9, 71), - (1, 213), - (0, 15), - (20, 206), - (0, 0), - (3, 30), - (0, 42), - (1, 5), - (34, 174), - (0, 67), - (0, 93), - (141, 200), + (1, 3), + (2, 140), + (7, 34), + (1, 156), + (0, 13), + (0, 1), + (0, 1), + (7, 216), + (11, 204), + (2, 66), + (83, 63), (0, 0), + (11, 100), + (0, 171), + (0, 10), + (4, 163), + (0, 22), + (0, 16), + (8, 193), + (0, 25), ], entries: &[ - ("JSXFragment", StructDetails { field_order: None }), - ("TSTemplateLiteralType", StructDetails { field_order: None }), - ("Quantifier", StructDetails { field_order: Some(&[0, 1, 2, 4, 3]) }), - ("IdentifierReference", StructDetails { field_order: None }), - ("BindingPattern", StructDetails { field_order: None }), - ("TSUnknownKeyword", StructDetails { field_order: None }), - ("Elision", StructDetails { field_order: None }), - ("Decorator", StructDetails { field_order: None }), - ("UnaryExpression", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("JSXElement", StructDetails { field_order: None }), - ("TSIntrinsicKeyword", StructDetails { field_order: None }), - ("BreakStatement", StructDetails { field_order: None }), - ("TSBigIntKeyword", StructDetails { field_order: None }), - ("TSBooleanKeyword", StructDetails { field_order: None }), - ("TSEnumDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }), - ("BooleanLiteral", StructDetails { field_order: None }), - ("StaticExport", StructDetails { field_order: None }), - ("StaticImport", StructDetails { field_order: None }), - ("AwaitExpression", StructDetails { field_order: None }), - ("CatchParameter", StructDetails { field_order: None }), + ("TSFunctionType", StructDetails { field_order: None }), + ("TSTypeOperator", StructDetails { field_order: Some(&[0, 2, 1]) }), + ("YieldExpression", StructDetails { field_order: Some(&[0, 2, 1]) }), + ("TSLiteralType", StructDetails { field_order: None }), + ("Class", StructDetails { field_order: Some(&[0, 9, 1, 2, 3, 4, 5, 6, 7, 10, 11, 8]) }), + ("IfStatement", StructDetails { field_order: None }), + ("CharacterClassRange", StructDetails { field_order: None }), + ("TSObjectKeyword", StructDetails { field_order: None }), + ("TSNamedTupleMember", StructDetails { field_order: None }), + ("WhileStatement", StructDetails { field_order: None }), + ("UpdateExpression", StructDetails { field_order: Some(&[0, 2, 3, 1]) }), + ("Alternative", StructDetails { field_order: None }), + ("TSIntersectionType", StructDetails { field_order: None }), + ("TSUnionType", StructDetails { field_order: None }), + ("ArrayPattern", StructDetails { field_order: None }), + ("AssignmentTargetRest", StructDetails { field_order: None }), + ("Error", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }), + ("JSXOpeningElement", StructDetails { field_order: None }), + ("SequenceExpression", StructDetails { field_order: None }), + ("JSXSpreadAttribute", StructDetails { field_order: None }), + ("TemplateLiteral", StructDetails { field_order: None }), ("LabelIdentifier", StructDetails { field_order: None }), - ("TSRestType", StructDetails { field_order: None }), - ("TSUndefinedKeyword", StructDetails { field_order: None }), - ("JSXNamespacedName", StructDetails { field_order: None }), - ("ReturnStatement", StructDetails { field_order: None }), - ("TSConditionalType", StructDetails { field_order: None }), - ("CharacterClass", StructDetails { field_order: Some(&[0, 2, 3, 4, 1]) }), - ( - "MethodDefinition", - StructDetails { field_order: Some(&[0, 4, 1, 2, 3, 5, 6, 7, 8, 9, 10]) }, - ), - ("ObjectPattern", StructDetails { field_order: None }), - ("TSTypeParameterDeclaration", StructDetails { field_order: None }), - ("TSModuleDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }), - ("ForStatement", StructDetails { field_order: None }), - ("ImportDefaultSpecifier", StructDetails { field_order: None }), - ("DebuggerStatement", StructDetails { field_order: None }), - ("CommentNodeId", StructDetails { field_order: None }), - ("Character", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("RawTransferMetadata2", StructDetails { field_order: Some(&[1, 2, 0]) }), - ("StringLiteral", StructDetails { field_order: None }), - ("TSInferType", StructDetails { field_order: None }), - ("TSThisType", StructDetails { field_order: None }), + ("BindingPattern", StructDetails { field_order: None }), ("TSTypeAssertion", StructDetails { field_order: None }), - ("ClassStringDisjunction", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("IdentifierName", StructDetails { field_order: None }), - ("ObjectAssignmentTarget", StructDetails { field_order: None }), - ( - "Function", - StructDetails { field_order: Some(&[0, 8, 1, 9, 10, 11, 2, 3, 4, 5, 6, 7, 12, 13]) }, - ), - ("TSObjectKeyword", StructDetails { field_order: None }), - ("CharacterClassRange", StructDetails { field_order: None }), - ("ForInStatement", StructDetails { field_order: None }), - ("ExportNamedDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }), - ("TSInstantiationExpression", StructDetails { field_order: None }), - ("BoundaryAssertion", StructDetails { field_order: None }), ("NamedReference", StructDetails { field_order: None }), - ("BinaryExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }), - ("TSExportAssignment", StructDetails { field_order: None }), - ("RegExp", StructDetails { field_order: None }), - ("CallExpression", StructDetails { field_order: None }), - ("Span", StructDetails { field_order: None }), - ("JSXOpeningElement", StructDetails { field_order: None }), - ("LookAroundAssertion", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("TSModuleBlock", StructDetails { field_order: None }), - ("V8IntrinsicExpression", StructDetails { field_order: None }), + ("UnaryExpression", StructDetails { field_order: Some(&[0, 2, 1]) }), + ("EmptyStatement", StructDetails { field_order: None }), + ("ExportDefaultDeclaration", StructDetails { field_order: None }), ("ArrayAssignmentTarget", StructDetails { field_order: None }), - ("TSIndexSignature", StructDetails { field_order: None }), + ("NewExpression", StructDetails { field_order: None }), ("TSIndexSignatureName", StructDetails { field_order: None }), - ("TSTypeReference", StructDetails { field_order: None }), - ("ThisExpression", StructDetails { field_order: None }), - ("TSSatisfiesExpression", StructDetails { field_order: None }), - ("JSXClosingFragment", StructDetails { field_order: None }), - ("UnicodePropertyEscape", StructDetails { field_order: Some(&[0, 3, 4, 1, 2]) }), - ("TSTypeAliasDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }), - ("Class", StructDetails { field_order: Some(&[0, 9, 1, 2, 3, 4, 5, 6, 7, 10, 11, 8]) }), - ("ExportDefaultDeclaration", StructDetails { field_order: None }), - ("TSInterfaceBody", StructDetails { field_order: None }), - ("ParenthesizedExpression", StructDetails { field_order: None }), - ("PrivateFieldExpression", StructDetails { field_order: None }), - ("FormalParameter", StructDetails { field_order: None }), - ("ErrorLabel", StructDetails { field_order: Some(&[1, 0]) }), - ("TSOptionalType", StructDetails { field_order: None }), - ("JSXText", StructDetails { field_order: None }), - ("TSTypeParameter", StructDetails { field_order: None }), - ("RegExpPattern", StructDetails { field_order: None }), - ("ScopeId", StructDetails { field_order: None }), - ("ThrowStatement", StructDetails { field_order: None }), - ("Comment", StructDetails { field_order: None }), + ("TSNumberKeyword", StructDetails { field_order: None }), + ("PrivateInExpression", StructDetails { field_order: None }), ("TSMethodSignature", StructDetails { field_order: Some(&[0, 1, 7, 8, 9, 2, 3, 4, 5, 6]) }), - ("EmptyStatement", StructDetails { field_order: None }), - ("Pattern", StructDetails { field_order: None }), - ("TSNeverKeyword", StructDetails { field_order: None }), - ("TSInterfaceDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 4, 6, 5]) }), - ("RawTransferData", StructDetails { field_order: None }), - ("SwitchStatement", StructDetails { field_order: None }), - ("JSXAttribute", StructDetails { field_order: None }), - ("RegExpLiteral", StructDetails { field_order: None }), - ("ImportSpecifier", StructDetails { field_order: None }), - ("TSArrayType", StructDetails { field_order: None }), - ("CapturingGroup", StructDetails { field_order: None }), - ("ImportDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 3, 5]) }), - ("TSTypeOperator", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("ImportExpression", StructDetails { field_order: None }), - ("TSCallSignatureDeclaration", StructDetails { field_order: None }), + ("BoundaryAssertion", StructDetails { field_order: None }), + ("TSEnumMember", StructDetails { field_order: None }), + ("PrivateFieldExpression", StructDetails { field_order: None }), ("BlockStatement", StructDetails { field_order: None }), - ("TSLiteralType", StructDetails { field_order: None }), - ("StaticMemberExpression", StructDetails { field_order: None }), - ("AssignmentExpression", StructDetails { field_order: Some(&[0, 3, 1, 2]) }), - ("ExpressionStatement", StructDetails { field_order: None }), - ("ImportNamespaceSpecifier", StructDetails { field_order: None }), - ("Program", StructDetails { field_order: Some(&[0, 7, 1, 2, 3, 4, 5, 6]) }), - ("TSConstructorType", StructDetails { field_order: Some(&[0, 4, 1, 2, 3]) }), - ("ArrayPattern", StructDetails { field_order: None }), - ("TSTypeLiteral", StructDetails { field_order: None }), - ("ClassString", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("IfStatement", StructDetails { field_order: None }), - ("JSXClosingElement", StructDetails { field_order: None }), - ("Dot", StructDetails { field_order: None }), - ("TSNumberKeyword", StructDetails { field_order: None }), - ("TSNonNullExpression", StructDetails { field_order: None }), - ("Disjunction", StructDetails { field_order: None }), - ("TSTypeAnnotation", StructDetails { field_order: None }), - ("WithClause", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("ExportAllDeclaration", StructDetails { field_order: None }), - ("Hashbang", StructDetails { field_order: None }), - ("ClassBody", StructDetails { field_order: None }), - ("ObjectProperty", StructDetails { field_order: Some(&[0, 3, 1, 2, 4, 5, 6]) }), - ("SwitchCase", StructDetails { field_order: None }), - ("ExportSpecifier", StructDetails { field_order: None }), - ("Alternative", StructDetails { field_order: None }), - ("PrivateIdentifier", StructDetails { field_order: None }), - ("TSParenthesizedType", StructDetails { field_order: None }), + ("ComputedMemberExpression", StructDetails { field_order: None }), + ("ReferenceId", StructDetails { field_order: None }), + ("TSOptionalType", StructDetails { field_order: None }), + ("TSTupleType", StructDetails { field_order: None }), ("TSAnyKeyword", StructDetails { field_order: None }), - ("NewExpression", StructDetails { field_order: None }), + ("JSDocNonNullableType", StructDetails { field_order: None }), + ("Modifiers", StructDetails { field_order: None }), + ("TSIndexedAccessType", StructDetails { field_order: None }), ("JSXIdentifier", StructDetails { field_order: None }), ("RegExpFlags", StructDetails { field_order: None }), - ("BindingProperty", StructDetails { field_order: None }), + ("V8IntrinsicExpression", StructDetails { field_order: None }), + ("Hashbang", StructDetails { field_order: None }), + ("ClassBody", StructDetails { field_order: None }), + ("IdentifierName", StructDetails { field_order: None }), + ("FunctionBody", StructDetails { field_order: None }), + ("Directive", StructDetails { field_order: None }), + ("BindingRestElement", StructDetails { field_order: None }), + ("TSBooleanKeyword", StructDetails { field_order: None }), + ("TSInterfaceBody", StructDetails { field_order: None }), + ("Quantifier", StructDetails { field_order: Some(&[0, 1, 2, 4, 3]) }), + ("TSNonNullExpression", StructDetails { field_order: None }), + ("DynamicImport", StructDetails { field_order: None }), + ("RawTransferMetadata", StructDetails { field_order: Some(&[1, 2, 0]) }), + ( + "MethodDefinition", + StructDetails { field_order: Some(&[0, 4, 1, 2, 3, 5, 6, 7, 8, 9, 10]) }, + ), + ("LookAroundAssertion", StructDetails { field_order: Some(&[0, 2, 1]) }), + ("ForStatement", StructDetails { field_order: None }), + ("CommentNewlines", StructDetails { field_order: None }), + ("TemplateElement", StructDetails { field_order: None }), + ("SwitchStatement", StructDetails { field_order: None }), + ("Modifier", StructDetails { field_order: None }), + ("ScopeId", StructDetails { field_order: None }), + ("ExportNamedDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }), + ("DoWhileStatement", StructDetails { field_order: None }), + ("ReturnStatement", StructDetails { field_order: None }), + ("TSImportType", StructDetails { field_order: None }), + ("TSConstructorType", StructDetails { field_order: Some(&[0, 4, 1, 2, 3]) }), + ("TSImportEqualsDeclaration", StructDetails { field_order: None }), + ("RegExpLiteral", StructDetails { field_order: None }), + ("LogicalExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }), ("TSPropertySignature", StructDetails { field_order: Some(&[0, 3, 4, 5, 1, 2]) }), + ("TSTemplateLiteralType", StructDetails { field_order: None }), + ("TSEnumBody", StructDetails { field_order: None }), + ("TSInterfaceDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 4, 6, 5]) }), + ("BindingIdentifier", StructDetails { field_order: None }), + ("TSTypeQuery", StructDetails { field_order: None }), + ("TSTypeLiteral", StructDetails { field_order: None }), + ("LabeledStatement", StructDetails { field_order: None }), + ("CommentNodeId", StructDetails { field_order: None }), + ("Comment", StructDetails { field_order: None }), + ("ObjectPattern", StructDetails { field_order: None }), + ("TSImportTypeQualifiedName", StructDetails { field_order: None }), + ("FormalParameter", StructDetails { field_order: None }), + ("TSTypePredicate", StructDetails { field_order: Some(&[0, 1, 3, 2]) }), + ("IdentifierReference", StructDetails { field_order: None }), + ("TSQualifiedName", StructDetails { field_order: None }), ("TSExternalModuleReference", StructDetails { field_order: None }), - ("TSInterfaceHeritage", StructDetails { field_order: None }), - ("TSEnumMember", StructDetails { field_order: None }), + ("ObjectProperty", StructDetails { field_order: Some(&[0, 3, 1, 2, 4, 5, 6]) }), + ("IndexedReference", StructDetails { field_order: None }), ("TSAsExpression", StructDetails { field_order: None }), - ("YieldExpression", StructDetails { field_order: Some(&[0, 2, 1]) }), - ("JSDocUnknownType", StructDetails { field_order: None }), - ("TryStatement", StructDetails { field_order: None }), - ("TSQualifiedName", StructDetails { field_order: None }), - ("AssignmentTargetWithDefault", StructDetails { field_order: None }), - ("Directive", StructDetails { field_order: None }), - ("JSXMemberExpression", StructDetails { field_order: None }), - ("TSThisParameter", StructDetails { field_order: None }), - ("SequenceExpression", StructDetails { field_order: None }), - ("TaggedTemplateExpression", StructDetails { field_order: None }), - ("FunctionBody", StructDetails { field_order: None }), - ("ImportAttribute", StructDetails { field_order: None }), + ("JSXAttribute", StructDetails { field_order: None }), + ("TSParenthesizedType", StructDetails { field_order: None }), ("TSClassImplements", StructDetails { field_order: None }), - ("Super", StructDetails { field_order: None }), + ("TSSatisfiesExpression", StructDetails { field_order: None }), + ("StaticExport", StructDetails { field_order: None }), + ( + "ArrowFunctionExpression", + StructDetails { field_order: Some(&[0, 6, 7, 1, 2, 3, 4, 5, 8, 9]) }, + ), + ("PrivateIdentifier", StructDetails { field_order: None }), ( "AccessorProperty", StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4, 6, 7, 8, 9, 10]) }, ), - ("CatchClause", StructDetails { field_order: None }), - ("TSImportType", StructDetails { field_order: None }), - ("AssignmentTargetRest", StructDetails { field_order: None }), - ("LogicalExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }), - ("AssignmentTargetPropertyIdentifier", StructDetails { field_order: None }), - ("CharacterClassEscape", StructDetails { field_order: None }), - ("JSXExpressionContainer", StructDetails { field_order: None }), - ("ArrayExpression", StructDetails { field_order: None }), - ("FormalParameters", StructDetails { field_order: Some(&[0, 3, 1, 2]) }), - ("EcmaScriptModule", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }), - ("WithStatement", StructDetails { field_order: None }), - ("VariableDeclaration", StructDetails { field_order: Some(&[0, 2, 1, 3]) }), + ("Span", StructDetails { field_order: None }), + ("TSStringKeyword", StructDetails { field_order: None }), + ("CharacterClass", StructDetails { field_order: Some(&[0, 2, 3, 4, 1]) }), + ("WithClause", StructDetails { field_order: Some(&[0, 2, 1]) }), + ("ThrowStatement", StructDetails { field_order: None }), + ("TSArrayType", StructDetails { field_order: None }), ("ChainExpression", StructDetails { field_order: None }), - ("ContinueStatement", StructDetails { field_order: None }), - ("BindingRestElement", StructDetails { field_order: None }), - ("SymbolId", StructDetails { field_order: None }), - ("DynamicImport", StructDetails { field_order: None }), - ("VariableDeclarator", StructDetails { field_order: Some(&[0, 3, 1, 2, 4]) }), + ("ParenthesizedExpression", StructDetails { field_order: None }), + ("TSRestType", StructDetails { field_order: None }), + ("ThisExpression", StructDetails { field_order: None }), + ("ExportAllDeclaration", StructDetails { field_order: None }), + ("CharacterClassEscape", StructDetails { field_order: None }), + ("TSUnknownKeyword", StructDetails { field_order: None }), + ("ObjectExpression", StructDetails { field_order: None }), + ( + "Function", + StructDetails { field_order: Some(&[0, 8, 1, 9, 10, 11, 2, 3, 4, 5, 6, 7, 12, 13]) }, + ), + ("TSIndexSignature", StructDetails { field_order: None }), + ("JSXMemberExpression", StructDetails { field_order: None }), + ("TSTypeParameter", StructDetails { field_order: None }), + ("ExpressionStatement", StructDetails { field_order: None }), + ("RegExpPattern", StructDetails { field_order: None }), + ("TSConditionalType", StructDetails { field_order: None }), + ("SourceType", StructDetails { field_order: None }), + ("TSTypeParameterDeclaration", StructDetails { field_order: None }), + ("ClassString", StructDetails { field_order: Some(&[0, 2, 1]) }), ("TSVoidKeyword", StructDetails { field_order: None }), - ("LabeledStatement", StructDetails { field_order: None }), - ("BindingIdentifier", StructDetails { field_order: None }), - ("SpreadElement", StructDetails { field_order: None }), + ("TSCallSignatureDeclaration", StructDetails { field_order: None }), + ("TSNeverKeyword", StructDetails { field_order: None }), + ("ImportExpression", StructDetails { field_order: None }), + ("BreakStatement", StructDetails { field_order: None }), ("MetaProperty", StructDetails { field_order: None }), - ("TSIntersectionType", StructDetails { field_order: None }), - ("RawTransferMetadata", StructDetails { field_order: Some(&[1, 2, 0]) }), + ("TSInferType", StructDetails { field_order: None }), ("ConditionalExpression", StructDetails { field_order: None }), - ("PrivateInExpression", StructDetails { field_order: None }), - ("TSStringKeyword", StructDetails { field_order: None }), - ("ObjectExpression", StructDetails { field_order: None }), - ("TSTypeParameterInstantiation", StructDetails { field_order: None }), - ("ReferenceId", StructDetails { field_order: None }), - ("TSTypePredicate", StructDetails { field_order: Some(&[0, 1, 3, 2]) }), - ("NonMaxU32", StructDetails { field_order: None }), - ("JSXOpeningFragment", StructDetails { field_order: None }), - ("JSXSpreadAttribute", StructDetails { field_order: None }), + ("AssignmentTargetWithDefault", StructDetails { field_order: None }), + ("Elision", StructDetails { field_order: None }), + ("TryStatement", StructDetails { field_order: None }), + ("TSBigIntKeyword", StructDetails { field_order: None }), + ("ForOfStatement", StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4]) }), + ("Decorator", StructDetails { field_order: None }), + ("SwitchCase", StructDetails { field_order: None }), + ("ImportDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 3, 5]) }), + ("ImportNamespaceSpecifier", StructDetails { field_order: None }), ("FixedSizeAllocatorMetadata", StructDetails { field_order: Some(&[1, 0, 2]) }), - ("TSFunctionType", StructDetails { field_order: None }), - ("Modifiers", StructDetails { field_order: None }), - ("TSNullKeyword", StructDetails { field_order: None }), - ("TSConstructSignatureDeclaration", StructDetails { field_order: None }), + ("ImportDefaultSpecifier", StructDetails { field_order: None }), + ("StaticMemberExpression", StructDetails { field_order: None }), + ("Pattern", StructDetails { field_order: None }), + ("ImportEntry", StructDetails { field_order: None }), + ("ClassStringDisjunction", StructDetails { field_order: Some(&[0, 2, 1]) }), + ("TSInterfaceHeritage", StructDetails { field_order: None }), + ("StaticImport", StructDetails { field_order: None }), + ("SpreadElement", StructDetails { field_order: None }), + ("TSTypeParameterInstantiation", StructDetails { field_order: None }), + ("AssignmentExpression", StructDetails { field_order: Some(&[0, 3, 1, 2]) }), + ("RegExp", StructDetails { field_order: None }), ("AssignmentPattern", StructDetails { field_order: None }), - ("TemplateElementValue", StructDetails { field_order: None }), - ("ComputedMemberExpression", StructDetails { field_order: None }), - ("TSNamespaceExportDeclaration", StructDetails { field_order: None }), - ("TSSymbolKeyword", StructDetails { field_order: None }), - ("TemplateLiteral", StructDetails { field_order: None }), + ("ErrorLabel", StructDetails { field_order: Some(&[1, 0]) }), + ("JSXElement", StructDetails { field_order: None }), + ("TSTypeAliasDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 4]) }), + ("NumericLiteral", StructDetails { field_order: None }), + ("BooleanLiteral", StructDetails { field_order: None }), + ("JSXNamespacedName", StructDetails { field_order: None }), + ("TSThisType", StructDetails { field_order: None }), + ("JSXEmptyExpression", StructDetails { field_order: None }), + ("BinaryExpression", StructDetails { field_order: Some(&[0, 1, 3, 2]) }), + ("RawTransferMetadata2", StructDetails { field_order: Some(&[1, 2, 0]) }), + ("ImportSpecifier", StructDetails { field_order: None }), ( "PropertyDefinition", StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13]) }, ), + ("JSXClosingFragment", StructDetails { field_order: None }), + ("JSXText", StructDetails { field_order: None }), + ("JSXClosingElement", StructDetails { field_order: None }), + ("TSInstantiationExpression", StructDetails { field_order: None }), + ("JSXFragment", StructDetails { field_order: None }), + ("StringLiteral", StructDetails { field_order: None }), + ("TSThisParameter", StructDetails { field_order: None }), ("ExportEntry", StructDetails { field_order: Some(&[1, 0, 2, 3, 4, 5, 6]) }), - ("BigIntLiteral", StructDetails { field_order: None }), - ("Modifier", StructDetails { field_order: None }), - ("Error", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }), - ("WhileStatement", StructDetails { field_order: None }), - ("TSMappedType", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 6, 4]) }), - ("TemplateElement", StructDetails { field_order: None }), - ( - "ArrowFunctionExpression", - StructDetails { field_order: Some(&[0, 6, 7, 1, 2, 3, 4, 5, 8, 9]) }, - ), - ("NumericLiteral", StructDetails { field_order: None }), - ("TSTupleType", StructDetails { field_order: None }), + ("TSConstructSignatureDeclaration", StructDetails { field_order: None }), + ("Disjunction", StructDetails { field_order: None }), + ("TSSymbolKeyword", StructDetails { field_order: None }), + ("JSDocUnknownType", StructDetails { field_order: None }), ("NameSpan", StructDetails { field_order: Some(&[1, 0]) }), - ("TSUnionType", StructDetails { field_order: None }), - ("TSNamedTupleMember", StructDetails { field_order: None }), - ("ForOfStatement", StructDetails { field_order: Some(&[0, 5, 1, 2, 3, 4]) }), - ("IndexedReference", StructDetails { field_order: None }), - ("JSDocNullableType", StructDetails { field_order: None }), - ("JSXEmptyExpression", StructDetails { field_order: None }), - ("JSDocNonNullableType", StructDetails { field_order: None }), - ("TSTypeQuery", StructDetails { field_order: None }), - ("UpdateExpression", StructDetails { field_order: Some(&[0, 2, 3, 1]) }), - ("IgnoreGroup", StructDetails { field_order: None }), - ("DoWhileStatement", StructDetails { field_order: None }), + ("NonMaxU32", StructDetails { field_order: None }), + ("SymbolId", StructDetails { field_order: None }), + ("TSIntrinsicKeyword", StructDetails { field_order: None }), + ("WithStatement", StructDetails { field_order: None }), + ("VariableDeclaration", StructDetails { field_order: Some(&[0, 2, 1, 3]) }), + ("BigIntLiteral", StructDetails { field_order: None }), + ("Character", StructDetails { field_order: Some(&[0, 2, 1]) }), ("AssignmentTargetPropertyProperty", StructDetails { field_order: None }), - ("ImportEntry", StructDetails { field_order: None }), - ("SourceType", StructDetails { field_order: None }), + ("TSTypeReference", StructDetails { field_order: None }), + ("TSUndefinedKeyword", StructDetails { field_order: None }), + ("CatchParameter", StructDetails { field_order: None }), + ("ForInStatement", StructDetails { field_order: None }), + ("ContinueStatement", StructDetails { field_order: None }), + ("Dot", StructDetails { field_order: None }), + ("TemplateElementValue", StructDetails { field_order: None }), + ("NullLiteral", StructDetails { field_order: None }), + ("IgnoreGroup", StructDetails { field_order: None }), + ("Program", StructDetails { field_order: Some(&[0, 7, 1, 2, 3, 4, 5, 6]) }), + ("AwaitExpression", StructDetails { field_order: None }), + ("BindingProperty", StructDetails { field_order: None }), + ("FormalParameters", StructDetails { field_order: Some(&[0, 3, 1, 2]) }), + ("TSTypeAnnotation", StructDetails { field_order: None }), ("StaticBlock", StructDetails { field_order: None }), - ("TSIndexedAccessType", StructDetails { field_order: None }), + ("TSNullKeyword", StructDetails { field_order: None }), + ("JSDocNullableType", StructDetails { field_order: None }), + ("TaggedTemplateExpression", StructDetails { field_order: None }), + ("TSNamespaceExportDeclaration", StructDetails { field_order: None }), + ("ImportAttribute", StructDetails { field_order: None }), + ("EcmaScriptModule", StructDetails { field_order: Some(&[4, 0, 1, 2, 3]) }), + ("ObjectAssignmentTarget", StructDetails { field_order: None }), + ("TSExportAssignment", StructDetails { field_order: None }), + ("JSXOpeningFragment", StructDetails { field_order: None }), + ("TSModuleDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }), + ("RawTransferData", StructDetails { field_order: None }), + ("JSXExpressionContainer", StructDetails { field_order: None }), + ("CatchClause", StructDetails { field_order: None }), + ("AssignmentTargetPropertyIdentifier", StructDetails { field_order: None }), + ("UnicodePropertyEscape", StructDetails { field_order: Some(&[0, 3, 4, 1, 2]) }), + ("ArrayExpression", StructDetails { field_order: None }), + ("TSEnumDeclaration", StructDetails { field_order: Some(&[0, 1, 2, 4, 5, 3]) }), + ("TSMappedType", StructDetails { field_order: Some(&[0, 1, 2, 3, 5, 6, 4]) }), + ("Super", StructDetails { field_order: None }), + ("CapturingGroup", StructDetails { field_order: None }), + ("TSModuleBlock", StructDetails { field_order: None }), + ("DebuggerStatement", StructDetails { field_order: None }), ("JSXSpreadChild", StructDetails { field_order: None }), - ("NullLiteral", StructDetails { field_order: None }), - ("CommentNewlines", StructDetails { field_order: None }), - ("TSImportEqualsDeclaration", StructDetails { field_order: None }), - ("TSEnumBody", StructDetails { field_order: None }), + ("VariableDeclarator", StructDetails { field_order: Some(&[0, 3, 1, 2, 4]) }), + ("CallExpression", StructDetails { field_order: None }), + ("ExportSpecifier", StructDetails { field_order: None }), ], }; diff --git a/crates/oxc_ast_visit/src/generated/utf8_to_utf16_converter.rs b/crates/oxc_ast_visit/src/generated/utf8_to_utf16_converter.rs index 48148efd7760e..b1ccec4a9c75d 100644 --- a/crates/oxc_ast_visit/src/generated/utf8_to_utf16_converter.rs +++ b/crates/oxc_ast_visit/src/generated/utf8_to_utf16_converter.rs @@ -965,6 +965,12 @@ impl<'a> VisitMut<'a> for Utf8ToUtf16Converter<'_> { self.convert_offset(&mut it.span.end); } + fn visit_ts_import_type_qualified_name(&mut self, it: &mut TSImportTypeQualifiedName<'a>) { + self.convert_offset(&mut it.span.start); + walk_mut::walk_ts_import_type_qualified_name(self, it); + self.convert_offset(&mut it.span.end); + } + fn visit_ts_function_type(&mut self, it: &mut TSFunctionType<'a>) { self.convert_offset(&mut it.span.start); walk_mut::walk_ts_function_type(self, it); diff --git a/crates/oxc_ast_visit/src/generated/visit.rs b/crates/oxc_ast_visit/src/generated/visit.rs index 14752c30e59f0..a472468ab7d34 100644 --- a/crates/oxc_ast_visit/src/generated/visit.rs +++ b/crates/oxc_ast_visit/src/generated/visit.rs @@ -1094,6 +1094,16 @@ pub trait Visit<'a>: Sized { walk_ts_import_type(self, it); } + #[inline] + fn visit_ts_import_type_qualifier(&mut self, it: &TSImportTypeQualifier<'a>) { + walk_ts_import_type_qualifier(self, it); + } + + #[inline] + fn visit_ts_import_type_qualified_name(&mut self, it: &TSImportTypeQualifiedName<'a>) { + walk_ts_import_type_qualified_name(self, it); + } + #[inline] fn visit_ts_function_type(&mut self, it: &TSFunctionType<'a>) { walk_ts_function_type(self, it); @@ -3928,7 +3938,7 @@ pub mod walk { visitor.visit_object_expression(options); } if let Some(qualifier) = &it.qualifier { - visitor.visit_ts_type_name(qualifier); + visitor.visit_ts_import_type_qualifier(qualifier); } if let Some(type_arguments) = &it.type_arguments { visitor.visit_ts_type_parameter_instantiation(type_arguments); @@ -3936,6 +3946,33 @@ pub mod walk { visitor.leave_node(kind); } + #[inline] + pub fn walk_ts_import_type_qualifier<'a, V: Visit<'a>>( + visitor: &mut V, + it: &TSImportTypeQualifier<'a>, + ) { + // No `AstKind` for this type + match it { + TSImportTypeQualifier::Identifier(it) => visitor.visit_identifier_name(it), + TSImportTypeQualifier::QualifiedName(it) => { + visitor.visit_ts_import_type_qualified_name(it) + } + } + } + + #[inline] + pub fn walk_ts_import_type_qualified_name<'a, V: Visit<'a>>( + visitor: &mut V, + it: &TSImportTypeQualifiedName<'a>, + ) { + let kind = AstKind::TSImportTypeQualifiedName(visitor.alloc(it)); + visitor.enter_node(kind); + visitor.visit_span(&it.span); + visitor.visit_ts_import_type_qualifier(&it.left); + visitor.visit_identifier_name(&it.right); + visitor.leave_node(kind); + } + #[inline] pub fn walk_ts_function_type<'a, V: Visit<'a>>(visitor: &mut V, it: &TSFunctionType<'a>) { let kind = AstKind::TSFunctionType(visitor.alloc(it)); diff --git a/crates/oxc_ast_visit/src/generated/visit_mut.rs b/crates/oxc_ast_visit/src/generated/visit_mut.rs index 83e02bab5c5e4..f75213564971e 100644 --- a/crates/oxc_ast_visit/src/generated/visit_mut.rs +++ b/crates/oxc_ast_visit/src/generated/visit_mut.rs @@ -1086,6 +1086,16 @@ pub trait VisitMut<'a>: Sized { walk_ts_import_type(self, it); } + #[inline] + fn visit_ts_import_type_qualifier(&mut self, it: &mut TSImportTypeQualifier<'a>) { + walk_ts_import_type_qualifier(self, it); + } + + #[inline] + fn visit_ts_import_type_qualified_name(&mut self, it: &mut TSImportTypeQualifiedName<'a>) { + walk_ts_import_type_qualified_name(self, it); + } + #[inline] fn visit_ts_function_type(&mut self, it: &mut TSFunctionType<'a>) { walk_ts_function_type(self, it); @@ -4137,7 +4147,7 @@ pub mod walk_mut { visitor.visit_object_expression(options); } if let Some(qualifier) = &mut it.qualifier { - visitor.visit_ts_type_name(qualifier); + visitor.visit_ts_import_type_qualifier(qualifier); } if let Some(type_arguments) = &mut it.type_arguments { visitor.visit_ts_type_parameter_instantiation(type_arguments); @@ -4145,6 +4155,33 @@ pub mod walk_mut { visitor.leave_node(kind); } + #[inline] + pub fn walk_ts_import_type_qualifier<'a, V: VisitMut<'a>>( + visitor: &mut V, + it: &mut TSImportTypeQualifier<'a>, + ) { + // No `AstType` for this type + match it { + TSImportTypeQualifier::Identifier(it) => visitor.visit_identifier_name(it), + TSImportTypeQualifier::QualifiedName(it) => { + visitor.visit_ts_import_type_qualified_name(it) + } + } + } + + #[inline] + pub fn walk_ts_import_type_qualified_name<'a, V: VisitMut<'a>>( + visitor: &mut V, + it: &mut TSImportTypeQualifiedName<'a>, + ) { + let kind = AstType::TSImportTypeQualifiedName; + visitor.enter_node(kind); + visitor.visit_span(&mut it.span); + visitor.visit_ts_import_type_qualifier(&mut it.left); + visitor.visit_identifier_name(&mut it.right); + visitor.leave_node(kind); + } + #[inline] pub fn walk_ts_function_type<'a, V: VisitMut<'a>>( visitor: &mut V, diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 31b57eda13c9e..11b87e2dd4f8d 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -3491,6 +3491,27 @@ impl Gen for TSImportType<'_> { } } +impl Gen for TSImportTypeQualifier<'_> { + fn r#gen(&self, p: &mut Codegen, ctx: Context) { + match self { + TSImportTypeQualifier::Identifier(ident) => { + p.print_str(ident.name.as_str()); + } + TSImportTypeQualifier::QualifiedName(qualified) => { + qualified.print(p, ctx); + } + } + } +} + +impl Gen for TSImportTypeQualifiedName<'_> { + fn r#gen(&self, p: &mut Codegen, ctx: Context) { + self.left.print(p, ctx); + p.print_ascii_byte(b'.'); + p.print_str(self.right.name.as_str()); + } +} + impl Gen for TSTypeParameterInstantiation<'_> { fn r#gen(&self, p: &mut Codegen, ctx: Context) { p.print_str("<"); diff --git a/crates/oxc_formatter/src/generated/ast_nodes.rs b/crates/oxc_formatter/src/generated/ast_nodes.rs index d1b9e753b18c1..ecaa3f270a08c 100644 --- a/crates/oxc_formatter/src/generated/ast_nodes.rs +++ b/crates/oxc_formatter/src/generated/ast_nodes.rs @@ -196,6 +196,7 @@ pub enum AstNodes<'a> { TSInferType(&'a AstNode<'a, TSInferType<'a>>), TSTypeQuery(&'a AstNode<'a, TSTypeQuery<'a>>), TSImportType(&'a AstNode<'a, TSImportType<'a>>), + TSImportTypeQualifiedName(&'a AstNode<'a, TSImportTypeQualifiedName<'a>>), TSFunctionType(&'a AstNode<'a, TSFunctionType<'a>>), TSConstructorType(&'a AstNode<'a, TSConstructorType<'a>>), TSMappedType(&'a AstNode<'a, TSMappedType<'a>>), @@ -386,6 +387,7 @@ pub enum SiblingNode<'a> { TSInferType(&'a TSInferType<'a>), TSTypeQuery(&'a TSTypeQuery<'a>), TSImportType(&'a TSImportType<'a>), + TSImportTypeQualifiedName(&'a TSImportTypeQualifiedName<'a>), TSFunctionType(&'a TSFunctionType<'a>), TSConstructorType(&'a TSConstructorType<'a>), TSMappedType(&'a TSMappedType<'a>), @@ -1419,6 +1421,12 @@ impl<'a> From<&'a TSImportType<'a>> for SiblingNode<'a> { } } +impl<'a> From<&'a TSImportTypeQualifiedName<'a>> for SiblingNode<'a> { + fn from(node: &'a TSImportTypeQualifiedName<'a>) -> Self { + SiblingNode::TSImportTypeQualifiedName(node) + } +} + impl<'a> From<&'a TSFunctionType<'a>> for SiblingNode<'a> { fn from(node: &'a TSFunctionType<'a>) -> Self { SiblingNode::TSFunctionType(node) @@ -2106,6 +2114,17 @@ impl<'a> From<&'a TSTypeQueryExprName<'a>> for SiblingNode<'a> { } } +impl<'a> From<&'a TSImportTypeQualifier<'a>> for SiblingNode<'a> { + fn from(node: &'a TSImportTypeQualifier<'a>) -> Self { + match node { + TSImportTypeQualifier::Identifier(inner) => SiblingNode::IdentifierName(inner), + TSImportTypeQualifier::QualifiedName(inner) => { + SiblingNode::TSImportTypeQualifiedName(inner) + } + } + } +} + impl<'a> From<&'a TSModuleReference<'a>> for SiblingNode<'a> { fn from(node: &'a TSModuleReference<'a>) -> Self { match node { @@ -2289,6 +2308,7 @@ impl SiblingNode<'_> { Self::TSInferType(n) => n.span(), Self::TSTypeQuery(n) => n.span(), Self::TSImportType(n) => n.span(), + Self::TSImportTypeQualifiedName(n) => n.span(), Self::TSFunctionType(n) => n.span(), Self::TSConstructorType(n) => n.span(), Self::TSMappedType(n) => n.span(), @@ -2483,6 +2503,7 @@ impl<'a> AstNodes<'a> { Self::TSInferType(n) => n.span(), Self::TSTypeQuery(n) => n.span(), Self::TSImportType(n) => n.span(), + Self::TSImportTypeQualifiedName(n) => n.span(), Self::TSFunctionType(n) => n.span(), Self::TSConstructorType(n) => n.span(), Self::TSMappedType(n) => n.span(), @@ -2675,6 +2696,7 @@ impl<'a> AstNodes<'a> { Self::TSInferType(n) => n.parent, Self::TSTypeQuery(n) => n.parent, Self::TSImportType(n) => n.parent, + Self::TSImportTypeQualifiedName(n) => n.parent, Self::TSFunctionType(n) => n.parent, Self::TSConstructorType(n) => n.parent, Self::TSMappedType(n) => n.parent, @@ -2867,6 +2889,7 @@ impl<'a> AstNodes<'a> { Self::TSInferType(n) => SiblingNode::from(n.inner), Self::TSTypeQuery(n) => SiblingNode::from(n.inner), Self::TSImportType(n) => SiblingNode::from(n.inner), + Self::TSImportTypeQualifiedName(n) => SiblingNode::from(n.inner), Self::TSFunctionType(n) => SiblingNode::from(n.inner), Self::TSConstructorType(n) => SiblingNode::from(n.inner), Self::TSMappedType(n) => SiblingNode::from(n.inner), @@ -3059,6 +3082,7 @@ impl<'a> AstNodes<'a> { Self::TSInferType(_) => "TSInferType", Self::TSTypeQuery(_) => "TSTypeQuery", Self::TSImportType(_) => "TSImportType", + Self::TSImportTypeQualifiedName(_) => "TSImportTypeQualifiedName", Self::TSFunctionType(_) => "TSFunctionType", Self::TSConstructorType(_) => "TSConstructorType", Self::TSMappedType(_) => "TSMappedType", @@ -13228,7 +13252,7 @@ impl<'a> AstNode<'a, TSImportType<'a>> { } #[inline] - pub fn qualifier(&self) -> Option<&AstNode<'a, TSTypeName<'a>>> { + pub fn qualifier(&self) -> Option<&AstNode<'a, TSImportTypeQualifier<'a>>> { let following_node = self.inner.type_arguments.as_deref().map(SiblingNode::from).or(self.following_node); self.allocator @@ -13275,6 +13299,83 @@ impl<'a> GetSpan for AstNode<'a, TSImportType<'a>> { } } +impl<'a> AstNode<'a, TSImportTypeQualifier<'a>> { + #[inline] + pub fn as_ast_nodes(&self) -> &AstNodes<'a> { + let parent = self.parent; + let node = match self.inner { + TSImportTypeQualifier::Identifier(s) => { + AstNodes::IdentifierName(self.allocator.alloc(AstNode { + inner: s.as_ref(), + parent, + allocator: self.allocator, + following_node: self.following_node, + })) + } + TSImportTypeQualifier::QualifiedName(s) => { + AstNodes::TSImportTypeQualifiedName(self.allocator.alloc(AstNode { + inner: s.as_ref(), + parent, + allocator: self.allocator, + following_node: self.following_node, + })) + } + }; + self.allocator.alloc(node) + } +} + +impl<'a> GetSpan for AstNode<'a, TSImportTypeQualifier<'a>> { + #[inline] + fn span(&self) -> oxc_span::Span { + self.inner.span() + } +} + +impl<'a> AstNode<'a, TSImportTypeQualifiedName<'a>> { + #[inline] + pub fn left(&self) -> &AstNode<'a, TSImportTypeQualifier<'a>> { + let following_node = Some(SiblingNode::from(&self.inner.right)); + self.allocator.alloc(AstNode { + inner: &self.inner.left, + allocator: self.allocator, + parent: self.allocator.alloc(AstNodes::TSImportTypeQualifiedName(transmute_self(self))), + following_node, + }) + } + + #[inline] + pub fn right(&self) -> &AstNode<'a, IdentifierName<'a>> { + let following_node = self.following_node; + self.allocator.alloc(AstNode { + inner: &self.inner.right, + allocator: self.allocator, + parent: self.allocator.alloc(AstNodes::TSImportTypeQualifiedName(transmute_self(self))), + following_node, + }) + } + + pub fn format_leading_comments(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { + format_leading_comments(self.span()).fmt(f) + } + + pub fn format_trailing_comments(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { + format_trailing_comments( + &self.parent.as_sibling_node(), + &SiblingNode::from(self.inner), + self.following_node.as_ref(), + ) + .fmt(f) + } +} + +impl<'a> GetSpan for AstNode<'a, TSImportTypeQualifiedName<'a>> { + #[inline] + fn span(&self) -> oxc_span::Span { + self.inner.span() + } +} + impl<'a> AstNode<'a, TSFunctionType<'a>> { #[inline] pub fn type_parameters(&self) -> Option<&AstNode<'a, TSTypeParameterDeclaration<'a>>> { diff --git a/crates/oxc_formatter/src/generated/format.rs b/crates/oxc_formatter/src/generated/format.rs index a61c9a3ce657d..8142dec5e4924 100644 --- a/crates/oxc_formatter/src/generated/format.rs +++ b/crates/oxc_formatter/src/generated/format.rs @@ -2012,6 +2012,21 @@ impl<'a> Format<'a> for AstNode<'a, TSImportType<'a>> { } } +impl<'a> Format<'a> for AstNode<'a, TSImportTypeQualifier<'a>> { + fn fmt(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { + self.write(f) + } +} + +impl<'a> Format<'a> for AstNode<'a, TSImportTypeQualifiedName<'a>> { + fn fmt(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { + self.format_leading_comments(f)?; + let result = self.write(f); + self.format_trailing_comments(f)?; + result + } +} + impl<'a> Format<'a> for AstNode<'a, TSFunctionType<'a>> { fn fmt(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { self.format_leading_comments(f)?; diff --git a/crates/oxc_formatter/src/generated/format_write.rs b/crates/oxc_formatter/src/generated/format_write.rs index c96f216687aaf..813dfb02699e9 100644 --- a/crates/oxc_formatter/src/generated/format_write.rs +++ b/crates/oxc_formatter/src/generated/format_write.rs @@ -2217,6 +2217,32 @@ impl<'a> FormatWrite<'a> for AstNode<'a, TSTypeQueryExprName<'a>> { } } +impl<'a> FormatWrite<'a> for AstNode<'a, TSImportTypeQualifier<'a>> { + #[inline] + fn write(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { + let allocator = self.allocator; + let parent = self.parent; + match self.inner { + TSImportTypeQualifier::Identifier(inner) => allocator + .alloc(AstNode:: { + inner, + parent, + allocator, + following_node: self.following_node, + }) + .fmt(f), + TSImportTypeQualifier::QualifiedName(inner) => allocator + .alloc(AstNode:: { + inner, + parent, + allocator, + following_node: self.following_node, + }) + .fmt(f), + } + } +} + impl<'a> FormatWrite<'a> for AstNode<'a, TSModuleReference<'a>> { #[inline] fn write(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { diff --git a/crates/oxc_formatter/src/write/mod.rs b/crates/oxc_formatter/src/write/mod.rs index 77412a0267a4c..fdcd67fff5b69 100644 --- a/crates/oxc_formatter/src/write/mod.rs +++ b/crates/oxc_formatter/src/write/mod.rs @@ -2509,6 +2509,12 @@ impl<'a> FormatWrite<'a> for AstNode<'a, TSImportType<'a>> { } } +impl<'a> FormatWrite<'a> for AstNode<'a, TSImportTypeQualifiedName<'a>> { + fn write(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { + write!(f, [self.left(), ".", self.right()]) + } +} + impl<'a> FormatWrite<'a> for AstNode<'a, TSFunctionType<'a>> { fn write(&self, f: &mut Formatter<'_, 'a>) -> FormatResult<()> { let type_parameters = self.type_parameters(); diff --git a/crates/oxc_parser/src/ts/types.rs b/crates/oxc_parser/src/ts/types.rs index 97f76e3cc08b6..518e54f37e959 100644 --- a/crates/oxc_parser/src/ts/types.rs +++ b/crates/oxc_parser/src/ts/types.rs @@ -1005,7 +1005,8 @@ impl<'a> ParserImpl<'a> { let options = if self.eat(Kind::Comma) { Some(self.parse_object_expression()) } else { None }; self.expect(Kind::RParen); - let qualifier = if self.eat(Kind::Dot) { Some(self.parse_ts_type_name()) } else { None }; + let qualifier = + if self.eat(Kind::Dot) { Some(self.parse_ts_import_type_qualifier()) } else { None }; let type_arguments = self.parse_type_arguments_of_type_reference(); self.ast.alloc_ts_import_type( self.end_span(span), @@ -1016,6 +1017,20 @@ impl<'a> ParserImpl<'a> { ) } + fn parse_ts_import_type_qualifier(&mut self) -> TSImportTypeQualifier<'a> { + let span = self.start_span(); + let ident = self.parse_identifier_name(); + let mut left = self.ast.ts_import_type_qualifier_identifier(ident.span, ident.name); + + while self.eat(Kind::Dot) { + let right = self.parse_identifier_name(); + left = + self.ast.ts_import_type_qualifier_qualified_name(self.end_span(span), left, right); + } + + left + } + fn try_parse_constraint_of_infer_type(&mut self) -> Option> { if self.eat(Kind::Extends) { let constraint = self.context( diff --git a/crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaration/import-type-with-type-params.snap b/crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaration/import-type-with-type-params.snap index 324e102cd1af6..c75fda8373a9a 100644 --- a/crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaration/import-type-with-type-params.snap +++ b/crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaration/import-type-with-type-params.snap @@ -32,7 +32,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaratio "references": [ { "flags": "ReferenceFlags(Type)", - "id": 1, + "id": 0, "name": "Param", "node_id": 12 } diff --git a/crates/oxc_semantic/tests/integration/modules.rs b/crates/oxc_semantic/tests/integration/modules.rs index 921974dd3a5ad..3a8e76c3b42c8 100644 --- a/crates/oxc_semantic/tests/integration/modules.rs +++ b/crates/oxc_semantic/tests/integration/modules.rs @@ -22,3 +22,33 @@ fn test_import_type() { .contains_flags(SymbolFlags::TypeImport) .test(); } + +#[test] +fn test_ts_import_type_qualifier_no_reference() { + // Test that TSImportType qualifiers don't create references + // The 'b' and 'c' in import("./a").b.c should not be references + // This test verifies that the code parses without errors and creates + // the type alias symbol but no references for the qualifier parts + SemanticTester::ts(r#"type A = import("./a").b.c"#) + .has_root_symbol("A") + .contains_flags(SymbolFlags::TypeAlias) + .test(); + + // Test with nested qualifiers + SemanticTester::ts(r#"type B = import("./module").a.b.c.d"#) + .has_root_symbol("B") + .contains_flags(SymbolFlags::TypeAlias) + .test(); + + // Test with type arguments + SemanticTester::ts(r#"type C = import("./generic").Foo"#) + .has_root_symbol("C") + .contains_flags(SymbolFlags::TypeAlias) + .test(); + + // Test with qualified name and type arguments + SemanticTester::ts(r#"type D = import("./generic").a.b.Foo"#) + .has_root_symbol("D") + .contains_flags(SymbolFlags::TypeAlias) + .test(); +} diff --git a/crates/oxc_traverse/src/generated/ancestor.rs b/crates/oxc_traverse/src/generated/ancestor.rs index 0a0fe0af5a59d..cfd3cc5a60a78 100644 --- a/crates/oxc_traverse/src/generated/ancestor.rs +++ b/crates/oxc_traverse/src/generated/ancestor.rs @@ -287,35 +287,37 @@ pub(crate) enum AncestorType { TSImportTypeOptions = 262, TSImportTypeQualifier = 263, TSImportTypeTypeArguments = 264, - TSFunctionTypeTypeParameters = 265, - TSFunctionTypeThisParam = 266, - TSFunctionTypeParams = 267, - TSFunctionTypeReturnType = 268, - TSConstructorTypeTypeParameters = 269, - TSConstructorTypeParams = 270, - TSConstructorTypeReturnType = 271, - TSMappedTypeTypeParameter = 272, - TSMappedTypeNameType = 273, - TSMappedTypeTypeAnnotation = 274, - TSTemplateLiteralTypeQuasis = 275, - TSTemplateLiteralTypeTypes = 276, - TSAsExpressionExpression = 277, - TSAsExpressionTypeAnnotation = 278, - TSSatisfiesExpressionExpression = 279, - TSSatisfiesExpressionTypeAnnotation = 280, - TSTypeAssertionTypeAnnotation = 281, - TSTypeAssertionExpression = 282, - TSImportEqualsDeclarationId = 283, - TSImportEqualsDeclarationModuleReference = 284, - TSExternalModuleReferenceExpression = 285, - TSNonNullExpressionExpression = 286, - DecoratorExpression = 287, - TSExportAssignmentExpression = 288, - TSNamespaceExportDeclarationId = 289, - TSInstantiationExpressionExpression = 290, - TSInstantiationExpressionTypeArguments = 291, - JSDocNullableTypeTypeAnnotation = 292, - JSDocNonNullableTypeTypeAnnotation = 293, + TSImportTypeQualifiedNameLeft = 265, + TSImportTypeQualifiedNameRight = 266, + TSFunctionTypeTypeParameters = 267, + TSFunctionTypeThisParam = 268, + TSFunctionTypeParams = 269, + TSFunctionTypeReturnType = 270, + TSConstructorTypeTypeParameters = 271, + TSConstructorTypeParams = 272, + TSConstructorTypeReturnType = 273, + TSMappedTypeTypeParameter = 274, + TSMappedTypeNameType = 275, + TSMappedTypeTypeAnnotation = 276, + TSTemplateLiteralTypeQuasis = 277, + TSTemplateLiteralTypeTypes = 278, + TSAsExpressionExpression = 279, + TSAsExpressionTypeAnnotation = 280, + TSSatisfiesExpressionExpression = 281, + TSSatisfiesExpressionTypeAnnotation = 282, + TSTypeAssertionTypeAnnotation = 283, + TSTypeAssertionExpression = 284, + TSImportEqualsDeclarationId = 285, + TSImportEqualsDeclarationModuleReference = 286, + TSExternalModuleReferenceExpression = 287, + TSNonNullExpressionExpression = 288, + DecoratorExpression = 289, + TSExportAssignmentExpression = 290, + TSNamespaceExportDeclarationId = 291, + TSInstantiationExpressionExpression = 292, + TSInstantiationExpressionTypeArguments = 293, + JSDocNullableTypeTypeAnnotation = 294, + JSDocNonNullableTypeTypeAnnotation = 295, } /// Ancestor type used in AST traversal. @@ -826,6 +828,10 @@ pub enum Ancestor<'a, 't> { AncestorType::TSImportTypeQualifier as u16, TSImportTypeTypeArguments(TSImportTypeWithoutTypeArguments<'a, 't>) = AncestorType::TSImportTypeTypeArguments as u16, + TSImportTypeQualifiedNameLeft(TSImportTypeQualifiedNameWithoutLeft<'a, 't>) = + AncestorType::TSImportTypeQualifiedNameLeft as u16, + TSImportTypeQualifiedNameRight(TSImportTypeQualifiedNameWithoutRight<'a, 't>) = + AncestorType::TSImportTypeQualifiedNameRight as u16, TSFunctionTypeTypeParameters(TSFunctionTypeWithoutTypeParameters<'a, 't>) = AncestorType::TSFunctionTypeTypeParameters as u16, TSFunctionTypeThisParam(TSFunctionTypeWithoutThisParam<'a, 't>) = @@ -1750,6 +1756,14 @@ impl<'a, 't> Ancestor<'a, 't> { ) } + #[inline] + pub fn is_ts_import_type_qualified_name(self) -> bool { + matches!( + self, + Self::TSImportTypeQualifiedNameLeft(_) | Self::TSImportTypeQualifiedNameRight(_) + ) + } + #[inline] pub fn is_ts_function_type(self) -> bool { matches!( @@ -2155,7 +2169,6 @@ impl<'a, 't> Ancestor<'a, 't> { Self::TSTypeReferenceTypeName(_) | Self::TSQualifiedNameLeft(_) | Self::TSClassImplementsExpression(_) - | Self::TSImportTypeQualifier(_) ) } @@ -2184,6 +2197,11 @@ impl<'a, 't> Ancestor<'a, 't> { matches!(self, Self::TSTypeQueryExprName(_)) } + #[inline] + pub fn is_parent_of_ts_import_type_qualifier(self) -> bool { + matches!(self, Self::TSImportTypeQualifier(_) | Self::TSImportTypeQualifiedNameLeft(_)) + } + #[inline] pub fn is_parent_of_ts_module_reference(self) -> bool { matches!(self, Self::TSImportEqualsDeclarationModuleReference(_)) @@ -2461,6 +2479,8 @@ impl<'a, 't> GetAddress for Ancestor<'a, 't> { Self::TSImportTypeOptions(a) => a.address(), Self::TSImportTypeQualifier(a) => a.address(), Self::TSImportTypeTypeArguments(a) => a.address(), + Self::TSImportTypeQualifiedNameLeft(a) => a.address(), + Self::TSImportTypeQualifiedNameRight(a) => a.address(), Self::TSFunctionTypeTypeParameters(a) => a.address(), Self::TSFunctionTypeThisParam(a) => a.address(), Self::TSFunctionTypeParams(a) => a.address(), @@ -14258,10 +14278,10 @@ impl<'a, 't> TSImportTypeWithoutArgument<'a, 't> { } #[inline] - pub fn qualifier(self) -> &'t Option> { + pub fn qualifier(self) -> &'t Option> { unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *const Option>) + as *const Option>) } } @@ -14302,10 +14322,10 @@ impl<'a, 't> TSImportTypeWithoutOptions<'a, 't> { } #[inline] - pub fn qualifier(self) -> &'t Option> { + pub fn qualifier(self) -> &'t Option> { unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *const Option>) + as *const Option>) } } @@ -14398,10 +14418,10 @@ impl<'a, 't> TSImportTypeWithoutTypeArguments<'a, 't> { } #[inline] - pub fn qualifier(self) -> &'t Option> { + pub fn qualifier(self) -> &'t Option> { unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *const Option>) + as *const Option>) } } } @@ -14413,6 +14433,75 @@ impl<'a, 't> GetAddress for TSImportTypeWithoutTypeArguments<'a, 't> { } } +pub(crate) const OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_SPAN: usize = + offset_of!(TSImportTypeQualifiedName, span); +pub(crate) const OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_LEFT: usize = + offset_of!(TSImportTypeQualifiedName, left); +pub(crate) const OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_RIGHT: usize = + offset_of!(TSImportTypeQualifiedName, right); + +#[repr(transparent)] +#[derive(Clone, Copy, Debug)] +pub struct TSImportTypeQualifiedNameWithoutLeft<'a, 't>( + pub(crate) *const TSImportTypeQualifiedName<'a>, + pub(crate) PhantomData<&'t ()>, +); + +impl<'a, 't> TSImportTypeQualifiedNameWithoutLeft<'a, 't> { + #[inline] + pub fn span(self) -> &'t Span { + unsafe { + &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_SPAN) as *const Span) + } + } + + #[inline] + pub fn right(self) -> &'t IdentifierName<'a> { + unsafe { + &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_RIGHT) + as *const IdentifierName<'a>) + } + } +} + +impl<'a, 't> GetAddress for TSImportTypeQualifiedNameWithoutLeft<'a, 't> { + #[inline] + fn address(&self) -> Address { + Address::from_ptr(self.0) + } +} + +#[repr(transparent)] +#[derive(Clone, Copy, Debug)] +pub struct TSImportTypeQualifiedNameWithoutRight<'a, 't>( + pub(crate) *const TSImportTypeQualifiedName<'a>, + pub(crate) PhantomData<&'t ()>, +); + +impl<'a, 't> TSImportTypeQualifiedNameWithoutRight<'a, 't> { + #[inline] + pub fn span(self) -> &'t Span { + unsafe { + &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_SPAN) as *const Span) + } + } + + #[inline] + pub fn left(self) -> &'t TSImportTypeQualifier<'a> { + unsafe { + &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_LEFT) + as *const TSImportTypeQualifier<'a>) + } + } +} + +impl<'a, 't> GetAddress for TSImportTypeQualifiedNameWithoutRight<'a, 't> { + #[inline] + fn address(&self) -> Address { + Address::from_ptr(self.0) + } +} + pub(crate) const OFFSET_TS_FUNCTION_TYPE_SPAN: usize = offset_of!(TSFunctionType, span); pub(crate) const OFFSET_TS_FUNCTION_TYPE_TYPE_PARAMETERS: usize = offset_of!(TSFunctionType, type_parameters); diff --git a/crates/oxc_traverse/src/generated/scopes_collector.rs b/crates/oxc_traverse/src/generated/scopes_collector.rs index 91f5b25a71881..dab9532082f4b 100644 --- a/crates/oxc_traverse/src/generated/scopes_collector.rs +++ b/crates/oxc_traverse/src/generated/scopes_collector.rs @@ -1906,6 +1906,16 @@ impl<'a> Visit<'a> for ChildScopeCollector { } } + #[inline(always)] + fn visit_ts_import_type_qualifier(&mut self, it: &TSImportTypeQualifier<'a>) { + // Enum does not contain a scope. Halt traversal. + } + + #[inline(always)] + fn visit_ts_import_type_qualified_name(&mut self, it: &TSImportTypeQualifiedName<'a>) { + // Struct does not contain a scope. Halt traversal. + } + #[inline] fn visit_ts_function_type(&mut self, it: &TSFunctionType<'a>) { self.add_scope(&it.scope_id); diff --git a/crates/oxc_traverse/src/generated/traverse.rs b/crates/oxc_traverse/src/generated/traverse.rs index 3d74113147cb9..87dbf36c262df 100644 --- a/crates/oxc_traverse/src/generated/traverse.rs +++ b/crates/oxc_traverse/src/generated/traverse.rs @@ -2812,6 +2812,36 @@ pub trait Traverse<'a, State> { ) { } + #[inline] + fn enter_ts_import_type_qualifier( + &mut self, + node: &mut TSImportTypeQualifier<'a>, + ctx: &mut TraverseCtx<'a, State>, + ) { + } + #[inline] + fn exit_ts_import_type_qualifier( + &mut self, + node: &mut TSImportTypeQualifier<'a>, + ctx: &mut TraverseCtx<'a, State>, + ) { + } + + #[inline] + fn enter_ts_import_type_qualified_name( + &mut self, + node: &mut TSImportTypeQualifiedName<'a>, + ctx: &mut TraverseCtx<'a, State>, + ) { + } + #[inline] + fn exit_ts_import_type_qualified_name( + &mut self, + node: &mut TSImportTypeQualifiedName<'a>, + ctx: &mut TraverseCtx<'a, State>, + ) { + } + #[inline] fn enter_ts_function_type( &mut self, diff --git a/crates/oxc_traverse/src/generated/walk.rs b/crates/oxc_traverse/src/generated/walk.rs index 4b2530bf5b7c1..38f6bca247258 100644 --- a/crates/oxc_traverse/src/generated/walk.rs +++ b/crates/oxc_traverse/src/generated/walk.rs @@ -5154,10 +5154,10 @@ unsafe fn walk_ts_import_type<'a, State, Tr: Traverse<'a, State>>( walk_object_expression(traverser, (&mut **field) as *mut _, ctx); } if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *mut Option) + as *mut Option) { ctx.retag_stack(AncestorType::TSImportTypeQualifier); - walk_ts_type_name(traverser, field as *mut _, ctx); + walk_ts_import_type_qualifier(traverser, field as *mut _, ctx); } if let Some(field) = &mut *((node as *mut u8) .add(ancestor::OFFSET_TS_IMPORT_TYPE_TYPE_ARGUMENTS) @@ -5170,6 +5170,49 @@ unsafe fn walk_ts_import_type<'a, State, Tr: Traverse<'a, State>>( traverser.exit_ts_import_type(&mut *node, ctx); } +unsafe fn walk_ts_import_type_qualifier<'a, State, Tr: Traverse<'a, State>>( + traverser: &mut Tr, + node: *mut TSImportTypeQualifier<'a>, + ctx: &mut TraverseCtx<'a, State>, +) { + traverser.enter_ts_import_type_qualifier(&mut *node, ctx); + match &mut *node { + TSImportTypeQualifier::Identifier(node) => { + walk_identifier_name(traverser, (&mut **node) as *mut _, ctx) + } + TSImportTypeQualifier::QualifiedName(node) => { + walk_ts_import_type_qualified_name(traverser, (&mut **node) as *mut _, ctx) + } + } + traverser.exit_ts_import_type_qualifier(&mut *node, ctx); +} + +unsafe fn walk_ts_import_type_qualified_name<'a, State, Tr: Traverse<'a, State>>( + traverser: &mut Tr, + node: *mut TSImportTypeQualifiedName<'a>, + ctx: &mut TraverseCtx<'a, State>, +) { + traverser.enter_ts_import_type_qualified_name(&mut *node, ctx); + let pop_token = ctx.push_stack(Ancestor::TSImportTypeQualifiedNameLeft( + ancestor::TSImportTypeQualifiedNameWithoutLeft(node, PhantomData), + )); + walk_ts_import_type_qualifier( + traverser, + (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_LEFT) + as *mut TSImportTypeQualifier, + ctx, + ); + ctx.retag_stack(AncestorType::TSImportTypeQualifiedNameRight); + walk_identifier_name( + traverser, + (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_TYPE_QUALIFIED_NAME_RIGHT) + as *mut IdentifierName, + ctx, + ); + ctx.pop_stack(pop_token); + traverser.exit_ts_import_type_qualified_name(&mut *node, ctx); +} + unsafe fn walk_ts_function_type<'a, State, Tr: Traverse<'a, State>>( traverser: &mut Tr, node: *mut TSFunctionType<'a>, diff --git a/napi/parser/generated/deserialize/js.js b/napi/parser/generated/deserialize/js.js index 83eb661ea7f5f..88bf5b7cd6215 100644 --- a/napi/parser/generated/deserialize/js.js +++ b/napi/parser/generated/deserialize/js.js @@ -1878,13 +1878,23 @@ function deserializeTSImportType(pos) { type: 'TSImportType', argument: deserializeTSType(pos + 8), options: deserializeOptionBoxObjectExpression(pos + 24), - qualifier: deserializeOptionTSTypeName(pos + 32), + qualifier: deserializeOptionTSImportTypeQualifier(pos + 32), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 48), start: deserializeU32(pos), end: deserializeU32(pos + 4), }; } +function deserializeTSImportTypeQualifiedName(pos) { + return { + type: 'TSImportTypeQualifiedName', + left: deserializeTSImportTypeQualifier(pos + 8), + right: deserializeIdentifierName(pos + 24), + start: deserializeU32(pos), + end: deserializeU32(pos + 4), + }; +} + function deserializeTSFunctionType(pos) { const params = deserializeBoxFormalParameters(pos + 24); const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); @@ -3750,6 +3760,17 @@ function deserializeTSTypeQueryExprName(pos) { } } +function deserializeTSImportTypeQualifier(pos) { + switch (uint8[pos]) { + case 0: + return deserializeBoxIdentifierName(pos + 8); + case 1: + return deserializeBoxTSImportTypeQualifiedName(pos + 8); + default: + throw new Error(`Unexpected discriminant ${uint8[pos]} for TSImportTypeQualifier`); + } +} + function deserializeTSMappedTypeModifierOperator(pos) { switch (uint8[pos]) { case 0: @@ -5228,9 +5249,13 @@ function deserializeOptionBoxObjectExpression(pos) { return deserializeBoxObjectExpression(pos); } -function deserializeOptionTSTypeName(pos) { - if (uint8[pos] === 3) return null; - return deserializeTSTypeName(pos); +function deserializeOptionTSImportTypeQualifier(pos) { + if (uint8[pos] === 2) return null; + return deserializeTSImportTypeQualifier(pos); +} + +function deserializeBoxTSImportTypeQualifiedName(pos) { + return deserializeTSImportTypeQualifiedName(uint32[pos >> 2]); } function deserializeOptionTSMappedTypeModifierOperator(pos) { diff --git a/napi/parser/generated/deserialize/ts.js b/napi/parser/generated/deserialize/ts.js index 0d01bad4f571c..d28ad74dc734b 100644 --- a/napi/parser/generated/deserialize/ts.js +++ b/napi/parser/generated/deserialize/ts.js @@ -2009,13 +2009,23 @@ function deserializeTSImportType(pos) { type: 'TSImportType', argument: deserializeTSType(pos + 8), options: deserializeOptionBoxObjectExpression(pos + 24), - qualifier: deserializeOptionTSTypeName(pos + 32), + qualifier: deserializeOptionTSImportTypeQualifier(pos + 32), typeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 48), start: deserializeU32(pos), end: deserializeU32(pos + 4), }; } +function deserializeTSImportTypeQualifiedName(pos) { + return { + type: 'TSImportTypeQualifiedName', + left: deserializeTSImportTypeQualifier(pos + 8), + right: deserializeIdentifierName(pos + 24), + start: deserializeU32(pos), + end: deserializeU32(pos + 4), + }; +} + function deserializeTSFunctionType(pos) { const params = deserializeBoxFormalParameters(pos + 24); const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); @@ -3881,6 +3891,17 @@ function deserializeTSTypeQueryExprName(pos) { } } +function deserializeTSImportTypeQualifier(pos) { + switch (uint8[pos]) { + case 0: + return deserializeBoxIdentifierName(pos + 8); + case 1: + return deserializeBoxTSImportTypeQualifiedName(pos + 8); + default: + throw new Error(`Unexpected discriminant ${uint8[pos]} for TSImportTypeQualifier`); + } +} + function deserializeTSMappedTypeModifierOperator(pos) { switch (uint8[pos]) { case 0: @@ -5359,9 +5380,13 @@ function deserializeOptionBoxObjectExpression(pos) { return deserializeBoxObjectExpression(pos); } -function deserializeOptionTSTypeName(pos) { - if (uint8[pos] === 3) return null; - return deserializeTSTypeName(pos); +function deserializeOptionTSImportTypeQualifier(pos) { + if (uint8[pos] === 2) return null; + return deserializeTSImportTypeQualifier(pos); +} + +function deserializeBoxTSImportTypeQualifiedName(pos) { + return deserializeTSImportTypeQualifiedName(uint32[pos >> 2]); } function deserializeOptionTSMappedTypeModifierOperator(pos) { diff --git a/napi/parser/generated/lazy/constructors.js b/napi/parser/generated/lazy/constructors.js index 57e77298a1bae..6156a28de2d21 100644 --- a/napi/parser/generated/lazy/constructors.js +++ b/napi/parser/generated/lazy/constructors.js @@ -10650,7 +10650,7 @@ class TSImportType { get qualifier() { const internal = this.#internal; - return constructOptionTSTypeName(internal.pos + 32, internal.ast); + return constructOptionTSImportTypeQualifier(internal.pos + 32, internal.ast); } get typeArguments() { @@ -10677,6 +10677,69 @@ class TSImportType { const DebugTSImportType = class TSImportType {}; +function constructTSImportTypeQualifier(pos, ast) { + switch (ast.buffer[pos]) { + case 0: + return constructBoxIdentifierName(pos + 8, ast); + case 1: + return constructBoxTSImportTypeQualifiedName(pos + 8, ast); + default: + throw new Error(`Unexpected discriminant ${ast.buffer[pos]} for TSImportTypeQualifier`); + } +} + +class TSImportTypeQualifiedName { + type = 'TSImportTypeQualifiedName'; + #internal; + + constructor(pos, ast) { + if (ast?.token !== TOKEN) constructorError(); + + const { nodes } = ast; + const cached = nodes.get(pos); + if (cached !== void 0) return cached; + + this.#internal = { pos, ast }; + nodes.set(pos, this); + } + + get start() { + const internal = this.#internal; + return constructU32(internal.pos, internal.ast); + } + + get end() { + const internal = this.#internal; + return constructU32(internal.pos + 4, internal.ast); + } + + get left() { + const internal = this.#internal; + return constructTSImportTypeQualifier(internal.pos + 8, internal.ast); + } + + get right() { + const internal = this.#internal; + return new IdentifierName(internal.pos + 24, internal.ast); + } + + toJSON() { + return { + type: 'TSImportTypeQualifiedName', + start: this.start, + end: this.end, + left: this.left, + right: this.right, + }; + } + + [inspectSymbol]() { + return Object.setPrototypeOf(this.toJSON(), DebugTSImportTypeQualifiedName.prototype); + } +} + +const DebugTSImportTypeQualifiedName = class TSImportTypeQualifiedName {}; + class TSFunctionType { type = 'TSFunctionType'; #internal; @@ -13742,9 +13805,13 @@ function constructOptionBoxObjectExpression(pos, ast) { return constructBoxObjectExpression(pos, ast); } -function constructOptionTSTypeName(pos, ast) { - if (ast.buffer[pos] === 3) return null; - return constructTSTypeName(pos, ast); +function constructOptionTSImportTypeQualifier(pos, ast) { + if (ast.buffer[pos] === 2) return null; + return constructTSImportTypeQualifier(pos, ast); +} + +function constructBoxTSImportTypeQualifiedName(pos, ast) { + return new TSImportTypeQualifiedName(ast.buffer.uint32[pos >> 2], ast); } function constructOptionTSMappedTypeModifierOperator(pos, ast) { @@ -14074,6 +14141,7 @@ module.exports = { TSInferType, TSTypeQuery, TSImportType, + TSImportTypeQualifiedName, TSFunctionType, TSConstructorType, TSMappedType, diff --git a/napi/parser/generated/lazy/types.js b/napi/parser/generated/lazy/types.js index 191361cd42cdb..9dadf4d841ef5 100644 --- a/napi/parser/generated/lazy/types.js +++ b/napi/parser/generated/lazy/types.js @@ -169,25 +169,26 @@ const NODE_TYPE_IDS_MAP = new Map([ ['TSInferType', 159], ['TSTypeQuery', 160], ['TSImportType', 161], - ['TSFunctionType', 162], - ['TSConstructorType', 163], - ['TSMappedType', 164], - ['TSTemplateLiteralType', 165], - ['TSAsExpression', 166], - ['TSSatisfiesExpression', 167], - ['TSTypeAssertion', 168], - ['TSImportEqualsDeclaration', 169], - ['TSExternalModuleReference', 170], - ['TSNonNullExpression', 171], - ['Decorator', 172], - ['TSExportAssignment', 173], - ['TSNamespaceExportDeclaration', 174], - ['TSInstantiationExpression', 175], - ['JSDocNullableType', 176], - ['JSDocNonNullableType', 177], + ['TSImportTypeQualifiedName', 162], + ['TSFunctionType', 163], + ['TSConstructorType', 164], + ['TSMappedType', 165], + ['TSTemplateLiteralType', 166], + ['TSAsExpression', 167], + ['TSSatisfiesExpression', 168], + ['TSTypeAssertion', 169], + ['TSImportEqualsDeclaration', 170], + ['TSExternalModuleReference', 171], + ['TSNonNullExpression', 172], + ['Decorator', 173], + ['TSExportAssignment', 174], + ['TSNamespaceExportDeclaration', 175], + ['TSInstantiationExpression', 176], + ['JSDocNullableType', 177], + ['JSDocNonNullableType', 178], ]); -const NODE_TYPES_COUNT = 178, +const NODE_TYPES_COUNT = 179, LEAF_NODE_TYPES_COUNT = 38; module.exports = { diff --git a/napi/parser/generated/lazy/walk.js b/napi/parser/generated/lazy/walk.js index 40d404c45ac8b..b9264243cfab5 100644 --- a/napi/parser/generated/lazy/walk.js +++ b/napi/parser/generated/lazy/walk.js @@ -165,6 +165,7 @@ const { TSInferType, TSTypeQuery, TSImportType, + TSImportTypeQualifiedName, TSFunctionType, TSConstructorType, TSMappedType, @@ -4122,15 +4123,43 @@ function walkTSImportType(pos, ast, visitors) { walkTSType(pos + 8, ast, visitors); walkOptionBoxObjectExpression(pos + 24, ast, visitors); - walkOptionTSTypeName(pos + 32, ast, visitors); + walkOptionTSImportTypeQualifier(pos + 32, ast, visitors); walkOptionBoxTSTypeParameterInstantiation(pos + 48, ast, visitors); if (exit !== null) exit(node); } -function walkTSFunctionType(pos, ast, visitors) { +function walkTSImportTypeQualifier(pos, ast, visitors) { + switch (ast.buffer[pos]) { + case 0: + walkBoxIdentifierName(pos + 8, ast, visitors); + return; + case 1: + walkBoxTSImportTypeQualifiedName(pos + 8, ast, visitors); + return; + default: + throw new Error(`Unexpected discriminant ${ast.buffer[pos]} for TSImportTypeQualifier`); + } +} + +function walkTSImportTypeQualifiedName(pos, ast, visitors) { const enterExit = visitors[162]; let node, enter, exit = null; + if (enterExit !== null) { + ({ enter, exit } = enterExit); + node = new TSImportTypeQualifiedName(pos, ast); + if (enter !== null) enter(node); + } + + walkTSImportTypeQualifier(pos + 8, ast, visitors); + walkIdentifierName(pos + 24, ast, visitors); + + if (exit !== null) exit(node); +} + +function walkTSFunctionType(pos, ast, visitors) { + const enterExit = visitors[163]; + let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); node = new TSFunctionType(pos, ast); @@ -4145,7 +4174,7 @@ function walkTSFunctionType(pos, ast, visitors) { } function walkTSConstructorType(pos, ast, visitors) { - const enterExit = visitors[163]; + const enterExit = visitors[164]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4161,7 +4190,7 @@ function walkTSConstructorType(pos, ast, visitors) { } function walkTSMappedType(pos, ast, visitors) { - const enterExit = visitors[164]; + const enterExit = visitors[165]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4176,7 +4205,7 @@ function walkTSMappedType(pos, ast, visitors) { } function walkTSTemplateLiteralType(pos, ast, visitors) { - const enterExit = visitors[165]; + const enterExit = visitors[166]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4191,7 +4220,7 @@ function walkTSTemplateLiteralType(pos, ast, visitors) { } function walkTSAsExpression(pos, ast, visitors) { - const enterExit = visitors[166]; + const enterExit = visitors[167]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4206,7 +4235,7 @@ function walkTSAsExpression(pos, ast, visitors) { } function walkTSSatisfiesExpression(pos, ast, visitors) { - const enterExit = visitors[167]; + const enterExit = visitors[168]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4221,7 +4250,7 @@ function walkTSSatisfiesExpression(pos, ast, visitors) { } function walkTSTypeAssertion(pos, ast, visitors) { - const enterExit = visitors[168]; + const enterExit = visitors[169]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4236,7 +4265,7 @@ function walkTSTypeAssertion(pos, ast, visitors) { } function walkTSImportEqualsDeclaration(pos, ast, visitors) { - const enterExit = visitors[169]; + const enterExit = visitors[170]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4270,7 +4299,7 @@ function walkTSModuleReference(pos, ast, visitors) { } function walkTSExternalModuleReference(pos, ast, visitors) { - const enterExit = visitors[170]; + const enterExit = visitors[171]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4284,7 +4313,7 @@ function walkTSExternalModuleReference(pos, ast, visitors) { } function walkTSNonNullExpression(pos, ast, visitors) { - const enterExit = visitors[171]; + const enterExit = visitors[172]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4298,7 +4327,7 @@ function walkTSNonNullExpression(pos, ast, visitors) { } function walkDecorator(pos, ast, visitors) { - const enterExit = visitors[172]; + const enterExit = visitors[173]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4312,7 +4341,7 @@ function walkDecorator(pos, ast, visitors) { } function walkTSExportAssignment(pos, ast, visitors) { - const enterExit = visitors[173]; + const enterExit = visitors[174]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4326,7 +4355,7 @@ function walkTSExportAssignment(pos, ast, visitors) { } function walkTSNamespaceExportDeclaration(pos, ast, visitors) { - const enterExit = visitors[174]; + const enterExit = visitors[175]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4340,7 +4369,7 @@ function walkTSNamespaceExportDeclaration(pos, ast, visitors) { } function walkTSInstantiationExpression(pos, ast, visitors) { - const enterExit = visitors[175]; + const enterExit = visitors[176]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4355,7 +4384,7 @@ function walkTSInstantiationExpression(pos, ast, visitors) { } function walkJSDocNullableType(pos, ast, visitors) { - const enterExit = visitors[176]; + const enterExit = visitors[177]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -4369,7 +4398,7 @@ function walkJSDocNullableType(pos, ast, visitors) { } function walkJSDocNonNullableType(pos, ast, visitors) { - const enterExit = visitors[177]; + const enterExit = visitors[178]; let node, enter, exit = null; if (enterExit !== null) { ({ enter, exit } = enterExit); @@ -5457,8 +5486,12 @@ function walkOptionBoxObjectExpression(pos, ast, visitors) { } } -function walkOptionTSTypeName(pos, ast, visitors) { - if (!(ast.buffer[pos] === 3)) walkTSTypeName(pos, ast, visitors); +function walkOptionTSImportTypeQualifier(pos, ast, visitors) { + if (!(ast.buffer[pos] === 2)) walkTSImportTypeQualifier(pos, ast, visitors); +} + +function walkBoxTSImportTypeQualifiedName(pos, ast, visitors) { + return walkTSImportTypeQualifiedName(ast.buffer.uint32[pos >> 2], ast, visitors); } function walkBoxTSExternalModuleReference(pos, ast, visitors) { diff --git a/npm/oxc-types/types.d.ts b/npm/oxc-types/types.d.ts index 1745724aadca4..0a9f3caeec335 100644 --- a/npm/oxc-types/types.d.ts +++ b/npm/oxc-types/types.d.ts @@ -1351,10 +1351,18 @@ export interface TSImportType extends Span { type: 'TSImportType'; argument: TSType; options: ObjectExpression | null; - qualifier: TSTypeName | null; + qualifier: TSImportTypeQualifier | null; typeArguments: TSTypeParameterInstantiation | null; } +export type TSImportTypeQualifier = IdentifierName | TSImportTypeQualifiedName; + +export interface TSImportTypeQualifiedName extends Span { + type: 'TSImportTypeQualifiedName'; + left: TSImportTypeQualifier; + right: IdentifierName; +} + export interface TSFunctionType extends Span { type: 'TSFunctionType'; typeParameters: TSTypeParameterDeclaration | null; @@ -1684,6 +1692,7 @@ export type Node = | TSInferType | TSTypeQuery | TSImportType + | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType diff --git a/tasks/coverage/snapshots/estree_typescript.snap b/tasks/coverage/snapshots/estree_typescript.snap index 199a1b62582d0..9735fded021a6 100644 --- a/tasks/coverage/snapshots/estree_typescript.snap +++ b/tasks/coverage/snapshots/estree_typescript.snap @@ -2,10 +2,18 @@ commit: 81c95189 estree_typescript Summary: AST Parsed : 8575/8575 (100.00%) -Positive Passed: 8572/8575 (99.97%) +Positive Passed: 8568/8575 (99.92%) +Mismatch: tasks/coverage/typescript/tests/cases/compiler/importTypeTypeofClassStaticLookup.ts + Mismatch: tasks/coverage/typescript/tests/cases/conformance/jsx/jsxReactTestSuite.tsx Mismatch: tasks/coverage/typescript/tests/cases/conformance/jsx/tsxReactEmitEntities.tsx Mismatch: tasks/coverage/typescript/tests/cases/conformance/jsx/tsxReactEmitNesting.tsx +Mismatch: tasks/coverage/typescript/tests/cases/conformance/types/import/importTypeAmbient.ts + +Mismatch: tasks/coverage/typescript/tests/cases/conformance/types/import/importTypeGenericTypes.ts + +Mismatch: tasks/coverage/typescript/tests/cases/conformance/types/import/importTypeLocal.ts + diff --git a/tasks/coverage/snapshots/semantic_babel.snap b/tasks/coverage/snapshots/semantic_babel.snap index bddfda27cf192..bd28d74776475 100644 --- a/tasks/coverage/snapshots/semantic_babel.snap +++ b/tasks/coverage/snapshots/semantic_babel.snap @@ -2,7 +2,7 @@ commit: 1d4546bc semantic_babel Summary: AST Parsed : 2362/2362 (100.00%) -Positive Passed: 1953/2362 (82.68%) +Positive Passed: 1959/2362 (82.94%) semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/decorators/decorators-after-export/input.js Symbol span mismatch for "C": after transform: SymbolId(0): Span { start: 65, end: 66 } @@ -157,38 +157,6 @@ Symbol flags mismatch for "A": after transform: SymbolId(0): SymbolFlags(RegularEnum) rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable) -semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/estree/typescript/import/input.js -Symbol reference IDs mismatch for "Y": -after transform: SymbolId(1): [ReferenceId(0)] -rebuilt : SymbolId(1): [] -Unresolved references mismatch: -after transform: ["foo"] -rebuilt : [] - -semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/estree/typescript/import-babel-7/input.js -Symbol reference IDs mismatch for "Y": -after transform: SymbolId(1): [ReferenceId(0)] -rebuilt : SymbolId(1): [] -Unresolved references mismatch: -after transform: ["foo"] -rebuilt : [] - -semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/estree/typescript/import-with-options/input.js -Symbol reference IDs mismatch for "Y": -after transform: SymbolId(1): [ReferenceId(0)] -rebuilt : SymbolId(1): [] -Unresolved references mismatch: -after transform: ["foo"] -rebuilt : [] - -semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/estree/typescript/import-with-options-babel-7/input.js -Symbol reference IDs mismatch for "Y": -after transform: SymbolId(1): [ReferenceId(0)] -rebuilt : SymbolId(1): [] -Unresolved references mismatch: -after transform: ["foo"] -rebuilt : [] - semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/estree/typescript/instantiation-expression-optional-chain/input.ts Unresolved references mismatch: after transform: ["a", "c"] @@ -2652,22 +2620,6 @@ Bindings mismatch: after transform: ScopeId(0): ["A", "B", "T", "Types"] rebuilt : ScopeId(0): [] -semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic/input.ts -Symbol reference IDs mismatch for "Y": -after transform: SymbolId(1): [ReferenceId(0)] -rebuilt : SymbolId(1): [] -Unresolved references mismatch: -after transform: ["foo"] -rebuilt : [] - -semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic-babel-7/input.ts -Symbol reference IDs mismatch for "Y": -after transform: SymbolId(1): [ReferenceId(0)] -rebuilt : SymbolId(1): [] -Unresolved references mismatch: -after transform: ["foo"] -rebuilt : [] - semantic Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/indexed/input.ts Unresolved references mismatch: after transform: ["K", "T"] diff --git a/tasks/coverage/snapshots/semantic_typescript.snap b/tasks/coverage/snapshots/semantic_typescript.snap index 5ddff992c61e9..960ad91d71f4e 100644 --- a/tasks/coverage/snapshots/semantic_typescript.snap +++ b/tasks/coverage/snapshots/semantic_typescript.snap @@ -2,7 +2,7 @@ commit: 81c95189 semantic_typescript Summary: AST Parsed : 6537/6537 (100.00%) -Positive Passed: 2828/6537 (43.26%) +Positive Passed: 2836/6537 (43.38%) semantic Error: tasks/coverage/typescript/tests/cases/compiler/2dArrays.ts Symbol reference IDs mismatch for "Cell": after transform: SymbolId(0): [ReferenceId(1)] @@ -7949,16 +7949,6 @@ Symbol reference IDs mismatch for "x": after transform: SymbolId(7): [ReferenceId(5), ReferenceId(7)] rebuilt : SymbolId(4): [] -semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationEmitNoInvalidCommentReuse1.ts -Unresolved references mismatch: -after transform: ["Id"] -rebuilt : [] - -semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationEmitNoInvalidCommentReuse2.ts -Unresolved references mismatch: -after transform: ["Id"] -rebuilt : [] - semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationEmitNoInvalidCommentReuse3.ts Bindings mismatch: after transform: ScopeId(0): ["_", "id", "object"] @@ -8263,16 +8253,6 @@ Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(2)] rebuilt : ScopeId(0): [ScopeId(1)] -semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationEmitTopLevelNodeFromCrossFile2.ts -Unresolved references mismatch: -after transform: ["Box"] -rebuilt : [] - -semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationEmitTripleSlashReferenceAmbientModule.ts -Unresolved references mismatch: -after transform: ["Url"] -rebuilt : [] - semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationEmitTypeAliasWithTypeParameters1.ts Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(3), ScopeId(4)] @@ -8497,11 +8477,6 @@ Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3)] rebuilt : ScopeId(0): [] -semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts -Unresolved references mismatch: -after transform: ["Foo"] -rebuilt : [] - semantic Error: tasks/coverage/typescript/tests/cases/compiler/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.ts Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3), ScopeId(12)] @@ -16170,21 +16145,11 @@ Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3), ScopeId(4), ScopeId(6)] rebuilt : ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3), ScopeId(4)] -semantic Error: tasks/coverage/typescript/tests/cases/compiler/importTypeTypeofClassStaticLookup.ts -Unresolved references mismatch: -after transform: ["A"] -rebuilt : [] - semantic Error: tasks/coverage/typescript/tests/cases/compiler/importUsedInExtendsList1.ts Symbol reference IDs mismatch for "Sub": after transform: SymbolId(1): [ReferenceId(1)] rebuilt : SymbolId(1): [] -semantic Error: tasks/coverage/typescript/tests/cases/compiler/importUsedInGenericImportResolves.ts -Unresolved references mismatch: -after transform: ["T", "theme"] -rebuilt : [] - semantic Error: tasks/coverage/typescript/tests/cases/compiler/import_reference-exported-alias.ts Symbol flags mismatch for "App": after transform: SymbolId(0): SymbolFlags(ValueModule) @@ -18893,7 +18858,7 @@ rebuilt : [] semantic Error: tasks/coverage/typescript/tests/cases/compiler/jsDocDeclarationEmitDoesNotUseNodeModulesPathWithoutError.ts Unresolved references mismatch: -after transform: ["LionRequestInit"] +after transform: ["Object"] rebuilt : [] semantic Error: tasks/coverage/typescript/tests/cases/compiler/jsEmitIntersectionProperty.ts @@ -29682,11 +29647,6 @@ Scope children mismatch: after transform: ScopeId(0): [ScopeId(1)] rebuilt : ScopeId(0): [] -semantic Error: tasks/coverage/typescript/tests/cases/compiler/symbolLinkDeclarationEmitModuleNamesImportRef.ts -Unresolved references mismatch: -after transform: ["InterpolationValue"] -rebuilt : [] - semantic Error: tasks/coverage/typescript/tests/cases/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.ts Bindings mismatch: after transform: ScopeId(0): ["Constructor"] @@ -47392,9 +47352,6 @@ semantic Error: tasks/coverage/typescript/tests/cases/conformance/moduleResoluti Bindings mismatch: after transform: ScopeId(0): ["User", "getUser", "user"] rebuilt : ScopeId(0): ["getUser", "user"] -Unresolved references mismatch: -after transform: ["User"] -rebuilt : [] semantic Error: tasks/coverage/typescript/tests/cases/conformance/moduleResolution/bundler/bundlerDirectoryModule.ts Bindings mismatch: @@ -47420,9 +47377,6 @@ semantic Error: tasks/coverage/typescript/tests/cases/conformance/moduleResoluti Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3), ScopeId(4), ScopeId(5)] rebuilt : ScopeId(0): [] -Unresolved references mismatch: -after transform: ["x"] -rebuilt : [] semantic Error: tasks/coverage/typescript/tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts Bindings mismatch: @@ -47466,17 +47420,11 @@ semantic Error: tasks/coverage/typescript/tests/cases/conformance/node/nodeModul Scope children mismatch: after transform: ScopeId(0): [ScopeId(1)] rebuilt : ScopeId(0): [] -Unresolved references mismatch: -after transform: ["ImportInterface", "RequireInterface"] -rebuilt : [] semantic Error: tasks/coverage/typescript/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts Scope children mismatch: after transform: ScopeId(0): [ScopeId(1)] rebuilt : ScopeId(0): [] -Unresolved references mismatch: -after transform: ["ImportInterface", "RequireInterface"] -rebuilt : [] semantic Error: tasks/coverage/typescript/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts Scope children mismatch: @@ -49112,9 +49060,6 @@ semantic Error: tasks/coverage/typescript/tests/cases/conformance/types/import/i Scope children mismatch: after transform: ScopeId(0): [ScopeId(1), ScopeId(3), ScopeId(10)] rebuilt : ScopeId(0): [ScopeId(1)] -Unresolved references mismatch: -after transform: ["Bar", "require"] -rebuilt : ["require"] semantic Error: tasks/coverage/typescript/tests/cases/conformance/types/import/importTypeAmdBundleRewrite.ts Scope children mismatch: