mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(parser): fix incorrect parsed TSIndexSignature (#7016)
closes #6985
This commit is contained in:
parent
a786dc2449
commit
caaf00e081
13 changed files with 201 additions and 61 deletions
|
|
@ -984,6 +984,7 @@ pub struct TSIndexSignature<'a> {
|
|||
pub parameters: Vec<'a, TSIndexSignatureName<'a>>,
|
||||
pub type_annotation: Box<'a, TSTypeAnnotation<'a>>,
|
||||
pub readonly: bool,
|
||||
pub r#static: bool,
|
||||
}
|
||||
|
||||
#[ast(visit)]
|
||||
|
|
|
|||
|
|
@ -1036,6 +1036,7 @@ const _: () = {
|
|||
assert!(offset_of!(TSIndexSignature, parameters) == 8usize);
|
||||
assert!(offset_of!(TSIndexSignature, type_annotation) == 40usize);
|
||||
assert!(offset_of!(TSIndexSignature, readonly) == 48usize);
|
||||
assert!(offset_of!(TSIndexSignature, r#static) == 49usize);
|
||||
|
||||
assert!(size_of::<TSCallSignatureDeclaration>() == 64usize);
|
||||
assert!(align_of::<TSCallSignatureDeclaration>() == 8usize);
|
||||
|
|
@ -2595,6 +2596,7 @@ const _: () = {
|
|||
assert!(offset_of!(TSIndexSignature, parameters) == 8usize);
|
||||
assert!(offset_of!(TSIndexSignature, type_annotation) == 24usize);
|
||||
assert!(offset_of!(TSIndexSignature, readonly) == 28usize);
|
||||
assert!(offset_of!(TSIndexSignature, r#static) == 29usize);
|
||||
|
||||
assert!(size_of::<TSCallSignatureDeclaration>() == 44usize);
|
||||
assert!(align_of::<TSCallSignatureDeclaration>() == 4usize);
|
||||
|
|
|
|||
|
|
@ -7239,6 +7239,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// - parameters
|
||||
/// - type_annotation
|
||||
/// - readonly
|
||||
/// - r#static
|
||||
#[inline]
|
||||
pub fn class_element_ts_index_signature<T1>(
|
||||
self,
|
||||
|
|
@ -7246,6 +7247,7 @@ impl<'a> AstBuilder<'a> {
|
|||
parameters: Vec<'a, TSIndexSignatureName<'a>>,
|
||||
type_annotation: T1,
|
||||
readonly: bool,
|
||||
r#static: bool,
|
||||
) -> ClassElement<'a>
|
||||
where
|
||||
T1: IntoIn<'a, Box<'a, TSTypeAnnotation<'a>>>,
|
||||
|
|
@ -7255,6 +7257,7 @@ impl<'a> AstBuilder<'a> {
|
|||
parameters,
|
||||
type_annotation,
|
||||
readonly,
|
||||
r#static,
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
@ -11824,6 +11827,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// - parameters
|
||||
/// - type_annotation
|
||||
/// - readonly
|
||||
/// - r#static
|
||||
#[inline]
|
||||
pub fn ts_signature_index_signature<T1>(
|
||||
self,
|
||||
|
|
@ -11831,6 +11835,7 @@ impl<'a> AstBuilder<'a> {
|
|||
parameters: Vec<'a, TSIndexSignatureName<'a>>,
|
||||
type_annotation: T1,
|
||||
readonly: bool,
|
||||
r#static: bool,
|
||||
) -> TSSignature<'a>
|
||||
where
|
||||
T1: IntoIn<'a, Box<'a, TSTypeAnnotation<'a>>>,
|
||||
|
|
@ -11840,6 +11845,7 @@ impl<'a> AstBuilder<'a> {
|
|||
parameters,
|
||||
type_annotation,
|
||||
readonly,
|
||||
r#static,
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
@ -12040,6 +12046,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// - parameters
|
||||
/// - type_annotation
|
||||
/// - readonly
|
||||
/// - r#static
|
||||
#[inline]
|
||||
pub fn ts_index_signature<T1>(
|
||||
self,
|
||||
|
|
@ -12047,6 +12054,7 @@ impl<'a> AstBuilder<'a> {
|
|||
parameters: Vec<'a, TSIndexSignatureName<'a>>,
|
||||
type_annotation: T1,
|
||||
readonly: bool,
|
||||
r#static: bool,
|
||||
) -> TSIndexSignature<'a>
|
||||
where
|
||||
T1: IntoIn<'a, Box<'a, TSTypeAnnotation<'a>>>,
|
||||
|
|
@ -12056,6 +12064,7 @@ impl<'a> AstBuilder<'a> {
|
|||
parameters,
|
||||
type_annotation: type_annotation.into_in(self.allocator),
|
||||
readonly,
|
||||
r#static,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -12068,6 +12077,7 @@ impl<'a> AstBuilder<'a> {
|
|||
/// - parameters
|
||||
/// - type_annotation
|
||||
/// - readonly
|
||||
/// - r#static
|
||||
#[inline]
|
||||
pub fn alloc_ts_index_signature<T1>(
|
||||
self,
|
||||
|
|
@ -12075,12 +12085,13 @@ impl<'a> AstBuilder<'a> {
|
|||
parameters: Vec<'a, TSIndexSignatureName<'a>>,
|
||||
type_annotation: T1,
|
||||
readonly: bool,
|
||||
r#static: bool,
|
||||
) -> Box<'a, TSIndexSignature<'a>>
|
||||
where
|
||||
T1: IntoIn<'a, Box<'a, TSTypeAnnotation<'a>>>,
|
||||
{
|
||||
Box::new_in(
|
||||
self.ts_index_signature(span, parameters, type_annotation, readonly),
|
||||
self.ts_index_signature(span, parameters, type_annotation, readonly, r#static),
|
||||
self.allocator,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3369,6 +3369,7 @@ impl<'old_alloc, 'new_alloc> CloneIn<'new_alloc> for TSIndexSignature<'old_alloc
|
|||
parameters: CloneIn::clone_in(&self.parameters, allocator),
|
||||
type_annotation: CloneIn::clone_in(&self.type_annotation, allocator),
|
||||
readonly: CloneIn::clone_in(&self.readonly, allocator),
|
||||
r#static: CloneIn::clone_in(&self.r#static, allocator),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3450,6 +3450,7 @@ impl<'a> ContentEq for TSIndexSignature<'a> {
|
|||
ContentEq::content_eq(&self.parameters, &other.parameters)
|
||||
&& ContentEq::content_eq(&self.type_annotation, &other.type_annotation)
|
||||
&& ContentEq::content_eq(&self.readonly, &other.readonly)
|
||||
&& ContentEq::content_eq(&self.r#static, &other.r#static)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1841,6 +1841,7 @@ impl<'a> ContentHash for TSIndexSignature<'a> {
|
|||
ContentHash::content_hash(&self.parameters, state);
|
||||
ContentHash::content_hash(&self.type_annotation, state);
|
||||
ContentHash::content_hash(&self.readonly, state);
|
||||
ContentHash::content_hash(&self.r#static, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2552,6 +2552,7 @@ impl<'a> Serialize for TSIndexSignature<'a> {
|
|||
map.serialize_entry("parameters", &self.parameters)?;
|
||||
map.serialize_entry("typeAnnotation", &self.type_annotation)?;
|
||||
map.serialize_entry("readonly", &self.readonly)?;
|
||||
map.serialize_entry("static", &self.r#static)?;
|
||||
map.end()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,9 +229,10 @@ impl<'a> ParserImpl<'a> {
|
|||
}
|
||||
|
||||
if self.is_at_ts_index_signature_member() {
|
||||
if let TSSignature::TSIndexSignature(sig) = self.parse_ts_index_signature_member()? {
|
||||
return Ok(Some(ClassElement::TSIndexSignature(sig)));
|
||||
}
|
||||
return self
|
||||
.parse_index_signature_declaration(span, &modifiers)
|
||||
.map(ClassElement::TSIndexSignature)
|
||||
.map(Some);
|
||||
}
|
||||
|
||||
// * ...
|
||||
|
|
|
|||
|
|
@ -1267,16 +1267,51 @@ impl<'a> ParserImpl<'a> {
|
|||
))
|
||||
}
|
||||
|
||||
pub(crate) fn parse_index_signature_declaration(
|
||||
&mut self,
|
||||
span: Span,
|
||||
modifiers: &Modifiers<'a>,
|
||||
) -> Result<Box<'a, TSIndexSignature<'a>>> {
|
||||
self.verify_modifiers(
|
||||
modifiers,
|
||||
ModifierFlags::READONLY | ModifierFlags::STATIC,
|
||||
diagnostics::cannot_appear_on_an_index_signature,
|
||||
);
|
||||
self.bump(Kind::LBrack);
|
||||
let parameters = self.ast.vec1(self.parse_ts_index_signature_name()?);
|
||||
self.expect(Kind::RBrack)?;
|
||||
let Some(type_annotation) = self.parse_ts_type_annotation()? else {
|
||||
return Err(self.unexpected());
|
||||
};
|
||||
self.parse_type_member_semicolon();
|
||||
Ok(self.ast.alloc_ts_index_signature(
|
||||
self.end_span(span),
|
||||
parameters,
|
||||
type_annotation,
|
||||
modifiers.contains(ModifierKind::Readonly),
|
||||
modifiers.contains(ModifierKind::Static),
|
||||
))
|
||||
}
|
||||
|
||||
fn parse_type_member_semicolon(&mut self) {
|
||||
// We allow type members to be separated by commas or (possibly ASI) semicolons.
|
||||
// First check if it was a comma. If so, we're done with the member.
|
||||
if self.eat(Kind::Comma) {
|
||||
return;
|
||||
}
|
||||
// Didn't have a comma. We must have a (possible ASI) semicolon.
|
||||
self.bump(Kind::Semicolon);
|
||||
}
|
||||
|
||||
pub(crate) fn parse_ts_index_signature_member(&mut self) -> Result<TSSignature<'a>> {
|
||||
let span = self.start_span();
|
||||
|
||||
let modifiers = self.parse_class_element_modifiers(false);
|
||||
self.verify_modifiers(
|
||||
&modifiers,
|
||||
ModifierFlags::READONLY,
|
||||
ModifierFlags::READONLY | ModifierFlags::STATIC,
|
||||
diagnostics::cannot_appear_on_an_index_signature,
|
||||
);
|
||||
let readonly = modifiers.contains(ModifierKind::Readonly);
|
||||
|
||||
self.bump(Kind::LBrack);
|
||||
let index_name = self.parse_ts_index_signature_name()?;
|
||||
|
|
@ -1285,18 +1320,16 @@ impl<'a> ParserImpl<'a> {
|
|||
self.expect(Kind::RBrack)?;
|
||||
|
||||
let type_annotation = self.parse_ts_type_annotation()?;
|
||||
if let Some(type_annotation) = type_annotation {
|
||||
self.bump(Kind::Comma);
|
||||
self.bump(Kind::Semicolon);
|
||||
Ok(self.ast.ts_signature_index_signature(
|
||||
self.end_span(span),
|
||||
parameters,
|
||||
type_annotation,
|
||||
readonly,
|
||||
))
|
||||
} else {
|
||||
Err(self.unexpected())
|
||||
}
|
||||
let Some(type_annotation) = type_annotation else { return Err(self.unexpected()) };
|
||||
self.bump(Kind::Comma);
|
||||
self.bump(Kind::Semicolon);
|
||||
Ok(self.ast.ts_signature_index_signature(
|
||||
self.end_span(span),
|
||||
parameters,
|
||||
type_annotation,
|
||||
modifiers.contains(ModifierKind::Readonly),
|
||||
modifiers.contains(ModifierKind::Static),
|
||||
))
|
||||
}
|
||||
|
||||
fn parse_ts_index_signature_name(&mut self) -> Result<TSIndexSignatureName<'a>> {
|
||||
|
|
|
|||
|
|
@ -12722,6 +12722,7 @@ pub(crate) const OFFSET_TS_INDEX_SIGNATURE_PARAMETERS: usize =
|
|||
pub(crate) const OFFSET_TS_INDEX_SIGNATURE_TYPE_ANNOTATION: usize =
|
||||
offset_of!(TSIndexSignature, type_annotation);
|
||||
pub(crate) const OFFSET_TS_INDEX_SIGNATURE_READONLY: usize = offset_of!(TSIndexSignature, readonly);
|
||||
pub(crate) const OFFSET_TS_INDEX_SIGNATURE_STATIC: usize = offset_of!(TSIndexSignature, r#static);
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
@ -12748,6 +12749,11 @@ impl<'a, 't> TSIndexSignatureWithoutParameters<'a, 't> {
|
|||
pub fn readonly(self) -> &'t bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_READONLY) as *const bool) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn r#static(self) -> &'t bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_STATIC) as *const bool) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 't> GetAddress for TSIndexSignatureWithoutParameters<'a, 't> {
|
||||
|
|
@ -12782,6 +12788,11 @@ impl<'a, 't> TSIndexSignatureWithoutTypeAnnotation<'a, 't> {
|
|||
pub fn readonly(self) -> &'t bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_READONLY) as *const bool) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn r#static(self) -> &'t bool {
|
||||
unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_STATIC) as *const bool) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 't> GetAddress for TSIndexSignatureWithoutTypeAnnotation<'a, 't> {
|
||||
|
|
|
|||
1
npm/oxc-types/types.d.ts
vendored
1
npm/oxc-types/types.d.ts
vendored
|
|
@ -1393,6 +1393,7 @@ export interface TSIndexSignature extends Span {
|
|||
parameters: Array<TSIndexSignatureName>;
|
||||
typeAnnotation: TSTypeAnnotation;
|
||||
readonly: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
export interface TSCallSignatureDeclaration extends Span {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ commit: d20b314c
|
|||
parser_babel Summary:
|
||||
AST Parsed : 2126/2136 (99.53%)
|
||||
Positive Passed: 2116/2136 (99.06%)
|
||||
Negative Passed: 1385/1500 (92.33%)
|
||||
Negative Passed: 1387/1500 (92.47%)
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/annex-b/enabled/3.1-sloppy-labeled-functions-if-body/input.js
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-if/input.js
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/input.js
|
||||
|
|
@ -49,9 +49,7 @@ Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/ty
|
|||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/invalid-modifiers-order/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/method-readonly/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-incompatible/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-index-signatures/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-invalid-order/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-override-errors/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/declare/function/input.ts
|
||||
|
|
@ -10217,6 +10215,54 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
|
|||
3 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'abstract' modifier cannot appear on an index signature.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-index-signatures/input.ts:2:3]
|
||||
1 │ class C {
|
||||
2 │ abstract [key: string]: string;
|
||||
· ────────
|
||||
3 │ declare [key: string]: string;
|
||||
╰────
|
||||
|
||||
× TS(1071): 'declare' modifier cannot appear on an index signature.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-index-signatures/input.ts:3:3]
|
||||
2 │ abstract [key: string]: string;
|
||||
3 │ declare [key: string]: string;
|
||||
· ───────
|
||||
4 │ private [key: string]: string;
|
||||
╰────
|
||||
|
||||
× TS(1071): 'private' modifier cannot appear on an index signature.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-index-signatures/input.ts:4:3]
|
||||
3 │ declare [key: string]: string;
|
||||
4 │ private [key: string]: string;
|
||||
· ───────
|
||||
5 │ public [key: string]: string;
|
||||
╰────
|
||||
|
||||
× TS(1071): 'public' modifier cannot appear on an index signature.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-index-signatures/input.ts:5:3]
|
||||
4 │ private [key: string]: string;
|
||||
5 │ public [key: string]: string;
|
||||
· ──────
|
||||
6 │ protected [key: string]: string;
|
||||
╰────
|
||||
|
||||
× TS(1071): 'protected' modifier cannot appear on an index signature.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-index-signatures/input.ts:6:3]
|
||||
5 │ public [key: string]: string;
|
||||
6 │ protected [key: string]: string;
|
||||
· ─────────
|
||||
7 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'override' modifier cannot appear on an index signature.
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/class/modifiers-override-errors/input.ts:3:3]
|
||||
2 │ override constructor() {}
|
||||
3 │ override [x: string]: any;
|
||||
· ────────
|
||||
4 │ }
|
||||
╰────
|
||||
|
||||
× Expected a semicolon or an implicit semicolon after a statement, but found none
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js:3:11]
|
||||
2 │ class A extends B {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ commit: df9d1650
|
|||
parser_typescript Summary:
|
||||
AST Parsed : 6481/6490 (99.86%)
|
||||
Positive Passed: 6470/6490 (99.69%)
|
||||
Negative Passed: 1237/5738 (21.56%)
|
||||
Negative Passed: 1239/5738 (21.59%)
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/ClassDeclaration10.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/ClassDeclaration11.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/ClassDeclaration13.ts
|
||||
|
|
@ -2405,8 +2405,6 @@ Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/c
|
|||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperProperties.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperStatementPosition.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/indexMemberDeclarations/staticIndexers.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts
|
||||
|
|
@ -2531,6 +2529,8 @@ Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/p
|
|||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature1.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature2.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature4.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature5.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature7.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/constEnums/constEnum2.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/constEnums/constEnum4.ts
|
||||
|
|
@ -3800,8 +3800,6 @@ Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ec
|
|||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/Generics/parserObjectCreation1.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration10.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration5.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration7.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration8.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts
|
||||
Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration1.ts
|
||||
|
|
@ -13994,6 +13992,30 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
╰────
|
||||
help: either remove this super, or extend the class
|
||||
|
||||
× TS(1071): 'private' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts:4:5]
|
||||
3 │ class C {
|
||||
4 │ private [x: string]: string;
|
||||
· ───────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'private' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts:8:5]
|
||||
7 │ class D {
|
||||
8 │ private [x: number]: string;
|
||||
· ───────
|
||||
9 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'private' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer.ts:12:5]
|
||||
11 │ class E<T> {
|
||||
12 │ private [x: string]: T;
|
||||
· ───────
|
||||
13 │ }
|
||||
╰────
|
||||
|
||||
× Expected `,` but found `[`
|
||||
╭─[typescript/tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts:4:13]
|
||||
3 │ var x = {
|
||||
|
|
@ -14003,6 +14025,30 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
5 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'public' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts:4:5]
|
||||
3 │ class C {
|
||||
4 │ public [x: string]: string;
|
||||
· ──────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'public' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts:8:5]
|
||||
7 │ class D {
|
||||
8 │ public [x: number]: string;
|
||||
· ──────
|
||||
9 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'public' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/indexMemberDeclarations/publicIndexer.ts:12:5]
|
||||
11 │ class E<T> {
|
||||
12 │ public [x: string]: T;
|
||||
· ──────
|
||||
13 │ }
|
||||
╰────
|
||||
|
||||
× Expected a semicolon or an implicit semicolon after a statement, but found none
|
||||
╭─[typescript/tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts:12:12]
|
||||
11 │
|
||||
|
|
@ -15102,38 +15148,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
9 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'static' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature4.ts:12:5]
|
||||
11 │ interface IB {
|
||||
12 │ static [s: string]: number;
|
||||
· ──────
|
||||
13 │ static [s: number]: 42 | 233;
|
||||
╰────
|
||||
|
||||
× TS(1071): 'static' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature4.ts:13:5]
|
||||
12 │ static [s: string]: number;
|
||||
13 │ static [s: number]: 42 | 233;
|
||||
· ──────
|
||||
14 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'static' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature5.ts:7:5]
|
||||
6 │ interface I {
|
||||
7 │ static readonly [s: string]: number;
|
||||
· ──────
|
||||
8 │ static readonly [s: number]: 42 | 233
|
||||
╰────
|
||||
|
||||
× TS(1071): 'static' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature5.ts:8:5]
|
||||
7 │ static readonly [s: string]: number;
|
||||
8 │ static readonly [s: number]: 42 | 233
|
||||
· ──────
|
||||
9 │ }
|
||||
╰────
|
||||
|
||||
× Expected `,` but found `is`
|
||||
╭─[typescript/tests/cases/conformance/controlFlow/assertionTypePredicates1.ts:163:20]
|
||||
162 │ get p1(): this is string;
|
||||
|
|
@ -20797,11 +20811,27 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private
|
|||
· ─
|
||||
╰────
|
||||
|
||||
× TS(1071): 'export' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts:2:4]
|
||||
× TS(1071): 'public' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration7.ts:2:4]
|
||||
1 │ class C {
|
||||
2 │ public [x: string]: string;
|
||||
· ──────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× TS(1071): 'private' modifier cannot appear on an index signature.
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration8.ts:2:4]
|
||||
1 │ class C {
|
||||
2 │ private [x: string]: string;
|
||||
· ───────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[typescript/tests/cases/conformance/parser/ecmascript5/IndexMemberDeclarations/parserIndexMemberDeclaration9.ts:2:11]
|
||||
1 │ class C {
|
||||
2 │ export [x: string]: string;
|
||||
· ──────
|
||||
· ─
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue