diff --git a/crates/oxc_linter/src/snapshots/no_shadow_restricted_names.snap b/crates/oxc_linter/src/snapshots/no_shadow_restricted_names.snap index b3ce83380..b439bc835 100644 --- a/crates/oxc_linter/src/snapshots/no_shadow_restricted_names.snap +++ b/crates/oxc_linter/src/snapshots/no_shadow_restricted_names.snap @@ -285,7 +285,7 @@ expression: no_shadow_restricted_names ⚠ eslint(no-shadow-restricted-names): Shadowing of global properties such as 'undefined' is not allowed. ╭─[no_shadow_restricted_names.tsx:1:14] 1 │ try {} catch(undefined: undefined) {} - · ───────── + · ──────────────────── ╰──── help: Shadowing of global properties 'undefined'. diff --git a/crates/oxc_linter/src/snapshots/no_this_alias.snap b/crates/oxc_linter/src/snapshots/no_this_alias.snap index 6ecd1cf41..3d093d52c 100644 --- a/crates/oxc_linter/src/snapshots/no_this_alias.snap +++ b/crates/oxc_linter/src/snapshots/no_this_alias.snap @@ -69,7 +69,7 @@ expression: no_this_alias ╭─[no_this_alias.tsx:4:21] 3 │ const inConstructor = this; 4 │ const asThis: this = this; - · ────── + · ──────────── 5 │ ╰──── help: Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not managing scope well. diff --git a/crates/oxc_parser/src/js/binding.rs b/crates/oxc_parser/src/js/binding.rs index 74c70904c..da72f7d09 100644 --- a/crates/oxc_parser/src/js/binding.rs +++ b/crates/oxc_parser/src/js/binding.rs @@ -7,30 +7,40 @@ use super::list::{ArrayPatternList, ObjectPatternProperties}; use crate::{diagnostics, lexer::Kind, list::SeparatedList, Context, ParserImpl}; impl<'a> ParserImpl<'a> { - /// Destructuring Binding Patterns - /// `LexicalBinding` - /// `BindingIdentifier` `Initializer_opt` - /// `BindingPattern` Initializer - /// `BindingPattern`: - /// `ObjectBindingPattern` - /// `ArrayBindingPattern` - pub(crate) fn parse_binding(&mut self) -> Result<(BindingPattern<'a>, bool)> { - let kind = match self.cur_kind() { + /// `BindingElement` + /// `SingleNameBinding` + /// `BindingPattern`[?Yield, ?Await] `Initializer`[+In, ?Yield, ?Await]opt + pub(super) fn parse_binding_pattern_with_initializer(&mut self) -> Result> { + let span = self.start_span(); + let pattern = self.parse_binding_pattern(true)?; + self.with_context(Context::In, |p| p.parse_initializer(span, pattern)) + } + + pub(super) fn parse_binding_pattern( + &mut self, + allow_question: bool, + ) -> Result> { + let mut kind = self.parse_binding_pattern_kind()?; + let optional = + if allow_question && self.ts_enabled() { self.eat(Kind::Question) } else { false }; + let type_annotation = self.parse_ts_type_annotation()?; + if let Some(type_annotation) = &type_annotation { + Self::extend_binding_pattern_span_end(type_annotation.span, &mut kind); + } + Ok(self.ast.binding_pattern(kind, type_annotation, optional)) + } + + pub(super) fn parse_binding_pattern_kind(&mut self) -> Result> { + match self.cur_kind() { Kind::LCurly => self.parse_object_binding_pattern(), Kind::LBrack => self.parse_array_binding_pattern(), _ => self.parse_binding_pattern_identifier(), - }?; - if self.ts_enabled() { - let optional = self.eat(Kind::Question); - let (type_annotation, definite) = self.parse_ts_variable_annotation()?; - Ok((self.ast.binding_pattern(kind, type_annotation, optional), definite)) - } else { - Ok((self.ast.binding_pattern(kind, None, false), false)) } } fn parse_binding_pattern_identifier(&mut self) -> Result> { - self.parse_binding_identifier().map(|ident| self.ast.binding_pattern_identifier(ident)) + let ident = self.parse_binding_identifier()?; + Ok(self.ast.binding_pattern_identifier(ident)) } /// Section 14.3.3 Object Binding Pattern @@ -48,10 +58,10 @@ impl<'a> ParserImpl<'a> { } /// Section 14.3.3 Binding Rest Property - pub(crate) fn parse_rest_element(&mut self) -> Result>> { + pub(super) fn parse_rest_element(&mut self) -> Result>> { let span = self.start_span(); self.bump_any(); // advance `...` - let argument = self.parse_binding_pattern()?; + let argument = self.parse_binding_pattern_with_initializer()?; let span = self.end_span(span); if self.at(Kind::Comma) { @@ -65,19 +75,10 @@ impl<'a> ParserImpl<'a> { Ok(self.ast.rest_element(span, argument)) } - /// `BindingElement` - /// `SingleNameBinding` - /// `BindingPattern`[?Yield, ?Await] `Initializer`[+In, ?Yield, ?Await]opt - pub(crate) fn parse_binding_pattern(&mut self) -> Result> { - let span = self.start_span(); - let pattern = self.parse_binding()?.0; - self.with_context(Context::In, |p| p.parse_initializer(span, pattern)) - } - /// `BindingProperty`[Yield, Await] : /// `SingleNameBinding`[?Yield, ?Await] /// `PropertyName`[?Yield, ?Await] : `BindingElement`[?Yield, ?Await] - pub(crate) fn parse_binding_property(&mut self) -> Result> { + pub(super) fn parse_binding_property(&mut self) -> Result> { let span = self.start_span(); let mut shorthand = false; @@ -101,7 +102,7 @@ impl<'a> ParserImpl<'a> { // let { a: b } = c // ^ IdentifierReference self.expect(Kind::Colon)?; - self.parse_binding_pattern()? + self.parse_binding_pattern_with_initializer()? }; Ok(self.ast.binding_property(self.end_span(span), key, value, shorthand, computed)) @@ -121,4 +122,14 @@ impl<'a> ParserImpl<'a> { Ok(left) } } + + pub(super) fn extend_binding_pattern_span_end(span: Span, kind: &mut BindingPatternKind<'a>) { + let pat_span = match kind { + BindingPatternKind::BindingIdentifier(pat) => &mut pat.span, + BindingPatternKind::ObjectPattern(pat) => &mut pat.span, + BindingPatternKind::ArrayPattern(pat) => &mut pat.span, + BindingPatternKind::AssignmentPattern(pat) => &mut pat.span, + }; + pat_span.end = span.end; + } } diff --git a/crates/oxc_parser/src/js/declaration.rs b/crates/oxc_parser/src/js/declaration.rs index 956169fe6..ccf0ecc12 100644 --- a/crates/oxc_parser/src/js/declaration.rs +++ b/crates/oxc_parser/src/js/declaration.rs @@ -94,7 +94,28 @@ impl<'a> ParserImpl<'a> { ) -> Result> { let span = self.start_span(); - let (id, definite) = self.parse_binding()?; + let mut binding_kind = self.parse_binding_pattern_kind()?; + + let (id, definite) = if self.ts_enabled() { + // const x!: number = 1 + // ^ definite + let mut definite = false; + if binding_kind.is_binding_identifier() + && self.at(Kind::Bang) + && !self.cur_token().is_on_new_line + { + self.eat(Kind::Bang); + definite = true; + } + let optional = self.eat(Kind::Question); // not allowed, but checked in checker/typescript.rs + let type_annotation = self.parse_ts_type_annotation()?; + if let Some(type_annotation) = &type_annotation { + Self::extend_binding_pattern_span_end(type_annotation.span, &mut binding_kind); + } + (self.ast.binding_pattern(binding_kind, type_annotation, optional), definite) + } else { + (self.ast.binding_pattern(binding_kind, None, false), false) + }; let init = self.eat(Kind::Eq).then(|| self.parse_assignment_expression_base()).transpose()?; diff --git a/crates/oxc_parser/src/js/list.rs b/crates/oxc_parser/src/js/list.rs index b5059d87b..613f6c1ec 100644 --- a/crates/oxc_parser/src/js/list.rs +++ b/crates/oxc_parser/src/js/list.rs @@ -160,7 +160,7 @@ impl<'a> SeparatedList<'a> for ArrayPatternList<'a> { } } _ => { - let element = p.parse_binding_pattern()?; + let element = p.parse_binding_pattern_with_initializer()?; self.elements.push(Some(element)); } } @@ -272,7 +272,7 @@ impl<'a> SeparatedList<'a> for FormalParameterList<'a> { } } _ => { - let pattern = p.parse_binding_pattern()?; + let pattern = p.parse_binding_pattern_with_initializer()?; let decorators = p.state.consume_decorators(); let formal_parameter = p.ast.formal_parameter( p.end_span(span), diff --git a/crates/oxc_parser/src/js/statement.rs b/crates/oxc_parser/src/js/statement.rs index dd6745ed1..27b9f459e 100644 --- a/crates/oxc_parser/src/js/statement.rs +++ b/crates/oxc_parser/src/js/statement.rs @@ -531,7 +531,7 @@ impl<'a> ParserImpl<'a> { let span = self.start_span(); self.bump_any(); // advance `catch` let param = if self.eat(Kind::LParen) { - let pattern = self.parse_binding()?.0; + let pattern = self.parse_binding_pattern(false)?; self.expect(Kind::RParen)?; Some(pattern) } else { diff --git a/crates/oxc_parser/src/ts/statement.rs b/crates/oxc_parser/src/ts/statement.rs index 04bd3c930..ca2ee7bc9 100644 --- a/crates/oxc_parser/src/ts/statement.rs +++ b/crates/oxc_parser/src/ts/statement.rs @@ -66,36 +66,16 @@ impl<'a> ParserImpl<'a> { pub(crate) fn parse_ts_type_annotation( &mut self, ) -> Result>>> { - if self.at(Kind::Colon) { - let span = self.start_span(); - self.bump_any(); // bump ':' - let type_annotation = self.parse_ts_type()?; - Ok(Some(self.ast.ts_type_annotation(self.end_span(span), type_annotation))) - } else { - Ok(None) + if !self.ts_enabled() { + return Ok(None); } - } - - pub(crate) fn parse_ts_variable_annotation( - &mut self, - ) -> Result<(Option>>, bool)> { - if !self.at(Kind::Bang) { - return Ok((self.parse_ts_type_annotation()?, false)); + if !self.at(Kind::Colon) { + return Ok(None); } - - if self.cur_token().is_on_new_line { - return Ok((None, false)); - } - let span = self.start_span(); - self.bump(Kind::Bang); - - if self.eat(Kind::Colon) { - let type_annotation = self.parse_ts_type()?; - Ok((Some(self.ast.ts_type_annotation(self.end_span(span), type_annotation)), true)) - } else { - Err(self.unexpected()) - } + self.bump_any(); // bump ':' + let type_annotation = self.parse_ts_type()?; + Ok(Some(self.ast.ts_type_annotation(self.end_span(span), type_annotation))) } pub(crate) fn parse_ts_type_alias_declaration( diff --git a/tasks/coverage/parser_babel.snap b/tasks/coverage/parser_babel.snap index 611c1cbbf..1657d2db0 100644 --- a/tasks/coverage/parser_babel.snap +++ b/tasks/coverage/parser_babel.snap @@ -9951,20 +9951,20 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts" × Missing initializer in const declaration ╭─[typescript/const/no-initializer/input.ts:1:7] 1 │ const x: number; - · ─ + · ───────── ╰──── × Missing initializer in const declaration ╭─[typescript/const/reserved-word/input.ts:1:7] 1 │ const b: const; - · ─ + · ──────── ╰──── × Missing initializer in destructuring declaration ╭─[typescript/declare/destructure-new-line/input.ts:2:7] 1 │ declare 2 │ const { x, y }: { x: number, y: number }; - · ──────── + · ────────────────────────────────── ╰──── × Unexpected exponentiation expression @@ -10621,8 +10621,15 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts" 1 │ type F = ({ ╰──── - × Unexpected token - ╭─[typescript/variable-declarator/definite-assignment-not-allowed/input.ts:1:9] + × Missing initializer in destructuring declaration + ╭─[typescript/variable-declarator/definite-assignment-not-allowed/input.ts:1:5] 1 │ let {}! = {}; - · ─ + · ── ╰──── + + × Expected a semicolon or an implicit semicolon after a statement, but found none + ╭─[typescript/variable-declarator/definite-assignment-not-allowed/input.ts:1:7] + 1 │ let {}! = {}; + · ▲ + ╰──── + help: Try insert a semicolon here diff --git a/tasks/coverage/parser_typescript.snap b/tasks/coverage/parser_typescript.snap index 1325bee5b..6063f8a26 100644 --- a/tasks/coverage/parser_typescript.snap +++ b/tasks/coverage/parser_typescript.snap @@ -1,7 +1,7 @@ parser_typescript Summary: AST Parsed : 5240/5243 (99.94%) Positive Passed: 5233/5243 (99.81%) -Negative Passed: 1061/4879 (21.75%) +Negative Passed: 1060/4879 (21.73%) Expect Syntax Error: "compiler/ClassDeclaration10.ts" Expect Syntax Error: "compiler/ClassDeclaration11.ts" Expect Syntax Error: "compiler/ClassDeclaration13.ts" @@ -2186,6 +2186,7 @@ Expect Syntax Error: "conformance/controlFlow/controlFlowOptionalChain.ts" Expect Syntax Error: "conformance/controlFlow/controlFlowOptionalChain3.tsx" Expect Syntax Error: "conformance/controlFlow/controlFlowTypeofObject.ts" Expect Syntax Error: "conformance/controlFlow/controlFlowWhileStatement.ts" +Expect Syntax Error: "conformance/controlFlow/definiteAssignmentAssertions.ts" Expect Syntax Error: "conformance/controlFlow/dependentDestructuredVariables.ts" Expect Syntax Error: "conformance/controlFlow/exhaustiveSwitchStatements1.ts" Expect Syntax Error: "conformance/controlFlow/neverReturningFunctions1.ts" @@ -3941,7 +3942,7 @@ Expect to Parse: "conformance/externalModules/topLevelAwait.3.ts" ╭─[conformance/externalModules/topLevelAwait.3.ts:7:15] 6 │ export {}; 7 │ declare const await: any; - · ───── + · ────────── 8 │ declare class C extends await {} ╰──── @@ -4858,7 +4859,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:4:13] 3 │ constructor(i: number, ...arguments) { // error 4 │ var arguments: any[]; // no error - · ───────── + · ──────────────── 5 │ } ╰──── @@ -4866,7 +4867,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:8:17] 7 │ class c12 { 8 │ constructor(arguments: number, ...rest) { // error - · ───────── + · ───────────────── 9 │ var arguments = 10; // no error ╰──── @@ -4882,7 +4883,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:13:17] 12 │ class c1NoError { 13 │ constructor(arguments: number) { // no error - · ───────── + · ───────────────── 14 │ var arguments = 10; // no error ╰──── @@ -4914,7 +4915,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:30:24] 29 │ class c3 { 30 │ constructor(public arguments: number, ...restParameters) { //arguments is error - · ───────── + · ───────────────── 31 │ var arguments = 10; // no error ╰──── @@ -4930,7 +4931,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:35:24] 34 │ class c3NoError { 35 │ constructor(public arguments: number) { // no error - · ───────── + · ───────────────── 36 │ var arguments = 10; // no error ╰──── @@ -4954,7 +4955,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:44:17] 43 │ declare class c42 { 44 │ constructor(arguments: number, ...rest); // No error - no code gen - · ───────── + · ───────────────── 45 │ } ╰──── @@ -4962,7 +4963,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:47:17] 46 │ declare class c4NoError { 47 │ constructor(arguments: number); // no error - · ───────── + · ───────────────── 48 │ } ╰──── @@ -4994,7 +4995,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:54:13] 53 │ constructor(i: any, ...arguments) { // error 54 │ var arguments: any[]; // no error - · ───────── + · ──────────────── 55 │ } ╰──── @@ -5002,7 +5003,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:59:17] 58 │ class c52 { 59 │ constructor(arguments: number, ...rest); // no codegen no error - · ───────── + · ───────────────── 60 │ constructor(arguments: string, ...rest); // no codegen no error ╰──── @@ -5010,7 +5011,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:60:17] 59 │ constructor(arguments: number, ...rest); // no codegen no error 60 │ constructor(arguments: string, ...rest); // no codegen no error - · ───────── + · ───────────────── 61 │ constructor(arguments: any, ...rest) { // error ╰──── @@ -5018,7 +5019,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:61:17] 60 │ constructor(arguments: string, ...rest); // no codegen no error 61 │ constructor(arguments: any, ...rest) { // error - · ───────── + · ────────────── 62 │ var arguments: any; // no error ╰──── @@ -5026,7 +5027,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:62:13] 61 │ constructor(arguments: any, ...rest) { // error 62 │ var arguments: any; // no error - · ───────── + · ────────────── 63 │ } ╰──── @@ -5034,7 +5035,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:67:17] 66 │ class c5NoError { 67 │ constructor(arguments: number); // no error - · ───────── + · ───────────────── 68 │ constructor(arguments: string); // no error ╰──── @@ -5042,7 +5043,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:68:17] 67 │ constructor(arguments: number); // no error 68 │ constructor(arguments: string); // no error - · ───────── + · ───────────────── 69 │ constructor(arguments: any) { // no error ╰──── @@ -5050,7 +5051,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:69:17] 68 │ constructor(arguments: string); // no error 69 │ constructor(arguments: any) { // no error - · ───────── + · ────────────── 70 │ var arguments: any; // no error ╰──── @@ -5058,7 +5059,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:70:13] 69 │ constructor(arguments: any) { // no error 70 │ var arguments: any; // no error - · ───────── + · ────────────── 71 │ } ╰──── @@ -5082,7 +5083,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:79:17] 78 │ declare class c62 { 79 │ constructor(arguments: number, ...rest); // no codegen no error - · ───────── + · ───────────────── 80 │ constructor(arguments: string, ...rest); // no codegen no error ╰──── @@ -5090,7 +5091,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:80:17] 79 │ constructor(arguments: number, ...rest); // no codegen no error 80 │ constructor(arguments: string, ...rest); // no codegen no error - · ───────── + · ───────────────── 81 │ } ╰──── @@ -5098,7 +5099,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:84:17] 83 │ declare class c6NoError { 84 │ constructor(arguments: number); // no error - · ───────── + · ───────────────── 85 │ constructor(arguments: string); // no error ╰──── @@ -5106,7 +5107,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassConstructor.ts:85:17] 84 │ constructor(arguments: number); // no error 85 │ constructor(arguments: string); // no error - · ───────── + · ───────────────── 86 │ } ╰──── @@ -5122,7 +5123,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:3:13] 2 │ public foo(i: number, ...arguments) { //arguments is error 3 │ var arguments: any[]; // no error - · ───────── + · ──────────────── 4 │ } ╰──── @@ -5130,7 +5131,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:5:17] 4 │ } 5 │ public foo1(arguments: number, ...rest) { //arguments is error - · ───────── + · ───────────────── 6 │ var arguments = 10; // no error ╰──── @@ -5146,7 +5147,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:8:23] 7 │ } 8 │ public fooNoError(arguments: number) { // no error - · ───────── + · ───────────────── 9 │ var arguments = 10; // no error ╰──── @@ -5186,7 +5187,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:14:13] 13 │ public f4(i: any, ...arguments) { // error 14 │ var arguments: any[]; // no error - · ───────── + · ──────────────── 15 │ } ╰──── @@ -5194,7 +5195,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:16:16] 15 │ } 16 │ public f41(arguments: number, ...rest); // no codegen no error - · ───────── + · ───────────────── 17 │ public f41(arguments: string, ...rest); // no codegen no error ╰──── @@ -5202,7 +5203,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:17:16] 16 │ public f41(arguments: number, ...rest); // no codegen no error 17 │ public f41(arguments: string, ...rest); // no codegen no error - · ───────── + · ───────────────── 18 │ public f41(arguments: any, ...rest) { // error ╰──── @@ -5210,7 +5211,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:18:16] 17 │ public f41(arguments: string, ...rest); // no codegen no error 18 │ public f41(arguments: any, ...rest) { // error - · ───────── + · ────────────── 19 │ var arguments: any; // no error ╰──── @@ -5218,7 +5219,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:19:13] 18 │ public f41(arguments: any, ...rest) { // error 19 │ var arguments: any; // no error - · ───────── + · ────────────── 20 │ } ╰──── @@ -5226,7 +5227,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:21:22] 20 │ } 21 │ public f4NoError(arguments: number); // no error - · ───────── + · ───────────────── 22 │ public f4NoError(arguments: string); // no error ╰──── @@ -5234,7 +5235,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:22:22] 21 │ public f4NoError(arguments: number); // no error 22 │ public f4NoError(arguments: string); // no error - · ───────── + · ───────────────── 23 │ public f4NoError(arguments: any) { // no error ╰──── @@ -5242,7 +5243,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:23:22] 22 │ public f4NoError(arguments: string); // no error 23 │ public f4NoError(arguments: any) { // no error - · ───────── + · ────────────── 24 │ var arguments: any; // no error ╰──── @@ -5250,7 +5251,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:24:13] 23 │ public f4NoError(arguments: any) { // no error 24 │ var arguments: any; // no error - · ───────── + · ────────────── 25 │ } ╰──── @@ -5266,7 +5267,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:30:17] 29 │ public foo(i: number, ...arguments); // No error - no code gen 30 │ public foo1(arguments: number, ...rest); // No error - no code gen - · ───────── + · ───────────────── 31 │ public fooNoError(arguments: number); // No error - no code gen ╰──── @@ -5274,7 +5275,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:31:23] 30 │ public foo1(arguments: number, ...rest); // No error - no code gen 31 │ public fooNoError(arguments: number); // No error - no code gen - · ───────── + · ───────────────── 32 │ ╰──── @@ -5298,7 +5299,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:35:16] 34 │ public f4(i: string, ...arguments); // no codegen no error 35 │ public f41(arguments: number, ...rest); // no codegen no error - · ───────── + · ───────────────── 36 │ public f41(arguments: string, ...rest); // no codegen no error ╰──── @@ -5306,7 +5307,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:36:16] 35 │ public f41(arguments: number, ...rest); // no codegen no error 36 │ public f41(arguments: string, ...rest); // no codegen no error - · ───────── + · ───────────────── 37 │ public f4NoError(arguments: number); // no error ╰──── @@ -5314,7 +5315,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:37:22] 36 │ public f41(arguments: string, ...rest); // no codegen no error 37 │ public f4NoError(arguments: number); // no error - · ───────── + · ───────────────── 38 │ public f4NoError(arguments: string); // no error ╰──── @@ -5322,7 +5323,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/collisionArgumentsClassMethod.ts:38:22] 37 │ public f4NoError(arguments: number); // no error 38 │ public f4NoError(arguments: string); // no error - · ───────── + · ───────────────── 39 │ } ╰──── @@ -5442,7 +5443,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/constDeclarations-errors.ts:5:7] 4 │ const c1; 5 │ const c2: number; - · ── + · ────────── 6 │ const c3, c4, c5 :string, c6; // error, missing initialicer ╰──── @@ -5466,7 +5467,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/constDeclarations-errors.ts:6:15] 5 │ const c2: number; 6 │ const c3, c4, c5 :string, c6; // error, missing initialicer - · ── + · ────────── 7 │ ╰──── @@ -5870,7 +5871,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" × Missing initializer in const declaration ╭─[compiler/downlevelLetConst4.ts:1:7] 1 │ const a: number - · ─ + · ───────── ╰──── × Unexpected token @@ -6629,9 +6630,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" × Identifier `b` has already been declared ╭─[compiler/functionCall15.ts:1:25] 1 │ function foo(a?:string, b?:number, ...b:number[]){} - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `b` has already been declared here + · ────┬──── ─────┬──── + · │ ╰── It can not be redeclared here + · ╰── `b` has already been declared here ╰──── × 'with' statements are not allowed @@ -7588,8 +7589,8 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" × Identifier `baz` has already been declared ╭─[compiler/mismatchedClassConstructorVariable.ts:1:5] 1 │ var baz: foo; - · ─┬─ - · ╰── `baz` has already been declared here + · ────┬─── + · ╰── `baz` has already been declared here 2 │ class baz { } · ─┬─ · ╰── It can not be redeclared here @@ -7797,7 +7798,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/noImplicitAnyDestructuringVarDeclaration.ts:6:5] 5 │ 6 │ var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; - · ──── + · ─────────── 7 │ ╰──── @@ -7805,7 +7806,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/noImplicitAnyDestructuringVarDeclaration.ts:6:18] 5 │ 6 │ var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; - · ──── + · ───────────────── 7 │ ╰──── @@ -7813,7 +7814,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/noImplicitAnyDestructuringVarDeclaration.ts:8:5] 7 │ 8 │ var {b3}: { b3 }, c3: { b3 }; // error in type instead - · ──── + · ──────────── 9 │ ╰──── @@ -7846,7 +7847,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/numberVsBigIntOperations.ts:88:7] 87 │ const isNumber: (x: 0 | 1) => number = (x: 0 | 1) => x; 88 │ const zeroOrBigOne: 0 | 1n; - · ──────────── + · ──────────────────── 89 │ if (typeof zeroOrBigOne === "bigint") isBigInt(zeroOrBigOne); ╰──── @@ -7854,7 +7855,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/numberVsBigIntOperations.ts:95:7] 94 │ if (zeroOrBigOne) isOne(zeroOrBigOne); 95 │ const bigZeroOrOne: 0n | 1; - · ──────────── + · ──────────────────── 96 │ if (bigZeroOrOne) isOne(bigZeroOrOne); ╰──── @@ -9082,15 +9083,15 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[compiler/strictModeReservedWord.ts:17:9] 16 │ 17 │ var b: public.bar; - · ┬ - · ╰── `b` has already been declared here + · ──────┬────── + · ╰── `b` has already been declared here 18 │ 19 │ function foo(x: private.x) { } 20 │ function foo1(x: private.package.x) { } 21 │ function foo2(x: private.package.protected) { } 22 │ let b: interface.package.implements.B; - · ┬ - · ╰── It can not be redeclared here + · ────────────────┬──────────────── + · ╰── It can not be redeclared here 23 │ ublic(); ╰──── @@ -11979,14 +11980,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" 168 │ get p2(): asserts this is string; ╰──── - × Unexpected token - ╭─[conformance/controlFlow/definiteAssignmentAssertions.ts:72:11] - 71 │ function f4() { - 72 │ let a!; - · ─ - 73 │ let b! = 1; - ╰──── - × Expected `,` but found `!` ╭─[conformance/controlFlow/definiteAssignmentAssertionsWithObjectShortHand.ts:5:16] 4 │ const a: string | undefined = 'ff'; @@ -12321,7 +12314,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts:5:16] 4 │ public implements() { } 5 │ public foo(arguments: any) { } - · ───────── + · ────────────── 6 │ private bar(eval:any) { ╰──── @@ -12329,7 +12322,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/es6/classDeclaration/parseClassDeclarationInStrictModeByDefaultInES6.ts:6:17] 5 │ public foo(arguments: any) { } 6 │ private bar(eval:any) { - · ──── + · ──────── 7 │ arguments = "hello"; ╰──── @@ -13579,7 +13572,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/es6/variableDeclarations/VariableDeclaration4_es6.ts:2:7] 1 │ // @target:es6 2 │ const a: number - · ─ + · ───────── ╰──── × Unexpected token @@ -16026,7 +16019,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/interfaces/interfaceDeclarations/asiPreventsParsingAsInterface05.ts:3:5] 2 │ 3 │ var interface: number; - · ───────── + · ───────────────── 4 │ ╰──── @@ -16138,7 +16131,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/jsx/jsxParsingErrorImmediateSpreadInAttributeValue.tsx:11:7] 10 │ 11 │ const X: any - · ─ + · ────── 12 │ const a: any ╰──── @@ -16146,7 +16139,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/jsx/jsxParsingErrorImmediateSpreadInAttributeValue.tsx:12:7] 11 │ const X: any 12 │ const a: any - · ─ + · ────── 13 │ ╰──── @@ -19294,8 +19287,8 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/statements/tryStatements/catchClauseWithTypeAnnotation.ts:29:20] 28 │ // minor bug: shows that the `catch` argument is skipped when checking scope 29 │ try { } catch (x) { let x: string; } - · ┬ ┬ - · │ ╰── It can not be redeclared here + · ┬ ────┬──── + · │ ╰── It can not be redeclared here · ╰── `x` has already been declared here 30 │ try { } catch (x) { var x: string; } ╰──── @@ -19428,9 +19421,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:7:14] 6 │ var f3 = (x, x) => { } 7 │ var f4 = (x: T, x: T) => { } - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ──┬─ ──┬─ + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 8 │ ╰──── @@ -19438,9 +19431,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:12:11] 11 │ var f6 = function (x: string, x: number) { } 12 │ var f7 = (x: string, x: number) => { } - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ────┬──── ────┬──── + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 13 │ var f8 = (x: T, y: T) => { } ╰──── @@ -19458,9 +19451,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:17:10] 16 │ foo(x, x) { } 17 │ foo2(x: number, x: string) { } - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ────┬──── ────┬──── + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 18 │ foo3(x: T, x: T) { } ╰──── @@ -19468,9 +19461,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:18:13] 17 │ foo2(x: number, x: string) { } 18 │ foo3(x: T, x: T) { } - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ──┬─ ──┬─ + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 19 │ } ╰──── @@ -19488,9 +19481,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:23:6] 22 │ (x, x); 23 │ (x: string, x: number); - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ────┬──── ────┬──── + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 24 │ foo(x, x); ╰──── @@ -19508,9 +19501,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:25:9] 24 │ foo(x, x); 25 │ foo(x: number, x: string); - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ────┬──── ────┬──── + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 26 │ foo3(x: T, x: T); ╰──── @@ -19518,9 +19511,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:26:13] 25 │ foo(x: number, x: string); 26 │ foo3(x: T, x: T); - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ──┬─ ──┬─ + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 27 │ } ╰──── @@ -19538,9 +19531,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:31:10] 30 │ foo(x, x); 31 │ foo2(x: number, x: string); - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ────┬──── ────┬──── + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 32 │ }; ╰──── @@ -19548,9 +19541,9 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts" ╭─[conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithDuplicateParameters.ts:37:12] 36 │ a: function foo(x: number, x: string) { }, 37 │ b: (x: T, x: T) => { } - · ┬ ┬ - · │ ╰── It can not be redeclared here - · ╰── `x` has already been declared here + · ──┬─ ──┬─ + · │ ╰── It can not be redeclared here + · ╰── `x` has already been declared here 38 │ } ╰────