refactor(parser): use function instead of trait to parse list with rest element (#4028)

closes #3887
This commit is contained in:
Boshen 2024-07-02 13:43:14 +00:00
parent 6254a4106f
commit 243c9f35b0
12 changed files with 395 additions and 396 deletions

View file

@ -1,8 +1,9 @@
//! Code related to navigating `Token`s from the lexer
use oxc_allocator::Vec;
use oxc_ast::ast::{Decorator, RegExpFlags};
use oxc_diagnostics::Result;
use oxc_span::Span;
use oxc_span::{GetSpan, Span};
use crate::{
diagnostics,
@ -330,7 +331,7 @@ impl<'a> ParserImpl<'a> {
result
}
pub(crate) fn consume_decorators(&mut self) -> oxc_allocator::Vec<'a, Decorator<'a>> {
pub(crate) fn consume_decorators(&mut self) -> Vec<'a, Decorator<'a>> {
let decorators = std::mem::take(&mut self.state.decorators);
self.ast.new_vec_from_iter(decorators)
}
@ -340,7 +341,7 @@ impl<'a> ParserImpl<'a> {
open: Kind,
close: Kind,
f: F,
) -> Result<oxc_allocator::Vec<'a, T>>
) -> Result<Vec<'a, T>>
where
F: Fn(&mut Self) -> Result<Option<T>>,
{
@ -367,7 +368,7 @@ impl<'a> ParserImpl<'a> {
separator: Kind,
trailing_separator: bool,
f: F,
) -> Result<oxc_allocator::Vec<'a, T>>
) -> Result<Vec<'a, T>>
where
F: Fn(&mut Self) -> Result<T>,
{
@ -393,4 +394,43 @@ impl<'a> ParserImpl<'a> {
}
Ok(list)
}
pub(crate) fn parse_delimited_list_with_rest<E, R, A, B>(
&mut self,
close: Kind,
parse_element: E,
parse_rest: R,
) -> Result<(Vec<'a, A>, Option<B>)>
where
E: Fn(&mut Self) -> Result<A>,
R: Fn(&mut Self) -> Result<B>,
B: GetSpan,
{
let mut list = self.ast.new_vec();
let mut rest = None;
let mut first = true;
loop {
let kind = self.cur_kind();
if kind == close || kind == Kind::Eof {
break;
}
if first {
first = false;
} else {
self.expect(Kind::Comma)?;
if self.at(close) {
break;
}
}
if self.at(Kind::Dot3) {
if let Some(r) = rest.replace(parse_rest(self)?) {
self.error(diagnostics::binding_rest_element_last(r.span()));
}
} else {
list.push(parse_element(self)?);
}
}
Ok((list, rest))
}
}

View file

@ -1,10 +1,8 @@
use oxc_allocator::Box;
use oxc_ast::ast::*;
use oxc_diagnostics::Result;
use oxc_span::Span;
use oxc_span::{GetSpan, Span};
use super::list::{ArrayPatternList, ObjectPatternProperties};
use crate::{diagnostics, lexer::Kind, list::SeparatedList, Context, ParserImpl};
use crate::{diagnostics, lexer::Kind, Context, ParserImpl};
impl<'a> ParserImpl<'a> {
/// `BindingElement`
@ -46,19 +44,60 @@ impl<'a> ParserImpl<'a> {
/// Section 14.3.3 Object Binding Pattern
fn parse_object_binding_pattern(&mut self) -> Result<BindingPatternKind<'a>> {
let span = self.start_span();
let props = ObjectPatternProperties::parse(self)?;
Ok(self.ast.object_pattern(self.end_span(span), props.elements, props.rest))
self.expect(Kind::LCurly)?;
let (list, rest) = self.parse_delimited_list_with_rest(
Kind::RCurly,
Self::parse_binding_property,
Self::parse_rest_binding,
)?;
if let Some(rest) = &rest {
if !matches!(&rest.argument.kind, BindingPatternKind::BindingIdentifier(_)) {
return Err(diagnostics::invalid_binding_rest_element(rest.argument.span()));
}
}
self.expect(Kind::RCurly)?;
Ok(self.ast.object_pattern(self.end_span(span), list, rest.map(|r| self.ast.alloc(r))))
}
/// Section 14.3.3 Array Binding Pattern
fn parse_array_binding_pattern(&mut self) -> Result<BindingPatternKind<'a>> {
let span = self.start_span();
let list = ArrayPatternList::parse(self)?;
Ok(self.ast.array_pattern(self.end_span(span), list.elements, list.rest))
self.expect(Kind::LBrack)?;
let (list, rest) = self.parse_delimited_list_with_rest(
Kind::RBrack,
Self::parse_array_binding_element,
Self::parse_rest_binding,
)?;
self.expect(Kind::RBrack)?;
Ok(self.ast.array_pattern(self.end_span(span), list, rest.map(|r| self.ast.alloc(r))))
}
fn parse_array_binding_element(&mut self) -> Result<Option<BindingPattern<'a>>> {
if self.at(Kind::Comma) {
Ok(None)
} else {
self.parse_binding_pattern_with_initializer().map(Some)
}
}
fn parse_rest_binding(&mut self) -> Result<BindingRestElement<'a>> {
// self.eat_decorators()?;
let elem = self.parse_rest_element()?;
if self.at(Kind::Comma) {
if matches!(self.peek_kind(), Kind::RCurly | Kind::RBrack) {
let span = self.cur_token().span();
self.bump_any();
self.error(diagnostics::binding_rest_element_trailing_comma(span));
}
if !self.ctx.has_ambient() {
self.error(diagnostics::binding_rest_element_last(elem.span));
}
}
Ok(elem)
}
/// Section 14.3.3 Binding Rest Property
pub(super) fn parse_rest_element(&mut self) -> Result<Box<'a, BindingRestElement<'a>>> {
pub(super) fn parse_rest_element(&mut self) -> Result<BindingRestElement<'a>> {
let span = self.start_span();
self.bump_any(); // advance `...`
let init_span = self.start_span();
@ -73,22 +112,12 @@ impl<'a> ParserImpl<'a> {
// The span is not extended to its type_annotation
let type_annotation = self.parse_ts_type_annotation()?;
let pattern = self.ast.binding_pattern(kind, type_annotation, false);
// Rest element does not allow `= initializer`, .
// Rest element does not allow `= initializer`
let argument = self
.context(Context::In, Context::empty(), |p| p.parse_initializer(init_span, pattern))?;
let span = self.end_span(span);
if self.at(Kind::Comma) {
if self.peek_at(Kind::RBrack) {
self.error(diagnostics::binding_rest_element_trailing_comma(
self.cur_token().span(),
));
} else if !self.ctx.has_ambient() {
self.error(diagnostics::binding_rest_element_last(span));
}
}
Ok(self.ast.rest_element(span, argument))
Ok(BindingRestElement { span, argument })
}
/// `BindingProperty`[Yield, Await] :

View file

@ -5,11 +5,10 @@ use oxc_ast::ast::*;
use oxc_diagnostics::Result;
use oxc_span::Span;
use super::{list::FormalParameterList, FunctionKind};
use super::FunctionKind;
use crate::{
diagnostics,
lexer::Kind,
list::SeparatedList,
modifiers::{ModifierFlags, ModifierKind, Modifiers},
Context, ParserImpl, StatementContext,
};
@ -49,13 +48,74 @@ impl<'a> ParserImpl<'a> {
params_kind: FormalParameterKind,
) -> Result<(Option<TSThisParameter<'a>>, Box<'a, FormalParameters<'a>>)> {
let span = self.start_span();
let list: FormalParameterList<'_> = FormalParameterList::parse(self)?;
let formal_parameters =
self.ast.formal_parameters(self.end_span(span), params_kind, list.elements, list.rest);
let this_param = list.this_param;
self.expect(Kind::LParen)?;
let this_param = if self.ts_enabled() && self.at(Kind::This) {
let param = self.parse_ts_this_parameter()?;
if !self.at(Kind::RParen) {
self.expect(Kind::Comma)?;
}
Some(param)
} else {
None
};
let (list, rest) = self.parse_delimited_list_with_rest(
Kind::RParen,
Self::parse_formal_parameter,
Self::parse_rest_parameter,
)?;
self.expect(Kind::RParen)?;
let formal_parameters = self.ast.formal_parameters(
self.end_span(span),
params_kind,
list,
rest.map(|r| self.ast.alloc(r)),
);
Ok((this_param, formal_parameters))
}
fn parse_parameter_modifiers(&mut self) -> Modifiers<'a> {
let modifiers = self.parse_class_element_modifiers(true);
self.verify_modifiers(
&modifiers,
ModifierFlags::ACCESSIBILITY
.union(ModifierFlags::READONLY)
.union(ModifierFlags::OVERRIDE),
diagnostics::cannot_appear_on_a_parameter,
);
modifiers
}
fn parse_formal_parameter(&mut self) -> Result<FormalParameter<'a>> {
let span = self.start_span();
self.eat_decorators()?;
let modifiers = self.parse_parameter_modifiers();
let pattern = self.parse_binding_pattern_with_initializer()?;
let decorators = self.consume_decorators();
Ok(self.ast.formal_parameter(
self.end_span(span),
pattern,
modifiers.accessibility(),
modifiers.contains_readonly(),
modifiers.contains_override(),
decorators,
))
}
fn parse_rest_parameter(&mut self) -> Result<BindingRestElement<'a>> {
let element = self.parse_rest_element()?;
if self.at(Kind::Comma) {
if matches!(self.peek_kind(), Kind::RCurly | Kind::RBrack) {
let span = self.cur_token().span();
self.bump_any();
self.error(diagnostics::binding_rest_element_trailing_comma(span));
}
if !self.ctx.has_ambient() {
self.error(diagnostics::rest_parameter_last(element.span));
}
}
Ok(element)
}
pub(crate) fn parse_function(
&mut self,
span: Span,

View file

@ -1,148 +0,0 @@
use oxc_allocator::Vec;
use oxc_ast::ast::*;
use oxc_diagnostics::Result;
use oxc_span::GetSpan;
use crate::{diagnostics, lexer::Kind, list::SeparatedList, modifiers::ModifierFlags, ParserImpl};
/// ObjectPattern.properties
pub struct ObjectPatternProperties<'a> {
pub elements: Vec<'a, BindingProperty<'a>>,
pub rest: Option<oxc_allocator::Box<'a, BindingRestElement<'a>>>,
}
impl<'a> SeparatedList<'a> for ObjectPatternProperties<'a> {
fn new(p: &ParserImpl<'a>) -> Self {
Self { elements: p.ast.new_vec(), rest: None }
}
fn open(&self) -> Kind {
Kind::LCurly
}
fn close(&self) -> Kind {
Kind::RCurly
}
fn parse_element(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
if p.cur_kind() == Kind::Dot3 {
let rest = p.parse_rest_element()?;
if !matches!(&rest.argument.kind, BindingPatternKind::BindingIdentifier(_)) {
p.error(diagnostics::invalid_binding_rest_element(rest.argument.span()));
}
if let Some(r) = self.rest.replace(rest) {
p.error(diagnostics::binding_rest_element_last(r.span));
}
} else {
let prop = p.parse_binding_property()?;
self.elements.push(prop);
}
Ok(())
}
}
/// ArrayPattern.elements
pub struct ArrayPatternList<'a> {
pub elements: Vec<'a, Option<BindingPattern<'a>>>,
pub rest: Option<oxc_allocator::Box<'a, BindingRestElement<'a>>>,
}
impl<'a> SeparatedList<'a> for ArrayPatternList<'a> {
fn new(p: &ParserImpl<'a>) -> Self {
Self { elements: p.ast.new_vec(), rest: None }
}
fn open(&self) -> Kind {
Kind::LBrack
}
fn close(&self) -> Kind {
Kind::RBrack
}
fn parse_element(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
match p.cur_kind() {
Kind::Comma => {
self.elements.push(None);
}
Kind::Dot3 => {
let rest = p.parse_rest_element()?;
if let Some(r) = self.rest.replace(rest) {
p.error(diagnostics::binding_rest_element_last(r.span));
}
}
_ => {
let element = p.parse_binding_pattern_with_initializer()?;
self.elements.push(Some(element));
}
}
Ok(())
}
}
/// Function Parameters
pub struct FormalParameterList<'a> {
pub elements: Vec<'a, FormalParameter<'a>>,
pub rest: Option<oxc_allocator::Box<'a, BindingRestElement<'a>>>,
pub this_param: Option<TSThisParameter<'a>>,
}
impl<'a> SeparatedList<'a> for FormalParameterList<'a> {
fn new(p: &ParserImpl<'a>) -> Self {
Self { elements: p.ast.new_vec(), rest: None, this_param: None }
}
fn open(&self) -> Kind {
Kind::LParen
}
fn close(&self) -> Kind {
Kind::RParen
}
// Section 15.1 Parameter Lists
fn parse_element(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
let span = p.start_span();
p.eat_decorators()?;
let modifiers = p.parse_class_element_modifiers(true);
let accessibility = modifiers.accessibility();
let readonly = modifiers.contains_readonly();
let r#override = modifiers.contains_override();
p.verify_modifiers(
&modifiers,
ModifierFlags::ACCESSIBILITY
.union(ModifierFlags::READONLY)
.union(ModifierFlags::OVERRIDE),
diagnostics::cannot_appear_on_a_parameter,
);
match p.cur_kind() {
Kind::This if p.ts_enabled() => {
let this_parameter = p.parse_ts_this_parameter()?;
self.this_param.replace(this_parameter);
}
Kind::Dot3 => {
let rest = p.parse_rest_element()?;
if let Some(r) = self.rest.replace(rest) {
p.error(diagnostics::rest_parameter_last(r.span));
}
}
_ => {
let pattern = p.parse_binding_pattern_with_initializer()?;
let decorators = p.consume_decorators();
let formal_parameter = p.ast.formal_parameter(
p.end_span(span),
pattern,
accessibility,
readonly,
r#override,
decorators,
);
self.elements.push(formal_parameter);
}
}
Ok(())
}
}

View file

@ -3,7 +3,6 @@
#![allow(clippy::missing_errors_doc)]
mod grammar;
pub mod list;
mod arrow;
mod binding;

View file

@ -63,7 +63,6 @@
mod context;
mod cursor;
mod list;
mod modifiers;
mod state;

View file

@ -1,49 +0,0 @@
use oxc_diagnostics::Result;
use crate::{lexer::Kind, ParserImpl};
pub trait SeparatedList<'a>: Sized {
fn new(p: &ParserImpl<'a>) -> Self;
fn parse(p: &mut ParserImpl<'a>) -> Result<Self> {
let mut list = Self::new(p);
list.parse_list(p)?;
Ok(list)
}
/// Open element, e.g.. `{` `[` `(`
fn open(&self) -> Kind;
/// Close element, e.g.. `}` `]` `)`
fn close(&self) -> Kind;
/// Separator element, e.g. `,`
fn separator(&self) -> Kind {
Kind::Comma
}
fn parse_element(&mut self, p: &mut ParserImpl<'a>) -> Result<()>;
/// Main entry point, parse the list
fn parse_list(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
p.expect(self.open())?;
let mut first = true;
while !p.at(self.close()) && !p.at(Kind::Eof) {
if first {
first = false;
} else {
p.expect(self.separator())?;
if p.at(self.close()) {
break;
}
}
self.parse_element(p)?;
}
p.expect(self.close())?;
Ok(())
}
}

View file

@ -439,12 +439,12 @@ impl<'a> ParserImpl<'a> {
pub(crate) fn parse_ts_this_parameter(&mut self) -> Result<TSThisParameter<'a>> {
let span = self.start_span();
self.parse_class_element_modifiers(true);
self.eat_decorators()?;
let this = {
let (span, name) = self.parse_identifier_kind(Kind::This);
IdentifierName { span, name }
};
let type_annotation = self.parse_ts_type_annotation()?;
Ok(self.ast.ts_this_parameter(self.end_span(span), this, type_annotation))
}

View file

@ -1439,7 +1439,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ─
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[core/uncategorised/396/input.js:1:12]
1 │ function t(...rest, b) { }
· ───────
@ -2289,7 +2289,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ─
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[core/uncategorised/555/input.js:3:5]
2 │ first,
3 │ ...second,
@ -2321,7 +2321,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ────
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[es2015/arrow-functions/comma-after-rest-param/input.js:1:2]
1 │ (...rest,) => {}
· ───────
@ -2383,7 +2383,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
╰────
help: Try insert a semicolon here
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[es2015/arrow-functions/invalid-rest-in-params/input.js:3:5]
2 │ first,
3 │ ...second,
@ -3984,7 +3984,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ─
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[es2015/uncategorised/277/input.js:1:15]
1 │ function f(a, ...b, c) { }
· ────
@ -4011,7 +4011,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ╰── `a` has already been declared here
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[es2015/uncategorised/283/input.js:1:2]
1 │ (...a, b) => {}
· ────
@ -5191,7 +5191,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
3 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[es2017/async-functions/params-invalid-rest-trailing-comma/input.js:1:8]
1 │ async (...a,) => {};
· ────
@ -5441,6 +5441,12 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ────
╰────
× Unexpected trailing comma after rest element
╭─[es2018/object-rest-spread/8/input.js:1:17]
1 │ let { x, y, ...z, } = obj;
· ─
╰────
× A rest element must be last in a destructuring pattern
╭─[es2018/object-rest-spread/8/input.js:1:13]
1 │ let { x, y, ...z, } = obj;
@ -6971,6 +6977,12 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ─
╰────
× A rest element must be last in a destructuring pattern
╭─[esprima/es2015-array-binding-pattern/invalid-elision-after-rest/input.js:1:5]
1 │ ([a,...b,])=>0;
· ────
╰────
× Identifier `a` has already been declared
╭─[esprima/es2015-array-pattern/dupe-param-1/input.js:2:13]
1 │ "use strict";
@ -7012,13 +7024,13 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
· ╰── `,` expected
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[esprima/es2015-arrow-function/arrow-with-multiple-rest/input.js:1:2]
1 │ (...a, ...b) => 0
· ────
╰────
× A rest parameter must be last in a parameter list
× A rest element must be last in a destructuring pattern
╭─[esprima/es2015-arrow-function/arrow-with-multiple-rest/input.js:1:2]
1 │ (...a, ...b) => 0
· ────
@ -9574,7 +9586,7 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
╰────
help: Try insert a semicolon here
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[esprima/invalid-syntax/migrated_0258/input.js:1:15]
1 │ function f(a, ...b, c){}
· ────

View file

@ -2126,7 +2126,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
131 │ };
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/arrow-function/rest-params-trailing-comma-early-error.js:54:5]
53 │
54 │ 0, (...a,) => {
@ -5392,7 +5392,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
123 │ });
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js:46:9]
45 │
46 │ (async (...a,) => {
@ -5651,7 +5651,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
109 │ });
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/async-function/named-rest-params-trailing-comma-early-error.js:33:19]
32 │
33 │ (async function f(...a,) {
@ -5701,7 +5701,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
109 │ });
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js:33:17]
32 │
33 │ (async function(...a,) {
@ -6275,7 +6275,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
112 │ };
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/async-generator/named-rest-params-trailing-comma-early-error.js:36:22]
35 │
36 │ 0, async function* g(...a,) {
@ -6405,7 +6405,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
112 │ };
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/async-generator/rest-params-trailing-comma-early-error.js:36:20]
35 │
36 │ 0, async function*(...a,) {
@ -6656,7 +6656,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
136 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/async-gen-method/rest-params-trailing-comma-early-error.js:60:17]
59 │ 0, class {
60 │ async *method(...a,) {
@ -6876,7 +6876,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
136 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/async-gen-method-static/rest-params-trailing-comma-early-error.js:60:24]
59 │ 0, class {
60 │ static async *method(...a,) {
@ -7096,7 +7096,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
134 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/async-method/rest-params-trailing-comma-early-error.js:57:23]
56 │ var C = class {
57 │ static async method(...a,) {
@ -7210,7 +7210,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
134 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/async-method-static/rest-params-trailing-comma-early-error.js:57:23]
56 │ var C = class {
57 │ static async method(...a,) {
@ -12223,7 +12223,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
157 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/gen-method/rest-params-trailing-comma-early-error.js:81:11]
80 │ 0, class {
81 │ *method(...a,) {
@ -12388,7 +12388,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
157 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/gen-method-static/rest-params-trailing-comma-early-error.js:81:18]
80 │ 0, class {
81 │ static *method(...a,) {
@ -12551,7 +12551,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
153 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/method/rest-params-trailing-comma-early-error.js:76:10]
75 │ 0, class {
76 │ method(...a,) {
@ -12609,7 +12609,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
153 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/class/method-static/rest-params-trailing-comma-early-error.js:76:17]
75 │ 0, class {
76 │ static method(...a,) {
@ -14122,7 +14122,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
132 │ };
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/function/rest-params-trailing-comma-early-error.js:55:13]
54 │
55 │ 0, function(...a,) {
@ -14390,7 +14390,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
133 │ };
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/generators/rest-params-trailing-comma-early-error.js:57:14]
56 │
57 │ 0, function*(...a,) {
@ -15439,7 +15439,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
117 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/object/method-definition/async-gen-meth-rest-params-trailing-comma-early-error.js:41:17]
40 │ 0, {
41 │ async *method(...a,) {
@ -15603,7 +15603,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
110 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/object/method-definition/async-meth-rest-params-trailing-comma-early-error.js:34:17]
33 │ ({
34 │ async *method(...a,) {
@ -15811,7 +15811,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
139 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/object/method-definition/gen-meth-rest-params-trailing-comma-early-error.js:63:11]
62 │ 0, {
63 │ *method(...a,) {
@ -16032,7 +16032,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
135 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/expressions/object/method-definition/meth-rest-params-trailing-comma-early-error.js:58:10]
57 │ 0, {
58 │ method(...a,) {
@ -20955,7 +20955,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
╰────
help: Try insert a semicolon here
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/rest-parameters/position-invalid.js:13:15]
12 │ $DONOTEVALUATE();
13 │ function f(a, ...b, c) {}
@ -21189,7 +21189,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
109 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/async-function/rest-params-trailing-comma-early-error.js:33:18]
32 │
33 │ async function f(...a,) {
@ -21406,7 +21406,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
112 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/async-generator/rest-params-trailing-comma-early-error.js:36:19]
35 │
36 │ async function* f(...a,) {
@ -21859,7 +21859,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
135 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js:59:17]
58 │ class C {
59 │ async *method(...a,) {
@ -22079,7 +22079,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
136 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/async-gen-method-static/rest-params-trailing-comma-early-error.js:60:24]
59 │ class C {
60 │ static async *method(...a,) {
@ -22307,7 +22307,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
134 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/async-method/rest-params-trailing-comma-early-error.js:57:16]
56 │ class C {
57 │ async method(...a,) {
@ -22421,7 +22421,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
133 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/async-method-static/rest-params-trailing-comma-early-error.js:56:23]
55 │ class C {
56 │ static async method(...a,) {
@ -27645,7 +27645,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
155 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/gen-method/rest-params-trailing-comma-early-error.js:79:11]
78 │ class C {
79 │ *method(...a,) {
@ -27810,7 +27810,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
155 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/gen-method-static/rest-params-trailing-comma-early-error.js:79:18]
78 │ class C {
79 │ static *method(...a,) {
@ -27973,7 +27973,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
152 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/method/rest-params-trailing-comma-early-error.js:75:10]
74 │ class C {
75 │ method(...a,) {
@ -28031,7 +28031,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
152 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/class/method-static/rest-params-trailing-comma-early-error.js:75:17]
74 │ class C {
75 │ static method(...a,) {
@ -31637,7 +31637,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
133 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/function/rest-params-trailing-comma-early-error.js:56:12]
55 │
56 │ function f(...a,) {
@ -31807,7 +31807,7 @@ Expect Syntax Error: "language/import/import-attributes/json-named-bindings.js"
133 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[language/statements/generators/rest-params-trailing-comma-early-error.js:57:13]
56 │
57 │ function* f(...a,) {

View file

@ -1,9 +1,9 @@
commit: d8086f14
parser_typescript Summary:
AST Parsed : 5280/5283 (99.94%)
Positive Passed: 5273/5283 (99.81%)
Negative Passed: 1077/4875 (22.09%)
AST Parsed : 5279/5283 (99.92%)
Positive Passed: 5272/5283 (99.79%)
Negative Passed: 1082/4875 (22.19%)
Expect Syntax Error: "compiler/ClassDeclaration10.ts"
Expect Syntax Error: "compiler/ClassDeclaration11.ts"
Expect Syntax Error: "compiler/ClassDeclaration13.ts"
@ -1510,7 +1510,6 @@ Expect Syntax Error: "compiler/reservedNameOnModuleImportWithInterface.ts"
Expect Syntax Error: "compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts"
Expect Syntax Error: "compiler/restArgAssignmentCompat.ts"
Expect Syntax Error: "compiler/restInvalidArgumentType.ts"
Expect Syntax Error: "compiler/restParamModifier2.ts"
Expect Syntax Error: "compiler/restParamsWithNonRestParams.ts"
Expect Syntax Error: "compiler/restUnion3.ts"
Expect Syntax Error: "compiler/returnInConstructor1.ts"
@ -1899,7 +1898,6 @@ Expect Syntax Error: "compiler/useBeforeDeclaration_propertyAssignment.ts"
Expect Syntax Error: "compiler/useBeforeDeclaration_superClass.ts"
Expect Syntax Error: "compiler/useUnknownInCatchVariables01.ts"
Expect Syntax Error: "compiler/varAndFunctionShareName.ts"
Expect Syntax Error: "compiler/varArgConstructorMemberParameter.ts"
Expect Syntax Error: "compiler/varBlock.ts"
Expect Syntax Error: "compiler/varNameConflictsWithImportInDifferentPartOfModule.ts"
Expect Syntax Error: "compiler/vararg.ts"
@ -2188,7 +2186,6 @@ Expect Syntax Error: "conformance/decorators/class/method/decoratorOnClassMethod
Expect Syntax Error: "conformance/decorators/class/method/decoratorOnClassMethod6.ts"
Expect Syntax Error: "conformance/decorators/class/method/decoratorOnClassMethod8.ts"
Expect Syntax Error: "conformance/decorators/class/method/decoratorOnClassMethodOverload1.ts"
Expect Syntax Error: "conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts"
Expect Syntax Error: "conformance/decorators/class/property/decoratorOnClassProperty11.ts"
Expect Syntax Error: "conformance/decorators/class/property/decoratorOnClassProperty6.ts"
Expect Syntax Error: "conformance/decorators/class/property/decoratorOnClassProperty7.ts"
@ -2196,7 +2193,6 @@ Expect Syntax Error: "conformance/decorators/decoratorCallGeneric.ts"
Expect Syntax Error: "conformance/decorators/invalid/decoratorOnEnum.ts"
Expect Syntax Error: "conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts"
Expect Syntax Error: "conformance/decorators/invalid/decoratorOnFunctionExpression.ts"
Expect Syntax Error: "conformance/decorators/invalid/decoratorOnFunctionParameter.ts"
Expect Syntax Error: "conformance/decorators/invalid/decoratorOnImportEquals1.ts"
Expect Syntax Error: "conformance/decorators/invalid/decoratorOnInterface.ts"
Expect Syntax Error: "conformance/decorators/invalid/decoratorOnInternalModule.ts"
@ -3175,7 +3171,6 @@ Expect Syntax Error: "conformance/parser/ecmascript5/Protected/Protected7.ts"
Expect Syntax Error: "conformance/parser/ecmascript5/RealWorld/parserindenter.ts"
Expect Syntax Error: "conformance/parser/ecmascript5/RegressionTests/parser509534.ts"
Expect Syntax Error: "conformance/parser/ecmascript5/RegressionTests/parser509618.ts"
Expect Syntax Error: "conformance/parser/ecmascript5/RegressionTests/parser509668.ts"
Expect Syntax Error: "conformance/parser/ecmascript5/RegressionTests/parser509693.ts"
Expect Syntax Error: "conformance/parser/ecmascript5/RegressionTests/parser509698.ts"
Expect Syntax Error: "conformance/parser/ecmascript5/RegressionTests/parser536727.ts"
@ -3818,6 +3813,15 @@ Expect to Parse: "compiler/elidedEmbeddedStatementsReplacedWithSemicolon.ts"
· ────
24 │ const enum H {}
╰────
Expect to Parse: "compiler/sourceMapValidationDecorators.ts"
× Unexpected token
╭─[compiler/sourceMapValidationDecorators.ts:18:7]
17 │ @ParameterDecorator2(30)
18 │ ...b: string[]) {
· ───
19 │ }
╰────
Expect to Parse: "compiler/withStatementInternalComments.ts"
× 'with' statements are not allowed
@ -8995,7 +8999,15 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
3 │ }
╰────
× A rest element must be last in a destructuring pattern
× Unexpected token
╭─[compiler/restParamModifier2.ts:2:24]
1 │ class C {
2 │ constructor(public ...rest: string[]) {}
· ───
3 │ }
╰────
× A rest parameter must be last in a parameter list
╭─[compiler/restParameterNotLast.ts:1:12]
1 │ function f(...x, y) { }
· ────
@ -10530,6 +10542,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
help: Try insert a semicolon here
× Unexpected token
╭─[compiler/varArgConstructorMemberParameter.ts:10:25]
9 │ class Foo3 {
10 │ constructor (public ...args: string[]) { }
· ───
11 │ }
╰────
× Unexpected token
╭─[compiler/varArgWithNoParamName.ts:1:16]
1 │ function t1(...) {}
@ -12553,6 +12573,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
6 │ }
╰────
× Unexpected token
╭─[conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts:4:17]
3 │ class C {
4 │ method(@dec this: C) {}
· ────
5 │ }
╰────
× Expected a semicolon or an implicit semicolon after a statement, but found none
╭─[conformance/decorators/class/property/decoratorOnClassProperty3.ts:4:11]
3 │ class C {
@ -12586,6 +12614,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
5 │ }
╰────
× Unexpected token
╭─[conformance/decorators/invalid/decoratorOnFunctionParameter.ts:5:22]
4 │
5 │ function direct(@dec this: C) { return this.n; }
· ────
6 │ function called(@dec() this: C) { return this.n; }
╰────
× Unexpected token
╭─[conformance/dynamicImport/importCallExpressionGrammarError.ts:5:8]
4 │ var a = ["./0"];
@ -13004,12 +13040,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
15 │ function a4(...b = [1,2,3]) { } // Error, can't have initializer
╰────
× A rest parameter cannot have an initializer
╭─[conformance/es6/destructuring/destructuringParameterDeclaration4.ts:15:16]
14 │ function a3(...b?) { } // Error, can't be optional
15 │ function a4(...b = [1,2,3]) { } // Error, can't have initializer
· ───────────
16 │ function a5([a, b, [[c]]]) { }
× Unexpected token
╭─[conformance/es6/destructuring/destructuringParameterDeclaration4.ts:29:24]
28 │ class C {
29 │ constructor(public ...temp) { } // Error, rest parameter can't have properties
· ───
30 │ }
╰────
× Expected `:` but found `}`
@ -15528,6 +15564,21 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
2 │ const {...b,} = {};
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/es7/trailingCommasInBindingPatterns.ts:1:8]
1 │ const [...a,] = [];
· ────
2 │ const {...b,} = {};
╰────
× Unexpected trailing comma after rest element
╭─[conformance/es7/trailingCommasInBindingPatterns.ts:2:12]
1 │ const [...a,] = [];
2 │ const {...b,} = {};
· ─
3 │ let c, d;
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/es7/trailingCommasInBindingPatterns.ts:2:8]
1 │ const [...a,] = [];
@ -15544,7 +15595,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
5 │ ({...d,} = {});
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[conformance/es7/trailingCommasInFunctionParametersAndArguments.ts:5:13]
4 │
5 │ function f2(...args,) {}
@ -16214,7 +16265,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
12 │ }
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[conformance/functions/functionOverloadErrorsSyntax.ts:9:25]
8 │ //Function overload signature with rest param followed by non-optional parameter
9 │ function fn5(x: string, ...y: any[], z: string);
@ -17888,7 +17939,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
4 │ };
╰────
× A rest element must be last in a destructuring pattern
× A rest parameter must be last in a parameter list
╭─[conformance/parser/ecmascript5/ParameterLists/parserParameterList1.ts:2:6]
1 │ class C {
2 │ F(...A, B) { }
@ -17995,6 +18046,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
5 │
╰────
× Unexpected token
╭─[conformance/parser/ecmascript5/RegressionTests/parser509668.ts:3:23]
2 │ // Doesn't work, but should
3 │ constructor (public ...args: string[]) { }
· ───
4 │ }
╰────
× Empty parenthesized expression
╭─[conformance/parser/ecmascript5/RegressionTests/parser509669.ts:2:9]
1 │ function foo():any {
@ -20586,14 +20645,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
36 │ }
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:5:11]
4 │ var f = function foo(...x) { }
5 │ var f2 = (...x, ...y) => { }
· ────
6 │
╰────
× A rest parameter must be last in a parameter list
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:5:11]
4 │ var f = function foo(...x) { }
@ -20603,12 +20654,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:13:9]
12 │ (...x);
13 │ foo(...x, ...y);
· ────
14 │ }
╰────
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:5:11]
4 │ var f = function foo(...x) { }
5 │ var f2 = (...x, ...y) => { }
· ────
6 │
╰────
× A rest parameter must be last in a parameter list
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:13:9]
@ -20619,11 +20670,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:23:21]
22 │ foo(...x) { },
23 │ a: function foo(...x, ...y) { },
· ────
24 │ b: (...x) => { }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:13:9]
12 │ (...x);
13 │ foo(...x, ...y);
· ────
14 │ }
╰────
× A rest parameter must be last in a parameter list
@ -20635,12 +20686,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:5:11]
4 │ var f = function foo(...x: number) { }
5 │ var f2 = (...x: Date, ...y: boolean) => { }
· ──────────
6 │
╰────
╭─[conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts:23:21]
22 │ foo(...x) { },
23 │ a: function foo(...x, ...y) { },
· ────
24 │ b: (...x) => { }
╰────
× A rest parameter must be last in a parameter list
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:5:11]
@ -20651,12 +20702,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:13:9]
12 │ (...x: string);
13 │ foo(...x: number, ...y: number);
· ────────────
14 │ }
╰────
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:5:11]
4 │ var f = function foo(...x: number) { }
5 │ var f2 = (...x: Date, ...y: boolean) => { }
· ──────────
6 │
╰────
× A rest parameter must be last in a parameter list
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:13:9]
@ -20667,11 +20718,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:23:21]
22 │ foo(...x: string) { },
23 │ a: function foo(...x: number, ...y: Date) { },
· ────────────
24 │ b: (...x: string) => { }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:13:9]
12 │ (...x: string);
13 │ foo(...x: number, ...y: number);
· ────────────
14 │ }
╰────
× A rest parameter must be last in a parameter list
@ -20683,11 +20734,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:9:11]
8 │ var f = function foo(...x: MyThing) { }
9 │ var f2 = (...x: MyThing, ...y: MyThing) => { }
· ────────────
10 │
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts:23:21]
22 │ foo(...x: string) { },
23 │ a: function foo(...x: number, ...y: Date) { },
· ────────────
24 │ b: (...x: string) => { }
╰────
× A rest parameter must be last in a parameter list
@ -20699,11 +20750,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:17:9]
16 │ (...x: MyThing);
17 │ foo(...x: MyThing, ...y: MyThing);
· ─────────────
18 │ }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:9:11]
8 │ var f = function foo(...x: MyThing) { }
9 │ var f2 = (...x: MyThing, ...y: MyThing) => { }
· ─────────────
10 │
╰────
× A rest parameter must be last in a parameter list
@ -20715,11 +20766,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:27:21]
26 │ foo(...x: MyThing) { },
27 │ a: function foo(...x: MyThing, ...y: MyThing) { },
· ─────────────
28 │ b: (...x: MyThing) => { }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:17:9]
16 │ (...x: MyThing);
17 │ foo(...x: MyThing, ...y: MyThing);
· ─────────────
18 │ }
╰────
× A rest parameter must be last in a parameter list
@ -20731,11 +20782,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:36:11]
35 │ var f3 = function foo(...x: MyThing2<string>) { }
36 │ var f4 = (...x: MyThing2<string>, ...y: MyThing2<string>) => { }
· ──────────────────────
37 │
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:27:21]
26 │ foo(...x: MyThing) { },
27 │ a: function foo(...x: MyThing, ...y: MyThing) { },
· ─────────────
28 │ b: (...x: MyThing) => { }
╰────
× A rest parameter must be last in a parameter list
@ -20747,11 +20798,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:44:9]
43 │ (...x: MyThing2<string>);
44 │ foo(...x: MyThing2<string>, ...y: MyThing2<string>);
· ──────────────────────
45 │ }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:36:11]
35 │ var f3 = function foo(...x: MyThing2<string>) { }
36 │ var f4 = (...x: MyThing2<string>, ...y: MyThing2<string>) => { }
· ──────────────────────
37 │
╰────
× A rest parameter must be last in a parameter list
@ -20763,11 +20814,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:54:21]
53 │ foo(...x: MyThing2<string>) { },
54 │ a: function foo(...x: MyThing2<string>, ...y: MyThing2<string>) { },
· ──────────────────────
55 │ b: (...x: MyThing2<string>) => { }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:44:9]
43 │ (...x: MyThing2<string>);
44 │ foo(...x: MyThing2<string>, ...y: MyThing2<string>);
· ──────────────────────
45 │ }
╰────
× A rest parameter must be last in a parameter list
@ -20779,12 +20830,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:5:11]
4 │ var f = function foo(...x: number[]) { }
5 │ var f2 = (...x: number[], ...y: number[]) => { }
· ──────────────
6 │
╰────
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts:54:21]
53 │ foo(...x: MyThing2<string>) { },
54 │ a: function foo(...x: MyThing2<string>, ...y: MyThing2<string>) { },
· ──────────────────────
55 │ b: (...x: MyThing2<string>) => { }
╰────
× A rest parameter must be last in a parameter list
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:5:11]
@ -20795,12 +20846,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:13:9]
12 │ (...x: number[]);
13 │ foo(...x: number[], ...y: number[]);
· ──────────────
14 │ }
╰────
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:5:11]
4 │ var f = function foo(...x: number[]) { }
5 │ var f2 = (...x: number[], ...y: number[]) => { }
· ──────────────
6 │
╰────
× A rest parameter must be last in a parameter list
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:13:9]
@ -20811,11 +20862,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:23:21]
22 │ foo(...x: number[]) { },
23 │ a: function foo(...x: number[], ...y: number[]) { },
· ──────────────
24 │ b: (...x: number[]) => { }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:13:9]
12 │ (...x: number[]);
13 │ foo(...x: number[], ...y: number[]);
· ──────────────
14 │ }
╰────
× A rest parameter must be last in a parameter list
@ -20827,11 +20878,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:32:11]
31 │ var f3 = function foo(...x: Array<string>) { }
32 │ var f4 = (...x: Array<string>, ...y: Array<string>) => { }
· ───────────────────
33 │
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:23:21]
22 │ foo(...x: number[]) { },
23 │ a: function foo(...x: number[], ...y: number[]) { },
· ──────────────
24 │ b: (...x: number[]) => { }
╰────
× A rest parameter must be last in a parameter list
@ -20843,11 +20894,11 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:40:9]
39 │ (...x: Array<string>);
40 │ foo(...x: Array<string>, ...y: Array<string>);
· ───────────────────
41 │ }
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:32:11]
31 │ var f3 = function foo(...x: Array<string>) { }
32 │ var f4 = (...x: Array<string>, ...y: Array<string>) => { }
· ───────────────────
33 │
╰────
× A rest parameter must be last in a parameter list
@ -20859,6 +20910,14 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰────
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:40:9]
39 │ (...x: Array<string>);
40 │ foo(...x: Array<string>, ...y: Array<string>);
· ───────────────────
41 │ }
╰────
× A rest parameter must be last in a parameter list
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:50:21]
49 │ foo(...x: Array<string>) { },
50 │ a: function foo(...x: Array<string>, ...y: Array<string>) { },
@ -20866,7 +20925,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
51 │ b: (...x: Array<string>) => { }
╰────
× A rest parameter must be last in a parameter list
× A rest element must be last in a destructuring pattern
╭─[conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts:50:21]
49 │ foo(...x: Array<string>) { },
50 │ a: function foo(...x: Array<string>, ...y: Array<string>) { },
@ -21020,13 +21079,12 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
165 │ function notFirst(a: number, this: C): number { return this.n; }
╰────
× Expected `,` but found `this`
╭─[conformance/types/thisType/thisTypeInFunctionsNegative.ts:168:26]
167 │ ///// parse errors /////
168 │ function modifiers(async this: C): number { return this.n; }
· ──┬─
· ╰── `,` expected
169 │ function restParam(...this: C): number { return this.n; }
× Unexpected token
╭─[conformance/types/thisType/thisTypeInFunctionsNegative.ts:165:30]
164 │ var thisConstructorType: new (this: number) => number;
165 │ function notFirst(a: number, this: C): number { return this.n; }
· ────
166 │
╰────
× Expected a semicolon or an implicit semicolon after a statement, but found none

View file

@ -2,7 +2,7 @@ commit: d8086f14
prettier_typescript Summary:
AST Parsed : 5283/5283 (100.00%)
Positive Passed: 2447/5283 (46.32%)
Positive Passed: 2448/5283 (46.34%)
Expect to Parse: "compiler/DeclarationErrorsNoEmitOnError.ts"
Expect to Parse: "compiler/abstractInterfaceIdentifierName.ts"
Expect to Parse: "compiler/abstractPropertyBasics.ts"
@ -1408,7 +1408,6 @@ Expect to Parse: "compiler/sourceMap-FileWithComments.ts"
Expect to Parse: "compiler/sourceMap-StringLiteralWithNewLine.ts"
Expect to Parse: "compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts"
Expect to Parse: "compiler/sourceMapValidationClasses.ts"
Expect to Parse: "compiler/sourceMapValidationDecorators.ts"
Expect to Parse: "compiler/sourceMapValidationDestructuringForArrayBindingPattern.ts"
Expect to Parse: "compiler/sourceMapValidationDestructuringForArrayBindingPattern2.ts"
Expect to Parse: "compiler/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts"