diff --git a/crates/oxc_parser/src/cursor.rs b/crates/oxc_parser/src/cursor.rs index 9308ec7951ef9..7f3af90045b0a 100644 --- a/crates/oxc_parser/src/cursor.rs +++ b/crates/oxc_parser/src/cursor.rs @@ -427,6 +427,7 @@ impl<'a> ParserImpl<'a> { &mut self, close: Kind, separator: Kind, + opening_span: Span, f: F, ) -> (Vec<'a, T>, Option) where @@ -450,7 +451,17 @@ impl<'a> ParserImpl<'a> { { return (list, None); } - self.expect(separator); + if !self.at(separator) { + self.set_fatal_error(diagnostics::expect_closing_or_separator( + close.to_str(), + separator.to_str(), + kind.to_str(), + self.cur_token().span(), + opening_span, + )); + return (list, None); + } + self.advance(separator); if self.cur_kind() == close { let trailing_separator = self.prev_token_end - 1; return (list, Some(trailing_separator)); diff --git a/crates/oxc_parser/src/diagnostics.rs b/crates/oxc_parser/src/diagnostics.rs index 498a7343908fa..e00e371813eb1 100644 --- a/crates/oxc_parser/src/diagnostics.rs +++ b/crates/oxc_parser/src/diagnostics.rs @@ -44,6 +44,23 @@ pub fn expect_token(x0: &str, x1: &str, span: Span) -> OxcDiagnostic { .with_label(span.label(format!("`{x0}` expected"))) } +#[cold] +pub fn expect_closing_or_separator( + expected_closing: &str, + expected_separator: &str, + actual: &str, + span: Span, + opening_span: Span, +) -> OxcDiagnostic { + OxcDiagnostic::error(format!( + "Expected `{expected_separator}` or `{expected_closing}` but found `{actual}`" + )) + .with_labels([ + span.primary_label(format!("`{expected_separator}` or `{expected_closing}` expected")), + opening_span.label("Opened here"), + ]) +} + #[cold] pub fn expect_conditional_alternative(x: &str, span: Span, question_span: Span) -> OxcDiagnostic { OxcDiagnostic::error(format!("Expected `:` but found `{x}`")).with_labels([ diff --git a/crates/oxc_parser/src/js/expression.rs b/crates/oxc_parser/src/js/expression.rs index 37d093c5ebe87..8cbf4301ea713 100644 --- a/crates/oxc_parser/src/js/expression.rs +++ b/crates/oxc_parser/src/js/expression.rs @@ -206,12 +206,14 @@ impl<'a> ParserImpl<'a> { fn parse_parenthesized_expression(&mut self) -> Expression<'a> { let span = self.start_span(); + let opening_span = self.cur_token().span(); self.bump_any(); // `bump` `(` let expr_span = self.start_span(); let (mut expressions, comma_span) = self.context(Context::In, Context::Decorator, |p| { p.parse_delimited_list( Kind::RParen, Kind::Comma, + opening_span, Self::parse_assignment_expression_or_higher, ) }); @@ -443,9 +445,15 @@ impl<'a> ParserImpl<'a> { /// [ `ElementList`[?Yield, ?Await] , Elisionopt ] pub(crate) fn parse_array_expression(&mut self) -> Expression<'a> { let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LBrack); let (elements, comma_span) = self.context_add(Context::In, |p| { - p.parse_delimited_list(Kind::RBrack, Kind::Comma, Self::parse_array_expression_element) + p.parse_delimited_list( + Kind::RBrack, + Kind::Comma, + opening_span, + Self::parse_array_expression_element, + ) }); if let Some(comma_span) = comma_span { self.state.trailing_commas.insert(span, self.end_span(comma_span)); @@ -635,9 +643,15 @@ impl<'a> ParserImpl<'a> { self.expect(Kind::Percent); let name = self.parse_identifier_name(); + let opening_span = self.cur_token().span(); self.expect(Kind::LParen); let (arguments, _) = self.context(Context::In, Context::Decorator, |p| { - p.parse_delimited_list(Kind::RParen, Kind::Comma, Self::parse_v8_intrinsic_argument) + p.parse_delimited_list( + Kind::RParen, + Kind::Comma, + opening_span, + Self::parse_v8_intrinsic_argument, + ) }); self.expect(Kind::RParen); self.ast.expression_v_8_intrinsic(self.end_span(span), name, arguments) @@ -891,12 +905,19 @@ impl<'a> ParserImpl<'a> { return self.fatal_error(error); } + let opening_span = self.cur_token().span(); + // parse `new ident` without arguments let arguments = if self.eat(Kind::LParen) { // ArgumentList[Yield, Await] : // AssignmentExpression[+In, ?Yield, ?Await] let (call_arguments, _) = self.context_add(Context::In, |p| { - p.parse_delimited_list(Kind::RParen, Kind::Comma, Self::parse_call_argument) + p.parse_delimited_list( + Kind::RParen, + Kind::Comma, + opening_span, + Self::parse_call_argument, + ) }); self.expect(Kind::RParen); call_arguments @@ -984,9 +1005,15 @@ impl<'a> ParserImpl<'a> { ) -> Expression<'a> { // ArgumentList[Yield, Await] : // AssignmentExpression[+In, ?Yield, ?Await] + let opening_span = self.cur_token().span(); self.expect(Kind::LParen); let (call_arguments, _) = self.context(Context::In, Context::Decorator, |p| { - p.parse_delimited_list(Kind::RParen, Kind::Comma, Self::parse_call_argument) + p.parse_delimited_list( + Kind::RParen, + Kind::Comma, + opening_span, + Self::parse_call_argument, + ) }); self.expect(Kind::RParen); self.ast.expression_call( diff --git a/crates/oxc_parser/src/js/module.rs b/crates/oxc_parser/src/js/module.rs index 5e15f293b619b..9d649571de24a 100644 --- a/crates/oxc_parser/src/js/module.rs +++ b/crates/oxc_parser/src/js/module.rs @@ -280,9 +280,10 @@ impl<'a> ParserImpl<'a> { &mut self, import_kind: ImportOrExportKind, ) -> Vec<'a, ImportDeclarationSpecifier<'a>> { + let opening_span = self.cur_token().span(); self.expect(Kind::LCurly); let (list, _) = self.context_remove(self.ctx, |p| { - p.parse_delimited_list(Kind::RCurly, Kind::Comma, |parser| { + p.parse_delimited_list(Kind::RCurly, Kind::Comma, opening_span, |parser| { parser.parse_import_specifier(import_kind) }) }); @@ -301,9 +302,15 @@ impl<'a> ParserImpl<'a> { self.bump_remap(keyword_kind); let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LCurly); let (with_entries, _) = self.context_remove(self.ctx, |p| { - p.parse_delimited_list(Kind::RCurly, Kind::Comma, Self::parse_import_attribute) + p.parse_delimited_list( + Kind::RCurly, + Kind::Comma, + opening_span, + Self::parse_import_attribute, + ) }); self.expect(Kind::RCurly); @@ -477,9 +484,10 @@ impl<'a> ParserImpl<'a> { stmt_ctx: StatementContext, ) -> Box<'a, ExportNamedDeclaration<'a>> { let export_kind = self.parse_import_or_export_kind(); + let opening_span = self.cur_token().span(); self.expect(Kind::LCurly); let (mut specifiers, _) = self.context_remove(self.ctx, |p| { - p.parse_delimited_list(Kind::RCurly, Kind::Comma, |parser| { + p.parse_delimited_list(Kind::RCurly, Kind::Comma, opening_span, |parser| { parser.parse_export_specifier(export_kind) }) }); diff --git a/crates/oxc_parser/src/js/object.rs b/crates/oxc_parser/src/js/object.rs index 3e8e0c825ad73..62e8a46a8be59 100644 --- a/crates/oxc_parser/src/js/object.rs +++ b/crates/oxc_parser/src/js/object.rs @@ -18,11 +18,13 @@ impl<'a> ParserImpl<'a> { /// { `PropertyDefinitionList`[?Yield, ?Await] , } pub(crate) fn parse_object_expression(&mut self) -> Box<'a, ObjectExpression<'a>> { let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LCurly); let (object_expression_properties, comma_span) = self.context_add(Context::In, |p| { p.parse_delimited_list( Kind::RCurly, Kind::Comma, + opening_span, Self::parse_object_expression_property, ) }); diff --git a/crates/oxc_parser/src/ts/statement.rs b/crates/oxc_parser/src/ts/statement.rs index d691240026291..880240a78b1c1 100644 --- a/crates/oxc_parser/src/ts/statement.rs +++ b/crates/oxc_parser/src/ts/statement.rs @@ -52,9 +52,14 @@ impl<'a> ParserImpl<'a> { pub(crate) fn parse_ts_enum_body(&mut self) -> TSEnumBody<'a> { let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LCurly); - let (members, _) = - self.parse_delimited_list(Kind::RCurly, Kind::Comma, Self::parse_ts_enum_member); + let (members, _) = self.parse_delimited_list( + Kind::RCurly, + Kind::Comma, + opening_span, + Self::parse_ts_enum_member, + ); self.expect(Kind::RCurly); self.ast.ts_enum_body(self.end_span(span), members) } diff --git a/crates/oxc_parser/src/ts/types.rs b/crates/oxc_parser/src/ts/types.rs index 7a9e321174449..e4c2a37fd8215 100644 --- a/crates/oxc_parser/src/ts/types.rs +++ b/crates/oxc_parser/src/ts/types.rs @@ -157,9 +157,14 @@ impl<'a> ParserImpl<'a> { return None; } let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LAngle); - let (params, _) = - self.parse_delimited_list(Kind::RAngle, Kind::Comma, Self::parse_ts_type_parameter); + let (params, _) = self.parse_delimited_list( + Kind::RAngle, + Kind::Comma, + opening_span, + Self::parse_ts_type_parameter, + ); self.expect(Kind::RAngle); let span = self.end_span(span); if params.is_empty() { @@ -806,9 +811,14 @@ impl<'a> ParserImpl<'a> { ) -> Option>> { if self.at(Kind::LAngle) { let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LAngle); - let (params, _) = - self.parse_delimited_list(Kind::RAngle, Kind::Comma, Self::parse_ts_type); + let (params, _) = self.parse_delimited_list( + Kind::RAngle, + Kind::Comma, + opening_span, + Self::parse_ts_type, + ); self.expect(Kind::RAngle); let span = self.end_span(span); if params.is_empty() { @@ -824,9 +834,14 @@ impl<'a> ParserImpl<'a> { ) -> Option>> { if !self.cur_token().is_on_new_line() && self.re_lex_ts_l_angle() { let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LAngle); - let (params, _) = - self.parse_delimited_list(Kind::RAngle, Kind::Comma, Self::parse_ts_type); + let (params, _) = self.parse_delimited_list( + Kind::RAngle, + Kind::Comma, + opening_span, + Self::parse_ts_type, + ); self.expect(Kind::RAngle); let span = self.end_span(span); if params.is_empty() { @@ -844,8 +859,10 @@ impl<'a> ParserImpl<'a> { if !self.re_lex_ts_l_angle() { return self.unexpected(); } + let opening_span = self.cur_token().span(); self.expect(Kind::LAngle); - let (params, _) = self.parse_delimited_list(Kind::RAngle, Kind::Comma, Self::parse_ts_type); + let (params, _) = + self.parse_delimited_list(Kind::RAngle, Kind::Comma, opening_span, Self::parse_ts_type); // `a < b> = c`` is valid but `a < b >= c` is BinaryExpression if matches!(self.re_lex_right_angle(), Kind::GtEq) { return self.unexpected(); @@ -876,9 +893,14 @@ impl<'a> ParserImpl<'a> { fn parse_tuple_type(&mut self) -> TSType<'a> { let span = self.start_span(); + let opening_span = self.cur_token().span(); self.expect(Kind::LBrack); - let (elements, _) = - self.parse_delimited_list(Kind::RBrack, Kind::Comma, Self::parse_tuple_element); + let (elements, _) = self.parse_delimited_list( + Kind::RBrack, + Kind::Comma, + opening_span, + Self::parse_tuple_element, + ); self.expect(Kind::RBrack); self.ast.ts_type_tuple_type(self.end_span(span), elements) } @@ -1216,10 +1238,12 @@ impl<'a> ParserImpl<'a> { span: u32, modifiers: &Modifiers<'a>, ) -> Box<'a, TSIndexSignature<'a>> { + let opening_span = self.cur_token().span(); self.expect(Kind::LBrack); let (params, comma_span) = self.parse_delimited_list( Kind::RBrack, Kind::Comma, + opening_span, Self::parse_ts_index_signature_name, ); if let Some(comma_span) = comma_span { diff --git a/tasks/coverage/misc/fail/imbalanced-array-expr.js b/tasks/coverage/misc/fail/imbalanced-array-expr.js new file mode 100644 index 0000000000000..93cf7e1e6839c --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-array-expr.js @@ -0,0 +1,2 @@ +const foo = [0, 1 +const bar = 2 diff --git a/tasks/coverage/misc/fail/imbalanced-call-expr.js b/tasks/coverage/misc/fail/imbalanced-call-expr.js new file mode 100644 index 0000000000000..bc4b7661a6049 --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-call-expr.js @@ -0,0 +1,2 @@ +const foo = bar(1 +const bar = 2; diff --git a/tasks/coverage/misc/fail/imbalanced-enum-expr.ts b/tasks/coverage/misc/fail/imbalanced-enum-expr.ts new file mode 100644 index 0000000000000..874e5c6a981c1 --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-enum-expr.ts @@ -0,0 +1,4 @@ +enum Foo { + A + +const bar = 1; diff --git a/tasks/coverage/misc/fail/imbalanced-export-expr.js b/tasks/coverage/misc/fail/imbalanced-export-expr.js new file mode 100644 index 0000000000000..4f9dc51fc44de --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-export-expr.js @@ -0,0 +1,3 @@ +export { foo + +const foo = "" diff --git a/tasks/coverage/misc/fail/imbalanced-import-decl-attr.js b/tasks/coverage/misc/fail/imbalanced-import-decl-attr.js new file mode 100644 index 0000000000000..8c800c6130e71 --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-import-decl-attr.js @@ -0,0 +1 @@ +import { } from "foo" with { "type": "json"; diff --git a/tasks/coverage/misc/fail/imbalanced-import-decl.js b/tasks/coverage/misc/fail/imbalanced-import-decl.js new file mode 100644 index 0000000000000..0cacb1575914a --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-import-decl.js @@ -0,0 +1 @@ +import { from "foo"; diff --git a/tasks/coverage/misc/fail/imbalanced-index-signature-decl.ts b/tasks/coverage/misc/fail/imbalanced-index-signature-decl.ts new file mode 100644 index 0000000000000..2c860f1217bdb --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-index-signature-decl.ts @@ -0,0 +1,3 @@ +type Foo = { + [key: string: number; +} diff --git a/tasks/coverage/misc/fail/imbalanced-new-expr.js b/tasks/coverage/misc/fail/imbalanced-new-expr.js new file mode 100644 index 0000000000000..7847a069860d9 --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-new-expr.js @@ -0,0 +1,2 @@ +const foo = new Foo(1 +const bar = 2; diff --git a/tasks/coverage/misc/fail/imbalanced-object-expr.js b/tasks/coverage/misc/fail/imbalanced-object-expr.js new file mode 100644 index 0000000000000..4aeef2226fe01 --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-object-expr.js @@ -0,0 +1,2 @@ +const foo = { a: 1 +const bar = 2; diff --git a/tasks/coverage/misc/fail/imbalanced-parenthesized-expr.js b/tasks/coverage/misc/fail/imbalanced-parenthesized-expr.js new file mode 100644 index 0000000000000..6d75a3f153182 --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-parenthesized-expr.js @@ -0,0 +1 @@ +const foo = (0, eval('1 + 2'); diff --git a/tasks/coverage/misc/fail/imbalanced-tuple-type.ts b/tasks/coverage/misc/fail/imbalanced-tuple-type.ts new file mode 100644 index 0000000000000..556e28fbef60e --- /dev/null +++ b/tasks/coverage/misc/fail/imbalanced-tuple-type.ts @@ -0,0 +1,3 @@ +type A = [number + +const bar = 1; diff --git a/tasks/coverage/snapshots/parser_babel.snap b/tasks/coverage/snapshots/parser_babel.snap index dd46de13a4fec..8e73c2c30944d 100644 --- a/tasks/coverage/snapshots/parser_babel.snap +++ b/tasks/coverage/snapshots/parser_babel.snap @@ -1977,25 +1977,28 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ─ ╰──── - × Expected `,` but found `{` + × Expected `,` or `}` but found `{` ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/392/input.js:1:13] 1 │ ({ set: s() { } }) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `{` + × Expected `,` or `}` but found `{` ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/393/input.js:1:17] 1 │ ({ set: s(a, b) { } }) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `{` + × Expected `,` or `}` but found `{` ╭─[babel/packages/babel-parser/test/fixtures/core/uncategorised/394/input.js:1:14] 1 │ ({ get: g(d) { } }) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × Unexpected token @@ -4012,12 +4015,15 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ─ ╰──── - × Expected `,` but found `Identifier` + × Expected `,` or `}` but found `Identifier` ╭─[babel/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/input.js:3:5] + 1 │ ({ + · ┬ + · ╰── Opened here 2 │ async 3 │ foo() {} · ─┬─ - · ╰── `,` expected + · ╰── `,` or `}` expected 4 │ }) ╰──── @@ -4031,12 +4037,14 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc 3 │ }) ╰──── - × Expected `,` but found `*` + × Expected `,` or `}` but found `*` ╭─[babel/packages/babel-parser/test/fixtures/es2015/object/invalid-accessor-generator/input.js:2:9] 1 │ ({ + · ┬ + · ╰── Opened here 2 │ get *iterator() { }, · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 3 │ set *iterator(iter) { } ╰──── @@ -5047,11 +5055,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ───── ╰──── - × Expected `,` but found `:` + × Expected `,` or `}` but found `:` ╭─[babel/packages/babel-parser/test/fixtures/es2015/uncategorised/392/input.js:1:18] 1 │ import foo, { bar: { a } } from 'my-module'; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -9649,11 +9658,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ╰── `)` expected ╰──── - × Expected `,` but found `...` + × Expected `,` or `)` but found `...` ╭─[babel/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/arrow-rest-forgetting-comma/input.js:1:4] 1 │ (a ...b) => 0 - · ─┬─ - · ╰── `,` expected + · ┬ ─┬─ + · │ ╰── `,` or `)` expected + · ╰── Opened here ╰──── × A rest parameter must be last in a parameter list @@ -9726,11 +9736,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc ╰──── help: Try inserting a semicolon here - × Expected `,` but found `=>` + × Expected `,` or `)` but found `=>` ╭─[babel/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-pattern-without-parenthesis/input.js:1:4] 1 │ ({}=>0) - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here ╰──── × Unexpected token @@ -11146,25 +11157,28 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc ╰──── help: Add a parameter here - × Expected `,` but found `{` + × Expected `,` or `}` but found `{` ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0076/input.js:1:13] 1 │ ({ set: s() { } }) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `{` + × Expected `,` or `}` but found `{` ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0077/input.js:1:17] 1 │ ({ set: s(a, b) { } }) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `{` + × Expected `,` or `}` but found `{` ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0078/input.js:1:14] 1 │ ({ get: g(d) { } }) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × Expected `]` but found `,` @@ -11187,11 +11201,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ─ ╰──── - × Expected `,` but found `{` + × Expected `,` or `}` but found `{` ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0083/input.js:1:6] 1 │ ({get{a}:0}) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × Expected `}` but found `EOF` @@ -11296,11 +11311,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ──── ╰──── - × Expected `,` but found `/` + × Expected `,` or `}` but found `/` ╭─[babel/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0102/input.js:1:8] 1 │ p = { q/ } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × Expected `:` but found `/` @@ -12773,19 +12789,21 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc ╰──── help: Try inserting a semicolon here - × Expected `,` but found `:` + × Expected `,` or `)` but found `:` ╭─[babel/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts:1:7] 1 │ func(a: T); - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here 2 │ func(a: T); ╰──── - × Expected `,` but found `:` + × Expected `,` or `)` but found `:` ╭─[babel/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast-babel-7/input.ts:1:7] 1 │ func(a: T); - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here 2 │ func(a: T); ╰──── @@ -14480,12 +14498,13 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc 2 │ yield 2; ╰──── - × Expected `,` but found `:` + × Expected `,` or `]` but found `:` ╭─[babel/packages/babel-parser/test/fixtures/typescript/tsx/cast-invalid/input.tsx:3:22] 2 │ return ( 3 │
- · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here 4 │ ); ╰──── @@ -14771,25 +14790,28 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ──────── ╰──── - × Expected `,` but found `:` + × Expected `,` or `]` but found `:` ╭─[babel/packages/babel-parser/test/fixtures/typescript/types/tuple-invalid-label-1/input.ts:1:14] 1 │ type T = [x.y: A]; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here ╰──── - × Expected `,` but found `:` + × Expected `,` or `]` but found `:` ╭─[babel/packages/babel-parser/test/fixtures/typescript/types/tuple-invalid-label-2/input.ts:1:15] 1 │ type T = [x: A]; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here ╰──── - × Expected `,` but found `:` + × Expected `,` or `]` but found `:` ╭─[babel/packages/babel-parser/test/fixtures/typescript/types/tuple-invalid-label-2-babel-7/input.ts:1:15] 1 │ type T = [x: A]; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here ╰──── × TS(5086): A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type. diff --git a/tasks/coverage/snapshots/parser_misc.snap b/tasks/coverage/snapshots/parser_misc.snap index a63e801c07f97..25b78051807b9 100644 --- a/tasks/coverage/snapshots/parser_misc.snap +++ b/tasks/coverage/snapshots/parser_misc.snap @@ -1,7 +1,7 @@ parser_misc Summary: AST Parsed : 48/48 (100.00%) Positive Passed: 48/48 (100.00%) -Negative Passed: 96/96 (100.00%) +Negative Passed: 107/107 (100.00%) × Cannot assign to 'arguments' in strict mode ╭─[misc/fail/arguments-eval.ts:1:10] @@ -50,6 +50,114 @@ Negative Passed: 96/96 (100.00%) 8 │ ╰──── + × Expected `,` or `]` but found `const` + ╭─[misc/fail/imbalanced-array-expr.js:2:1] + 1 │ const foo = [0, 1 + · ┬ + · ╰── Opened here + 2 │ const bar = 2 + · ──┬── + · ╰── `,` or `]` expected + ╰──── + + × Expected `,` or `)` but found `const` + ╭─[misc/fail/imbalanced-call-expr.js:2:1] + 1 │ const foo = bar(1 + · ┬ + · ╰── Opened here + 2 │ const bar = 2; + · ──┬── + · ╰── `,` or `)` expected + ╰──── + + × Expected `,` or `}` but found `const` + ╭─[misc/fail/imbalanced-enum-expr.ts:4:1] + 1 │ enum Foo { + · ┬ + · ╰── Opened here + 2 │ A + 3 │ + 4 │ const bar = 1; + · ──┬── + · ╰── `,` or `}` expected + ╰──── + + × Expected `,` or `}` but found `const` + ╭─[misc/fail/imbalanced-export-expr.js:3:1] + 1 │ export { foo + · ┬ + · ╰── Opened here + 2 │ + 3 │ const foo = "" + · ──┬── + · ╰── `,` or `}` expected + ╰──── + + × Expected `,` or `}` but found `;` + ╭─[misc/fail/imbalanced-import-decl-attr.js:1:44] + 1 │ import { } from "foo" with { "type": "json"; + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here + ╰──── + + × Expected `,` or `}` but found `string` + ╭─[misc/fail/imbalanced-import-decl.js:1:15] + 1 │ import { from "foo"; + · ┬ ──┬── + · │ ╰── `,` or `}` expected + · ╰── Opened here + ╰──── + + × Expected `,` or `]` but found `:` + ╭─[misc/fail/imbalanced-index-signature-decl.ts:2:15] + 1 │ type Foo = { + 2 │ [key: string: number; + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here + 3 │ } + ╰──── + + × Expected `,` or `)` but found `const` + ╭─[misc/fail/imbalanced-new-expr.js:2:1] + 1 │ const foo = new Foo(1 + · ┬ + · ╰── Opened here + 2 │ const bar = 2; + · ──┬── + · ╰── `,` or `)` expected + ╰──── + + × Expected `,` or `}` but found `const` + ╭─[misc/fail/imbalanced-object-expr.js:2:1] + 1 │ const foo = { a: 1 + · ┬ + · ╰── Opened here + 2 │ const bar = 2; + · ──┬── + · ╰── `,` or `}` expected + ╰──── + + × Expected `,` or `)` but found `;` + ╭─[misc/fail/imbalanced-parenthesized-expr.js:1:30] + 1 │ const foo = (0, eval('1 + 2'); + · ┬ ┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here + ╰──── + + × Expected `,` or `]` but found `const` + ╭─[misc/fail/imbalanced-tuple-type.ts:3:1] + 1 │ type A = [number + · ┬ + · ╰── Opened here + 2 │ + 3 │ const bar = 1; + · ──┬── + · ╰── `,` or `]` expected + ╰──── + × Expected `:` but found `EOF` ╭─[misc/fail/missing-conditional-alternative-type.ts:2:1] 1 │ type A = 1 extends 2 ? 3 diff --git a/tasks/coverage/snapshots/parser_test262.snap b/tasks/coverage/snapshots/parser_test262.snap index 50f6976984ea4..2b3f1d09de5d5 100644 --- a/tasks/coverage/snapshots/parser_test262.snap +++ b/tasks/coverage/snapshots/parser_test262.snap @@ -1525,12 +1525,13 @@ Expect to Parse: tasks/coverage/test262/test/annexB/language/expressions/assignm · ─ ╰──── - × Expected `,` but found `;` + × Expected `,` or `)` but found `;` ╭─[test262/test/language/asi/S7.9_A10_T4.js:17:4] 16 │ //CHECK#1 17 │ ({};) * 1 - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here ╰──── × Unexpected token @@ -18934,12 +18935,16 @@ Expect to Parse: tasks/coverage/test262/test/annexB/language/expressions/assignm 19 │ }) ╰──── - × Expected `,` but found `Identifier` + × Expected `,` or `}` but found `Identifier` ╭─[test262/test/language/expressions/object/method-definition/early-errors-object-method-async-lineterminator.js:22:3] + 19 │ + 20 │ ({ + · ┬ + · ╰── Opened here 21 │ async 22 │ foo() { } · ─┬─ - · ╰── `,` expected + · ╰── `,` or `}` expected 23 │ }) ╰──── @@ -26384,21 +26389,23 @@ Expect to Parse: tasks/coverage/test262/test/annexB/language/expressions/assignm · ╰── `while` expected ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[test262/test/language/statements/block/S12.1_A4_T1.js:20:10] 19 │ //CHECK#1 20 │ y={__func;}(); - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 21 │ // ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[test262/test/language/statements/block/S12.1_A4_T2.js:20:5] 19 │ //CHECK#1 20 │ y={x;}; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 21 │ // ╰──── @@ -33667,21 +33674,23 @@ Expect to Parse: tasks/coverage/test262/test/annexB/language/expressions/assignm 23 │ // ╰──── - × Expected `,` but found `++` + × Expected `,` or `}` but found `++` ╭─[test262/test/language/statements/for/S12.6.3_A8.1_T1.js:22:35] 21 │ //CHECK#1 22 │ for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 23 │ // ╰──── - × Expected `,` but found `++` + × Expected `,` or `}` but found `++` ╭─[test262/test/language/statements/for/S12.6.3_A8.1_T2.js:22:24] 21 │ //CHECK#1 22 │ for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 23 │ // ╰──── @@ -33694,30 +33703,33 @@ Expect to Parse: tasks/coverage/test262/test/annexB/language/expressions/assignm 23 │ // ╰──── - × Expected `,` but found `++` + × Expected `,` or `}` but found `++` ╭─[test262/test/language/statements/for/S12.6.3_A8_T1.js:22:31] 21 │ //CHECK#1 22 │ for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);}; - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 23 │ // ╰──── - × Expected `,` but found `++` + × Expected `,` or `}` but found `++` ╭─[test262/test/language/statements/for/S12.6.3_A8_T2.js:22:20] 21 │ //CHECK#1 22 │ for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);}; - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 23 │ // ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[test262/test/language/statements/for/S12.6.3_A8_T3.js:22:13] 21 │ //CHECK#1 22 │ for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);}; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 23 │ // ╰──── @@ -34752,12 +34764,13 @@ Expect to Parse: tasks/coverage/test262/test/annexB/language/expressions/assignm ╰──── help: Wrap this declaration in a block statement - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[test262/test/language/statements/for-in/S12.6.4_A15.js:20:16] 19 │ //CHECK# 20 │ for(x in {__arr;}){ - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 21 │ break ; ╰──── diff --git a/tasks/coverage/snapshots/parser_typescript.snap b/tasks/coverage/snapshots/parser_typescript.snap index 4f9007c477fad..cca87a2212af8 100644 --- a/tasks/coverage/snapshots/parser_typescript.snap +++ b/tasks/coverage/snapshots/parser_typescript.snap @@ -5039,12 +5039,13 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc · ────── ╰──── - × Expected `,` but found `(` + × Expected `,` or `>` but found `(` ╭─[typescript/tests/cases/compiler/assertInWrapSomeTypeParameter.ts:2:26] 1 │ class C> { 2 │ foo>(x: U) { - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `>` expected + · ╰── Opened here 3 │ return null; ╰──── @@ -7642,12 +7643,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 3 │ } ╰──── - × Expected `,` but found `}` + × Expected `,` or `)` but found `}` ╭─[typescript/tests/cases/compiler/enumWithParenthesizedInitializer1.ts:3:1] + 1 │ enum E { 2 │ e = -(3 + · ┬ + · ╰── Opened here 3 │ } · ┬ - · ╰── `,` expected + · ╰── `,` or `)` expected ╰──── × TS(2414): Enum name cannot be 'string' @@ -7718,12 +7722,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 3 │ }; ╰──── - × Expected `,` but found `Identifier` + × Expected `,` or `)` but found `Identifier` ╭─[typescript/tests/cases/compiler/errorRecoveryInClassDeclaration.ts:4:20] + 2 │ public bar() { 3 │ var v = foo( + · ┬ + · ╰── Opened here 4 │ public blaz() {} · ──┬─ - · ╰── `,` expected + · ╰── `,` or `)` expected 5 │ ); ╰──── @@ -8291,12 +8298,13 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc ╰──── help: Try inserting a semicolon here - × Expected `,` but found `=>` + × Expected `,` or `)` but found `=>` ╭─[typescript/tests/cases/compiler/fatarrowfunctionsErrors.ts:2:8] 1 │ foo((...Far:any[])=>{return 0;}) 2 │ foo((1)=>{return 0;}); - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here 3 │ foo((x?)=>{return x;}) ╰──── @@ -8665,11 +8673,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 2 │ var p2 = window. ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/compiler/incompleteObjectLiteral1.ts:1:14] 1 │ var tt = { aa; } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 2 │ var x = tt; ╰──── @@ -8729,12 +8738,13 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 3 │ } ╰──── - × Expected `,` but found `=` + × Expected `,` or `]` but found `=` ╭─[typescript/tests/cases/compiler/indexSignatureWithInitializer1.ts:2:14] 1 │ class C { 2 │ [a: number = 1]: number; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here 3 │ } ╰──── @@ -10550,59 +10560,71 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc · ────── ╰──── - × Expected `,` but found `?` + × Expected `,` or `}` but found `?` ╭─[typescript/tests/cases/compiler/objectLiteralMemberWithQuestionMark1.ts:1:14] 1 │ var v = { foo?() { } } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/compiler/objectLiteralWithSemicolons1.ts:1:12] 1 │ var v = { a; b; c } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/compiler/objectLiteralWithSemicolons2.ts:2:4] 1 │ var v = { + · ┬ + · ╰── Opened here 2 │ a; · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 3 │ b; ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/compiler/objectLiteralWithSemicolons3.ts:2:4] 1 │ var v = { + · ┬ + · ╰── Opened here 2 │ a; · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 3 │ b; ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/compiler/objectLiteralWithSemicolons4.ts:3:1] + 1 │ var v = { + · ┬ + · ╰── Opened here 2 │ a 3 │ ; · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/compiler/objectLiteralWithSemicolons5.ts:1:20] 1 │ var v = { foo() { }; a: b; get baz() { }; } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `?` + × Expected `,` or `}` but found `?` ╭─[typescript/tests/cases/compiler/objectTypeWithOptionalProperty1.ts:2:10] 1 │ var b = { + · ┬ + · ╰── Opened here 2 │ x?: 1 // error · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 3 │ } ╰──── @@ -11474,11 +11496,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc · ╰── `in` expected ╰──── - × Expected `,` but found `;` + × Expected `,` or `)` but found `;` ╭─[typescript/tests/cases/compiler/parserUnparsedTokenCrash1.ts:1:9] 1 │ ( y = 1 ; 2 ) - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here ╰──── × Unexpected token @@ -12297,11 +12320,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 44 │ i = 2; ╰──── - × Expected `,` but found `?` + × Expected `,` or `}` but found `?` ╭─[typescript/tests/cases/compiler/spaceBeforeQuestionMarkInPropertyAssignment.ts:1:12] 1 │ var x = {x ?: 1} // should not crash - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × Illegal break statement @@ -13877,19 +13901,22 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 3 │ } ╰──── - × Expected `,` but found `string` + × Expected `,` or `}` but found `string` ╭─[typescript/tests/cases/compiler/unclosedExportClause01.ts:1:18] 1 │ export { x, from "./t1" - · ───┬── - · ╰── `,` expected + · ┬ ───┬── + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `string` + × Expected `,` or `}` but found `string` ╭─[typescript/tests/cases/compiler/unclosedExportClause02.ts:2:5] 1 │ export { x, from + · ┬ + · ╰── Opened here 2 │ "./t1"; · ───┬── - · ╰── `,` expected + · ╰── `,` or `}` expected ╰──── × TS(2414): Type alias name cannot be 'undefined' @@ -14828,20 +14855,22 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 4 │ class C5a extends null { } ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts:6:31] 5 │ 6 │ class C2 extends { foo: string; } { } // error - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 7 │ var x: { foo: string; } ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts:1:31] 1 │ class C2 extends { foo: string; } { } // error - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 2 │ ╰──── @@ -16490,12 +16519,16 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 35 │ accessor import {} from "x"; ╰──── - × Expected `,` but found `*` + × Expected `,` or `}` but found `*` ╭─[typescript/tests/cases/conformance/classes/propertyMemberDeclarations/canFollowGetSetKeyword.ts:11:5] + 8 │ } + 9 │ const c = { + · ┬ + · ╰── Opened here 10 │ get 11 │ *x() {} · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 12 │ }; ╰──── @@ -16719,12 +16752,13 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 72 │ } ╰──── - × Expected `,` but found `!` + × Expected `,` or `}` but found `!` ╭─[typescript/tests/cases/conformance/controlFlow/definiteAssignmentAssertionsWithObjectShortHand.ts:2:16] 1 │ const a: string | undefined = 'ff'; 2 │ const foo = { a! } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 3 │ ╰──── @@ -16979,12 +17013,18 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc ╰──── help: Either remove this `await` or add the `async` keyword to the enclosing function - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/conformance/enums/enumErrors.ts:48:18] + 43 │ // Enum with incorrect syntax + 44 │ enum E13 { + · ┬ + · ╰── Opened here + 45 │ postComma, + 46 │ postValueComma = 1, 47 │ 48 │ postSemicolon; · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 49 │ postColonValueComma: 2, ╰──── @@ -17456,12 +17496,13 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 97 │ ╰──── - × Expected `,` but found `)` + × Expected `,` or `]` but found `)` ╭─[typescript/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts:7:29] 6 │ function a0([a, b, [[c]]]: [number, number, string[][]]) { } 7 │ a0([1, "string", [["world"]]); // Error - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here 8 │ a0([1, 2, [["world"]], "string"]); // Error ╰──── @@ -17972,12 +18013,17 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc · ───── ╰──── - × Expected `,` but found `string` + × Expected `,` or `}` but found `string` ╭─[typescript/tests/cases/conformance/es6/modules/exportsAndImportsWithUnderscores1.ts:5:5] + 1 │ var R: any + 2 │ export default R = { + · ┬ + · ╰── Opened here + 3 │ "__": 20, 4 │ "_": 10 5 │ "___": 30 · ──┬── - · ╰── `,` expected + · ╰── `,` or `}` expected 6 │ } ╰──── @@ -18145,12 +18191,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 4 │ 42, ╰──── - × Expected `,` but found `.` + × Expected `,` or `}` but found `.` ╭─[typescript/tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorWithModule.ts:10:10] + 8 │ var z = 10000; 9 │ export var y = { + · ┬ + · ╰── Opened here 10 │ m.x // error · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 11 │ }; ╰──── @@ -21243,12 +21292,13 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc ╰──── help: Remove this 'type' modifier - × Expected `,` but found `Identifier` + × Expected `,` or `}` but found `Identifier` ╭─[typescript/tests/cases/conformance/externalModules/typeOnly/exportSpecifiers_js.ts:2:15] 1 │ const foo = 0; 2 │ export { type foo }; - · ─┬─ - · ╰── `,` expected + · ┬ ─┬─ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × Expected `from` but found `Identifier` @@ -21259,18 +21309,20 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 2 │ export type { A }; ╰──── - × Expected `,` but found `as` + × Expected `,` or `}` but found `as` ╭─[typescript/tests/cases/conformance/externalModules/typeOnly/importSpecifiers1.ts:1:24] 1 │ import { type as as as as } from "./mod.js"; // Error - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `Identifier` + × Expected `,` or `}` but found `Identifier` ╭─[typescript/tests/cases/conformance/externalModules/typeOnly/importSpecifiers_js.ts:1:15] 1 │ import { type A } from "./a"; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── × TS(1029): 'export' modifier must precede 'declare' modifier. @@ -22063,12 +22115,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 9 │ x1.isElement; ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/conformance/jsx/tsxStatelessFunctionComponents1.tsx:41:16] + 39 │ 40 │ let o = { + · ┬ + · ╰── Opened here 41 │ prop1: true; · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 42 │ } ╰──── @@ -22507,11 +22562,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc ╰──── help: Try inserting a semicolon here - × Expected `,` but found `||` + × Expected `,` or `)` but found `||` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression3.ts:1:16] 1 │ a = (() => { } || a) - · ─┬ - · ╰── `,` expected + · ┬ ─┬ + · │ ╰── `,` or `)` expected + · ╰── Opened here ╰──── × TS(1172): 'extends' clause already seen @@ -22740,12 +22796,13 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 3 │ } ╰──── - × Expected `,` but found `:` + × Expected `,` or `}` but found `:` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/EnumDeclarations/parserEnum5.ts:2:12] 1 │ enum E2 { a, } 2 │ enum E3 { a: 1, } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 3 │ enum E1 { a, b: 1, c, d: 2 = 3 } ╰──── @@ -22794,12 +22851,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 4 │ } ╰──── - × Expected `,` but found `return` + × Expected `,` or `)` but found `return` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList4.ts:3:4] + 1 │ function foo() { 2 │ bar(a,b + · ┬ + · ╰── Opened here 3 │ return; · ───┬── - · ╰── `,` expected + · ╰── `,` or `)` expected 4 │ } ╰──── @@ -22815,27 +22875,33 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc · ─ ╰──── - × Expected `,` but found `decimal` + × Expected `,` or `]` but found `decimal` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrayLiteralExpressions/parserErrorRecoveryArrayLiteralExpression1.ts:2:1] 1 │ var v = [1, 2, 3 + · ┬ + · ╰── Opened here 2 │ 4, 5, 6, 7]; · ┬ - · ╰── `,` expected + · ╰── `,` or `]` expected ╰──── - × Expected `,` but found `float` + × Expected `,` or `]` but found `float` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrayLiteralExpressions/parserErrorRecoveryArrayLiteralExpression2.ts:3:2] + 1 │ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0 + · ┬ + · ╰── Opened here 2 │ 3 │ .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; · ────────┬──────── - · ╰── `,` expected + · ╰── `,` or `]` expected ╰──── - × Expected `,` but found `;` + × Expected `,` or `]` but found `;` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrayLiteralExpressions/parserErrorRecoveryArrayLiteralExpression3.ts:1:54] 1 │ var texCoords = [2, 2, 0.5000001192092895, 0.8749999 ; 403953552, 0.5000001192092895, 0.8749999403953552]; - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `]` expected + · ╰── Opened here ╰──── × Unexpected token @@ -23055,19 +23121,22 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 8 │ ) ╰──── - × Expected `,` but found `Identifier` + × Expected `,` or `}` but found `Identifier` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral1.ts:1:16] 1 │ var v = { a: 1 b: 2 } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here ╰──── - × Expected `,` but found `return` + × Expected `,` or `}` but found `return` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts:2:1] 1 │ var v = { a + · ┬ + · ╰── Opened here 2 │ return; · ───┬── - · ╰── `,` expected + · ╰── `,` or `}` expected ╰──── × Unexpected token @@ -23077,12 +23146,14 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc · ────── ╰──── - × Expected `,` but found `return` + × Expected `,` or `}` but found `return` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral4.ts:2:1] 1 │ var v = { a: 1 + · ┬ + · ╰── Opened here 2 │ return; · ───┬── - · ╰── `,` expected + · ╰── `,` or `}` expected ╰──── × Expected `:` but found `;` @@ -24090,11 +24161,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 1 │ class foo { ╰──── - × Expected `,` but found `;` + × Expected `,` or `}` but found `;` ╭─[typescript/tests/cases/conformance/parser/ecmascript5/RegressionTests/parser512097.ts:1:14] 1 │ var tt = { aa; } - · ┬ - · ╰── `,` expected + · ┬ ┬ + · │ ╰── `,` or `}` expected + · ╰── Opened here 2 │ ╰──── @@ -24334,11 +24406,9 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 1 │ foo(a, \ ╰──── - × Expected `,` but found `Identifier` - ╭─[typescript/tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens18.ts:1:7] + × Invalid Unicode escape sequence + ╭─[typescript/tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens18.ts:1:8] 1 │ foo(a \ - · ┬ - · ╰── `,` expected ╰──── × Invalid Unicode escape sequence @@ -24359,11 +24429,9 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc · ─ ╰──── - × Expected `,` but found `Identifier` - ╭─[typescript/tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens20.ts:1:12] + × Invalid Unicode escape sequence + ╭─[typescript/tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens20.ts:1:13] 1 │ var v: X `color: var(--button-${fontType}-${state}-font-color)`; + 9 │ this.classFormat(`${style('active')}); + · ┬ + · ╰── Opened here + 10 │ } + 11 │ for (let item of size) { + 12 │ const fontType = item.type; + 13 │ this.classFormat( 14 │ [ 15 │ `font-size: var(--button-size-${fontType}-fontSize)`, · ──┬─ - · ╰── `,` expected + · ╰── `,` or `)` expected 16 │ `height: var(--button-size-${fontType}-height)`, ╰──── - × Expected `,` but found `Identifier` + × Expected `,` or `)` but found `Identifier` ╭─[typescript/tests/cases/conformance/statements/labeledStatements/labeledStatementDeclarationListInLoopNoCrash4.ts:13:12] + 6 │ const style = (state: string) => `color: var(--button-${fontType}-${state}-font-color)`; + 7 │ this.classFormat(`${style('active')}); + · ┬ + · ╰── Opened here + 8 │ } + 9 │ for (let item of size) { + 10 │ const fontType = item.type; + 11 │ this.classFormat( 12 │ [ 13 │ `font-size: var(--button-size-${fontType}-fontSize)`, · ──┬─ - · ╰── `,` expected + · ╰── `,` or `)` expected 14 │ `height: var foo`, ╰──── @@ -27150,12 +27236,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 6 │ ╰──── - × Expected `,` but found `?` + × Expected `,` or `}` but found `?` ╭─[typescript/tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts:24:6] + 22 │ 23 │ var b = { + · ┬ + · ╰── Opened here 24 │ x?: 1 // error · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 25 │ } ╰──── @@ -27167,12 +27256,16 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 5 │ } ╰──── - × Expected `,` but found `decimal` + × Expected `,` or `}` but found `decimal` ╭─[typescript/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts:20:5] + 17 │ + 18 │ var b = { + · ┬ + · ╰── Opened here 19 │ 2: 1 20 │ 2: 1 · ┬ - · ╰── `,` expected + · ╰── `,` or `}` expected 21 │ } ╰──── @@ -27189,12 +27282,16 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc 7 │ } ╰──── - × Expected `,` but found `string` + × Expected `,` or `}` but found `string` ╭─[typescript/tests/cases/conformance/types/objectTypeLiteral/propertySignatures/stringNamedPropertyDuplicates.ts:20:5] + 17 │ + 18 │ var b = { + · ┬ + · ╰── Opened here 19 │ "a b": 1 20 │ "a b": 1 · ──┬── - · ╰── `,` expected + · ╰── `,` or `}` expected 21 │ } ╰──── diff --git a/tasks/track_memory_allocations/allocs_parser.snap b/tasks/track_memory_allocations/allocs_parser.snap index 976faf52bc98c..2597edeb414a9 100644 --- a/tasks/track_memory_allocations/allocs_parser.snap +++ b/tasks/track_memory_allocations/allocs_parser.snap @@ -1,8 +1,8 @@ File | File size || Sys allocs | Sys reallocs || Arena allocs | Arena reallocs | Arena bytes ------------------------------------------------------------------------------------------------------------------------------------------- -checker.ts | 2.92 MB || 10165 | 21 || 268665 | 23341 +checker.ts | 2.92 MB || 9671 | 21 || 267681 | 22847 -cal.com.tsx | 1.06 MB || 2210 | 62 || 138188 | 13712 +cal.com.tsx | 1.06 MB || 2197 | 62 || 138162 | 13699 RadixUIAdoptionSection.jsx | 2.52 kB || 1 | 0 || 365 | 66 @@ -10,5 +10,5 @@ pdf.mjs | 567.30 kB || 701 | 75 | antd.js | 6.69 MB || 6997 | 235 || 528505 | 55357 -binder.ts | 193.08 kB || 538 | 7 || 16807 | 1475 +binder.ts | 193.08 kB || 530 | 7 || 16791 | 1467