refactor(semantic): unify diagnostic in checker

This commit is contained in:
Boshen 2024-05-12 00:44:00 +08:00
parent 7067f9c646
commit 09f34fc942
No known key found for this signature in database
GPG key ID: 9C7A8C8AB22BEBD1
6 changed files with 419 additions and 653 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,7 @@
use oxc_ast::syntax_directed_operations::BoundNames; use oxc_ast::syntax_directed_operations::BoundNames;
#[allow(clippy::wildcard_imports)] #[allow(clippy::wildcard_imports)]
use oxc_ast::{ast::*, AstKind}; use oxc_ast::{ast::*, AstKind};
use oxc_diagnostics::{ use oxc_diagnostics::OxcDiagnostic;
miette::{self, Diagnostic},
thiserror::Error,
};
use oxc_span::{Atom, GetSpan, Span}; use oxc_span::{Atom, GetSpan, Span};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
@ -31,43 +28,44 @@ impl EarlyErrorTypeScript {
} }
} }
fn empty_type_parameter_list(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::new("Type parameter list cannot be empty.").with_labels([span0.into()])
}
fn check_ts_type_parameter_declaration( fn check_ts_type_parameter_declaration(
declaration: &TSTypeParameterDeclaration<'_>, declaration: &TSTypeParameterDeclaration<'_>,
ctx: &SemanticBuilder<'_>, ctx: &SemanticBuilder<'_>,
) { ) {
#[derive(Debug, Error, Diagnostic)]
#[error("Type parameter list cannot be empty.")]
#[diagnostic()]
struct EmptyTypeParameterList(#[label] Span);
if declaration.params.is_empty() { if declaration.params.is_empty() {
ctx.error(EmptyTypeParameterList(declaration.span)); ctx.error(empty_type_parameter_list(declaration.span));
} }
} }
fn unexpected_optional(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::new("Unexpected `?` operator").with_labels([span0.into()])
}
#[allow(clippy::cast_possible_truncation)] #[allow(clippy::cast_possible_truncation)]
fn check_variable_declarator(decl: &VariableDeclarator, ctx: &SemanticBuilder<'_>) { fn check_variable_declarator(decl: &VariableDeclarator, ctx: &SemanticBuilder<'_>) {
#[derive(Debug, Error, Diagnostic)]
#[error("Unexpected `?` operator")]
#[diagnostic()]
struct UnexpectedOptional(#[label] Span);
if decl.id.optional { if decl.id.optional {
let start = decl.id.span().end; let start = decl.id.span().end;
let Some(offset) = ctx.source_text[start as usize..].find('?') else { return }; let Some(offset) = ctx.source_text[start as usize..].find('?') else { return };
let offset = start + offset as u32; let offset = start + offset as u32;
ctx.error(UnexpectedOptional(Span::new(offset, offset))); ctx.error(unexpected_optional(Span::new(offset, offset)));
} }
} }
fn check_formal_parameters(params: &FormalParameters, ctx: &SemanticBuilder<'_>) { fn required_parameter_after_optional_parameter(span0: Span) -> OxcDiagnostic {
#[derive(Debug, Error, Diagnostic)] OxcDiagnostic::new("A required parameter cannot follow an optional parameter.")
#[error("A required parameter cannot follow an optional parameter.")] .with_labels([span0.into()])
#[diagnostic()] }
struct RequiredParameterAfterOptionalParameter(#[label] Span);
#[derive(Debug, Error, Diagnostic)]
#[error("A parameter property is only allowed in a constructor implementation.")]
#[diagnostic()]
struct ParameterPropertyOutsideConstructor(#[label] Span);
fn parameter_property_outside_constructor(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::new("A parameter property is only allowed in a constructor implementation.")
.with_labels([span0.into()])
}
fn check_formal_parameters(params: &FormalParameters, ctx: &SemanticBuilder<'_>) {
if !params.is_empty() && params.kind == FormalParameterKind::Signature { if !params.is_empty() && params.kind == FormalParameterKind::Signature {
check_duplicate_bound_names(params, ctx); check_duplicate_bound_names(params, ctx);
} }
@ -78,7 +76,7 @@ fn check_formal_parameters(params: &FormalParameters, ctx: &SemanticBuilder<'_>)
for item in &params.items { for item in &params.items {
// function a(optional?: number, required: number) { } // function a(optional?: number, required: number) { }
if has_optional && !item.pattern.optional && !item.pattern.kind.is_assignment_pattern() { if has_optional && !item.pattern.optional && !item.pattern.kind.is_assignment_pattern() {
ctx.error(RequiredParameterAfterOptionalParameter(item.span)); ctx.error(required_parameter_after_optional_parameter(item.span));
} }
if item.pattern.optional { if item.pattern.optional {
has_optional = true; has_optional = true;
@ -86,7 +84,7 @@ fn check_formal_parameters(params: &FormalParameters, ctx: &SemanticBuilder<'_>)
// function a(public x: number) { } // function a(public x: number) { }
if !is_inside_constructor && item.accessibility.is_some() { if !is_inside_constructor && item.accessibility.is_some() {
ctx.error(ParameterPropertyOutsideConstructor(item.span)); ctx.error(parameter_property_outside_constructor(item.span));
} }
} }
} }
@ -100,6 +98,13 @@ fn check_duplicate_bound_names<'a, T: BoundNames<'a>>(bound_names: &T, ctx: &Sem
}); });
} }
fn unexpected_assignment(span0: Span) -> OxcDiagnostic {
OxcDiagnostic::new(
"The left-hand side of an assignment expression must be a variable or a property access.",
)
.with_labels([span0.into()])
}
fn check_simple_assignment_target<'a>( fn check_simple_assignment_target<'a>(
target: &SimpleAssignmentTarget<'a>, target: &SimpleAssignmentTarget<'a>,
ctx: &SemanticBuilder<'a>, ctx: &SemanticBuilder<'a>,
@ -110,40 +115,34 @@ fn check_simple_assignment_target<'a>(
Expression::Identifier(_) => {} Expression::Identifier(_) => {}
match_member_expression!(Expression) => {} match_member_expression!(Expression) => {}
_ => { _ => {
#[derive(Debug, Error, Diagnostic)] ctx.error(unexpected_assignment(target.span()));
#[error(
"The left-hand side of an assignment expression must be a variable or a property access."
)]
#[diagnostic()]
struct UnexpectedAssignment(#[label] Span);
ctx.error(UnexpectedAssignment(target.span()));
} }
} }
} }
} }
fn check_array_pattern<'a>(pattern: &ArrayPattern<'a>, ctx: &SemanticBuilder<'a>) { fn unexpected_type_annotation(span0: Span) -> OxcDiagnostic {
#[derive(Debug, Error, Diagnostic)] OxcDiagnostic::new("Unexpected type annotation").with_labels([span0.into()])
#[error("Unexpected type annotation")] }
#[diagnostic()]
struct UnexpectedTypeAnnotation(#[label] Span);
fn check_array_pattern<'a>(pattern: &ArrayPattern<'a>, ctx: &SemanticBuilder<'a>) {
for element in &pattern.elements { for element in &pattern.elements {
let _ = element.as_ref().map(|element| { let _ = element.as_ref().map(|element| {
if let Some(type_annotation) = &element.type_annotation { if let Some(type_annotation) = &element.type_annotation {
ctx.error(UnexpectedTypeAnnotation(type_annotation.span)); ctx.error(unexpected_type_annotation(type_annotation.span));
} }
}); });
} }
} }
fn check_ts_module_declaration<'a>(decl: &TSModuleDeclaration<'a>, ctx: &SemanticBuilder<'a>) { fn not_allowed_namespace_declaration(span0: Span) -> OxcDiagnostic {
#[derive(Debug, Error, Diagnostic)] OxcDiagnostic::new(
#[error("A namespace declaration is only allowed at the top level of a namespace or module.")] "A namespace declaration is only allowed at the top level of a namespace or module.",
#[diagnostic()] )
struct NotAllowedNamespaceDeclaration(#[label] Span); .with_labels([span0.into()])
}
fn check_ts_module_declaration<'a>(decl: &TSModuleDeclaration<'a>, ctx: &SemanticBuilder<'a>) {
// skip current node // skip current node
for node in ctx.nodes.iter_parents(ctx.current_node_id).skip(1) { for node in ctx.nodes.iter_parents(ctx.current_node_id).skip(1) {
match node.kind() { match node.kind() {
@ -156,18 +155,17 @@ fn check_ts_module_declaration<'a>(decl: &TSModuleDeclaration<'a>, ctx: &Semanti
continue; continue;
} }
_ => { _ => {
ctx.error(NotAllowedNamespaceDeclaration(decl.span)); ctx.error(not_allowed_namespace_declaration(decl.span));
} }
} }
} }
} }
fn check_ts_enum_declaration(decl: &TSEnumDeclaration<'_>, ctx: &SemanticBuilder<'_>) { fn enum_member_must_have_initializer(span0: Span) -> OxcDiagnostic {
#[derive(Debug, Error, Diagnostic)] OxcDiagnostic::new("Enum member must have initializer.").with_labels([span0.into()])
#[error("Enum member must have initializer.")] }
#[diagnostic()]
struct EnumMemberMustHaveInitializer(#[label] Span);
fn check_ts_enum_declaration(decl: &TSEnumDeclaration<'_>, ctx: &SemanticBuilder<'_>) {
let mut need_initializer = false; let mut need_initializer = false;
decl.members.iter().for_each(|member| { decl.members.iter().for_each(|member| {
@ -187,7 +185,7 @@ fn check_ts_enum_declaration(decl: &TSEnumDeclaration<'_>, ctx: &SemanticBuilder
| Expression::UnaryExpression(_) | Expression::UnaryExpression(_)
); );
} else if need_initializer { } else if need_initializer {
ctx.error(EnumMemberMustHaveInitializer(member.span)); ctx.error(enum_member_must_have_initializer(member.span));
} }
}); });
} }

View file

@ -1765,15 +1765,13 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
× Use of undefined label × Use of undefined label
╭─[core/uncategorised/459/input.js:1:22] ╭─[core/uncategorised/459/input.js:1:22]
1 │ while (true) { break x; } 1 │ while (true) { break x; }
· ┬ · ─
· ╰── This label is used, but not defined
╰──── ╰────
× Use of undefined label × Use of undefined label
╭─[core/uncategorised/460/input.js:1:25] ╭─[core/uncategorised/460/input.js:1:25]
1 │ while (true) { continue x; } 1 │ while (true) { continue x; }
· ┬ · ─
· ╰── This label is used, but not defined
╰──── ╰────
× Jump target cannot cross function boundary. × Jump target cannot cross function boundary.
@ -2358,7 +2356,6 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[es2015/class-methods/direct-super-outside-constructor/input.js:2:9] ╭─[es2015/class-methods/direct-super-outside-constructor/input.js:2:9]
1 │ class A { 1 │ class A {
2 │ x () {super()} 2 │ x () {super()}
@ -4094,7 +4091,6 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
help: replace with `super()` or `super.prop` or `super[prop]` help: replace with `super()` or `super.prop` or `super[prop]`
× 'super' can only be referenced in members of derived classes or object literal expressions. × 'super' can only be referenced in members of derived classes or object literal expressions.
╭─[es2015/uncategorised/344/input.js:1:1] ╭─[es2015/uncategorised/344/input.js:1:1]
1 │ super 1 │ super
· ───── · ─────
@ -7498,7 +7494,6 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
help: replace with `super()` or `super.prop` or `super[prop]` help: replace with `super()` or `super.prop` or `super[prop]`
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[esprima/es2015-super-property/invalid_super_id/input.js:2:13] ╭─[esprima/es2015-super-property/invalid_super_id/input.js:2:13]
1 │ class A { 1 │ class A {
2 │ foo() { new super + 3 } 2 │ foo() { new super + 3 }
@ -7507,7 +7502,6 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[esprima/es2015-super-property/invalid_super_not_inside_function/input.js:1:9] ╭─[esprima/es2015-super-property/invalid_super_not_inside_function/input.js:1:9]
1 │ var x = super(); 1 │ var x = super();
· ─────── · ───────
@ -8936,15 +8930,13 @@ Expect to Parse: "typescript/types/const-type-parameters-babel-7/input.ts"
× Use of undefined label × Use of undefined label
╭─[esprima/invalid-syntax/migrated_0176/input.js:1:22] ╭─[esprima/invalid-syntax/migrated_0176/input.js:1:22]
1 │ while (true) { break x; } 1 │ while (true) { break x; }
· ┬ · ─
· ╰── This label is used, but not defined
╰──── ╰────
× Use of undefined label × Use of undefined label
╭─[esprima/invalid-syntax/migrated_0177/input.js:1:25] ╭─[esprima/invalid-syntax/migrated_0177/input.js:1:25]
1 │ while (true) { continue x; } 1 │ while (true) { continue x; }
· ┬ · ─
· ╰── This label is used, but not defined
╰──── ╰────
× Jump target cannot cross function boundary. × Jump target cannot cross function boundary.

File diff suppressed because it is too large Load diff

View file

@ -4671,8 +4671,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[compiler/breakTarget6.ts:2:9] ╭─[compiler/breakTarget6.ts:2:9]
1 │ while (true) { 1 │ while (true) {
2 │ break target; 2 │ break target;
· ───┬── · ──────
· ╰── This label is used, but not defined
3 │ } 3 │ }
╰──── ╰────
@ -5739,8 +5738,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[compiler/continueTarget6.ts:2:12] ╭─[compiler/continueTarget6.ts:2:12]
1 │ while (true) { 1 │ while (true) {
2 │ continue target; 2 │ continue target;
· ───┬── · ──────
· ╰── This label is used, but not defined
3 │ } 3 │ }
╰──── ╰────
@ -6727,7 +6725,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
help: Try insert a semicolon here help: Try insert a semicolon here
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[compiler/illegalSuperCallsInConstructor.ts:12:17] ╭─[compiler/illegalSuperCallsInConstructor.ts:12:17]
11 │ get foo() { 11 │ get foo() {
12 │ super(); 12 │ super();
@ -6736,7 +6733,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[compiler/illegalSuperCallsInConstructor.ts:16:17] ╭─[compiler/illegalSuperCallsInConstructor.ts:16:17]
15 │ set foo(v: number) { 15 │ set foo(v: number) {
16 │ super(); 16 │ super();
@ -9602,7 +9598,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
help: either remove this super, or extend the class help: either remove this super, or extend the class
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[compiler/superCallFromFunction1.ts:3:5] ╭─[compiler/superCallFromFunction1.ts:3:5]
2 │ function foo() { 2 │ function foo() {
3 │ super(value => String(value)); 3 │ super(value => String(value));
@ -9611,7 +9606,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[compiler/superCallOutsideConstructor.ts:6:9] ╭─[compiler/superCallOutsideConstructor.ts:6:9]
5 │ class D extends C { 5 │ class D extends C {
6 │ x = super(); 6 │ x = super();
@ -9700,7 +9694,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
help: replace with `super()` or `super.prop` or `super[prop]` help: replace with `super()` or `super.prop` or `super[prop]`
× 'super' can only be referenced in members of derived classes or object literal expressions. × 'super' can only be referenced in members of derived classes or object literal expressions.
╭─[compiler/superErrors.ts:3:13] ╭─[compiler/superErrors.ts:3:13]
2 │ // super in a non class context 2 │ // super in a non class context
3 │ var x = super; 3 │ var x = super;
@ -9709,7 +9702,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× 'super' can only be referenced in members of derived classes or object literal expressions. × 'super' can only be referenced in members of derived classes or object literal expressions.
╭─[compiler/superErrors.ts:4:19] ╭─[compiler/superErrors.ts:4:19]
3 │ var x = super; 3 │ var x = super;
4 │ var y = () => super; 4 │ var y = () => super;
@ -9718,7 +9710,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× 'super' can only be referenced in members of derived classes or object literal expressions. × 'super' can only be referenced in members of derived classes or object literal expressions.
╭─[compiler/superErrors.ts:5:31] ╭─[compiler/superErrors.ts:5:31]
4 │ var y = () => super; 4 │ var y = () => super;
5 │ var z = () => () => () => super; 5 │ var z = () => () => () => super;
@ -11152,7 +11143,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
help: Try insert a semicolon here help: Try insert a semicolon here
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers6.ts:6:16] ╭─[conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers6.ts:6:16]
5 │ class D extends C { 5 │ class D extends C {
6 │ static c = super(); 6 │ static c = super();
@ -12510,7 +12500,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
help: either remove this super, or extend the class help: either remove this super, or extend the class
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/es6/computedProperties/computedPropertyNames27_ES5.ts:5:7] ╭─[conformance/es6/computedProperties/computedPropertyNames27_ES5.ts:5:7]
4 │ class C extends Base { 4 │ class C extends Base {
5 │ [(super(), "prop")]() { } 5 │ [(super(), "prop")]() { }
@ -12519,7 +12508,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/es6/computedProperties/computedPropertyNames27_ES6.ts:5:7] ╭─[conformance/es6/computedProperties/computedPropertyNames27_ES6.ts:5:7]
4 │ class C extends Base { 4 │ class C extends Base {
5 │ [(super(), "prop")]() { } 5 │ [(super(), "prop")]() { }
@ -15609,7 +15597,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
help: either remove this super, or extend the class help: either remove this super, or extend the class
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:9:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:9:9]
8 │ fn() { 8 │ fn() {
9 │ super(); 9 │ super();
@ -15618,7 +15605,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:14:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:14:9]
13 │ get foo() { 13 │ get foo() {
14 │ super(); 14 │ super();
@ -15627,7 +15613,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:18:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:18:9]
17 │ set foo(v) { 17 │ set foo(v) {
18 │ super(); 18 │ super();
@ -15636,7 +15621,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:22:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:22:9]
21 │ //super call in class member initializer with no base type 21 │ //super call in class member initializer with no base type
22 │ p = super(); 22 │ p = super();
@ -15645,7 +15629,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:26:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:26:9]
25 │ static fn() { 25 │ static fn() {
26 │ super(); 26 │ super();
@ -15654,7 +15637,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:30:16] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:30:16]
29 │ //super call in static class member initializer with no base type 29 │ //super call in static class member initializer with no base type
30 │ static k = super(); 30 │ static k = super();
@ -15663,7 +15645,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:34:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:34:9]
33 │ static get q() { 33 │ static get q() {
34 │ super(); 34 │ super();
@ -15672,7 +15653,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:38:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:38:9]
37 │ static set q(n) { 37 │ static set q(n) {
38 │ super(); 38 │ super();
@ -15681,7 +15661,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:58:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:58:9]
57 │ //super call in class member initializer of derived type 57 │ //super call in class member initializer of derived type
58 │ t = super(); 58 │ t = super();
@ -15690,7 +15669,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:62:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:62:9]
61 │ //super call in class member function of derived type 61 │ //super call in class member function of derived type
62 │ super(); 62 │ super();
@ -15699,7 +15677,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:67:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:67:9]
66 │ get foo() { 66 │ get foo() {
67 │ super(); 67 │ super();
@ -15708,7 +15685,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/expressions/superCalls/errorSuperCalls.ts:71:9] ╭─[conformance/expressions/superCalls/errorSuperCalls.ts:71:9]
70 │ set foo(n) { 70 │ set foo(n) {
71 │ super(); 71 │ super();
@ -15717,7 +15693,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× 'super' can only be referenced in members of derived classes or object literal expressions. × 'super' can only be referenced in members of derived classes or object literal expressions.
╭─[conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts:127:16] ╭─[conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts:127:16]
126 │ // In object literal 126 │ // In object literal
127 │ var obj = { n: super.wat, p: super.foo() }; 127 │ var obj = { n: super.wat, p: super.foo() };
@ -15725,7 +15700,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╰──── ╰────
× 'super' can only be referenced in members of derived classes or object literal expressions. × 'super' can only be referenced in members of derived classes or object literal expressions.
╭─[conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts:127:30] ╭─[conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts:127:30]
126 │ // In object literal 126 │ // In object literal
127 │ var obj = { n: super.wat, p: super.foo() }; 127 │ var obj = { n: super.wat, p: super.foo() };
@ -17878,8 +17852,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget6.ts:2:9] ╭─[conformance/parser/ecmascript5/Statements/BreakStatements/parser_breakTarget6.ts:2:9]
1 │ while (true) { 1 │ while (true) {
2 │ break target; 2 │ break target;
· ───┬── · ──────
· ╰── This label is used, but not defined
3 │ } 3 │ }
╰──── ╰────
@ -17930,8 +17903,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget6.ts:2:12] ╭─[conformance/parser/ecmascript5/Statements/ContinueStatements/parser_continueTarget6.ts:2:12]
1 │ while (true) { 1 │ while (true) {
2 │ continue target; 2 │ continue target;
· ───┬── · ──────
· ╰── This label is used, but not defined
3 │ } 3 │ }
╰──── ╰────
@ -18218,7 +18190,6 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
help: replace with `super()` or `super.prop` or `super[prop]` help: replace with `super()` or `super.prop` or `super[prop]`
× Super calls are not permitted outside constructors or in nested functions inside constructors. × Super calls are not permitted outside constructors or in nested functions inside constructors.
╭─[conformance/parser/ecmascript5/SuperExpressions/parserSuperExpression2.ts:3:5] ╭─[conformance/parser/ecmascript5/SuperExpressions/parserSuperExpression2.ts:3:5]
2 │ M() { 2 │ M() {
3 │ super<T>(0); 3 │ super<T>(0);
@ -18653,8 +18624,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/salsa/plainJSBinderErrors.ts:38:19] ╭─[conformance/salsa/plainJSBinderErrors.ts:38:19]
37 │ label: var x = 1 37 │ label: var x = 1
38 │ break label 38 │ break label
· ──┬── · ─────
· ╰── This label is used, but not defined
39 │ } 39 │ }
╰──── ╰────
@ -18987,8 +18957,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts:11:10] ╭─[conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts:11:10]
10 │ ONE: 10 │ ONE:
11 │ do break TWO; while (true) 11 │ do break TWO; while (true)
· ─┬─ · ───
· ╰── This label is used, but not defined
12 │ 12 │
╰──── ╰────
@ -19004,8 +18973,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts:30:11] ╭─[conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts:30:11]
29 │ do { 29 │ do {
30 │ break FIVE; 30 │ break FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
31 │ FIVE: 31 │ FIVE:
╰──── ╰────
@ -19013,8 +18981,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts:40:11] ╭─[conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts:40:11]
39 │ do { 39 │ do {
40 │ break NINE; 40 │ break NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
41 │ }while (true) 41 │ }while (true)
╰──── ╰────
@ -19031,8 +18998,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidForBreakStatements.ts:11:15] ╭─[conformance/statements/breakStatements/invalidForBreakStatements.ts:11:15]
10 │ ONE: 10 │ ONE:
11 │ for(;;) break TWO; 11 │ for(;;) break TWO;
· ─┬─ · ───
· ╰── This label is used, but not defined
12 │ 12 │
╰──── ╰────
@ -19048,8 +19014,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidForBreakStatements.ts:30:11] ╭─[conformance/statements/breakStatements/invalidForBreakStatements.ts:30:11]
29 │ for(;;) { 29 │ for(;;) {
30 │ break FIVE; 30 │ break FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
31 │ FIVE: 31 │ FIVE:
╰──── ╰────
@ -19057,8 +19022,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidForBreakStatements.ts:39:11] ╭─[conformance/statements/breakStatements/invalidForBreakStatements.ts:39:11]
38 │ for(;;) { 38 │ for(;;) {
39 │ break NINE; 39 │ break NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
40 │ } 40 │ }
╰──── ╰────
@ -19075,8 +19039,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidForInBreakStatements.ts:11:25] ╭─[conformance/statements/breakStatements/invalidForInBreakStatements.ts:11:25]
10 │ ONE: 10 │ ONE:
11 │ for (var x in {}) break TWO; 11 │ for (var x in {}) break TWO;
· ─┬─ · ───
· ╰── This label is used, but not defined
12 │ 12 │
╰──── ╰────
@ -19092,8 +19055,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidForInBreakStatements.ts:30:11] ╭─[conformance/statements/breakStatements/invalidForInBreakStatements.ts:30:11]
29 │ for (var x in {}) { 29 │ for (var x in {}) {
30 │ break FIVE; 30 │ break FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
31 │ FIVE: 31 │ FIVE:
╰──── ╰────
@ -19101,8 +19063,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidForInBreakStatements.ts:40:11] ╭─[conformance/statements/breakStatements/invalidForInBreakStatements.ts:40:11]
39 │ for (var x in {}) { 39 │ for (var x in {}) {
40 │ break NINE; 40 │ break NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
41 │ } 41 │ }
╰──── ╰────
@ -19119,8 +19080,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidWhileBreakStatements.ts:8:20] ╭─[conformance/statements/breakStatements/invalidWhileBreakStatements.ts:8:20]
7 │ ONE: 7 │ ONE:
8 │ while (true) break TWO; 8 │ while (true) break TWO;
· ─┬─ · ───
· ╰── This label is used, but not defined
9 │ 9 │
╰──── ╰────
@ -19136,8 +19096,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidWhileBreakStatements.ts:27:11] ╭─[conformance/statements/breakStatements/invalidWhileBreakStatements.ts:27:11]
26 │ while (true) { 26 │ while (true) {
27 │ break FIVE; 27 │ break FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
28 │ FIVE: 28 │ FIVE:
╰──── ╰────
@ -19145,8 +19104,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/breakStatements/invalidWhileBreakStatements.ts:37:11] ╭─[conformance/statements/breakStatements/invalidWhileBreakStatements.ts:37:11]
36 │ while (true) { 36 │ while (true) {
37 │ break NINE; 37 │ break NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
38 │ } 38 │ }
╰──── ╰────
@ -19163,8 +19121,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts:11:13] ╭─[conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts:11:13]
10 │ ONE: 10 │ ONE:
11 │ do continue TWO; while (true) 11 │ do continue TWO; while (true)
· ─┬─ · ───
· ╰── This label is used, but not defined
12 │ 12 │
╰──── ╰────
@ -19180,8 +19137,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts:30:14] ╭─[conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts:30:14]
29 │ do { 29 │ do {
30 │ continue FIVE; 30 │ continue FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
31 │ FIVE: 31 │ FIVE:
╰──── ╰────
@ -19189,8 +19145,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts:40:14] ╭─[conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts:40:14]
39 │ do { 39 │ do {
40 │ continue NINE; 40 │ continue NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
41 │ }while (true) 41 │ }while (true)
╰──── ╰────
@ -19207,8 +19162,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidForContinueStatements.ts:11:18] ╭─[conformance/statements/continueStatements/invalidForContinueStatements.ts:11:18]
10 │ ONE: 10 │ ONE:
11 │ for(;;) continue TWO; 11 │ for(;;) continue TWO;
· ─┬─ · ───
· ╰── This label is used, but not defined
12 │ 12 │
╰──── ╰────
@ -19224,8 +19178,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidForContinueStatements.ts:30:14] ╭─[conformance/statements/continueStatements/invalidForContinueStatements.ts:30:14]
29 │ for(;;) { 29 │ for(;;) {
30 │ continue FIVE; 30 │ continue FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
31 │ FIVE: 31 │ FIVE:
╰──── ╰────
@ -19233,8 +19186,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidForContinueStatements.ts:39:14] ╭─[conformance/statements/continueStatements/invalidForContinueStatements.ts:39:14]
38 │ for(;;) { 38 │ for(;;) {
39 │ continue NINE; 39 │ continue NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
40 │ } 40 │ }
╰──── ╰────
@ -19251,8 +19203,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidForInContinueStatements.ts:11:28] ╭─[conformance/statements/continueStatements/invalidForInContinueStatements.ts:11:28]
10 │ ONE: 10 │ ONE:
11 │ for (var x in {}) continue TWO; 11 │ for (var x in {}) continue TWO;
· ─┬─ · ───
· ╰── This label is used, but not defined
12 │ 12 │
╰──── ╰────
@ -19268,8 +19219,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidForInContinueStatements.ts:30:14] ╭─[conformance/statements/continueStatements/invalidForInContinueStatements.ts:30:14]
29 │ for (var x in {}) { 29 │ for (var x in {}) {
30 │ continue FIVE; 30 │ continue FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
31 │ FIVE: 31 │ FIVE:
╰──── ╰────
@ -19277,8 +19227,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidForInContinueStatements.ts:40:14] ╭─[conformance/statements/continueStatements/invalidForInContinueStatements.ts:40:14]
39 │ for (var x in {}) { 39 │ for (var x in {}) {
40 │ continue NINE; 40 │ continue NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
41 │ } 41 │ }
╰──── ╰────
@ -19304,8 +19253,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidWhileContinueStatements.ts:11:23] ╭─[conformance/statements/continueStatements/invalidWhileContinueStatements.ts:11:23]
10 │ ONE: 10 │ ONE:
11 │ while (true) continue TWO; 11 │ while (true) continue TWO;
· ─┬─ · ───
· ╰── This label is used, but not defined
12 │ 12 │
╰──── ╰────
@ -19321,8 +19269,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidWhileContinueStatements.ts:30:14] ╭─[conformance/statements/continueStatements/invalidWhileContinueStatements.ts:30:14]
29 │ while (true) { 29 │ while (true) {
30 │ continue FIVE; 30 │ continue FIVE;
· ──┬─ · ────
· ╰── This label is used, but not defined
31 │ FIVE: 31 │ FIVE:
╰──── ╰────
@ -19330,8 +19277,7 @@ Expect to Parse: "conformance/salsa/plainJSRedeclare3.ts"
╭─[conformance/statements/continueStatements/invalidWhileContinueStatements.ts:40:14] ╭─[conformance/statements/continueStatements/invalidWhileContinueStatements.ts:40:14]
39 │ while (true) { 39 │ while (true) {
40 │ continue NINE; 40 │ continue NINE;
· ──┬─ · ────
· ╰── This label is used, but not defined
41 │ } 41 │ }
╰──── ╰────

View file

@ -1,4 +1,4 @@
Passed: 302/362 Passed: 304/362
# All Passed: # All Passed:
* babel-preset-react * babel-preset-react
@ -63,10 +63,8 @@ Passed: 302/362
* optimize-const-enums/merged-exported/input.ts * optimize-const-enums/merged-exported/input.ts
* regression/15768/input.ts * regression/15768/input.ts
# babel-plugin-transform-react-jsx (139/143) # babel-plugin-transform-react-jsx (141/143)
* autoImport/complicated-scope-module/input.js * autoImport/complicated-scope-module/input.js
* react/should-disallow-valueless-key/input.js
* react-automatic/should-disallow-valueless-key/input.js
* react-automatic/should-throw-when-filter-is-specified/input.js * react-automatic/should-throw-when-filter-is-specified/input.js
# babel-plugin-transform-react-jsx-self (2/3) # babel-plugin-transform-react-jsx-self (2/3)