From bcbf396bb25bd1e73913f9c5fcbb3753d9f5e158 Mon Sep 17 00:00:00 2001 From: camc314 <18101008+camc314@users.noreply.github.com> Date: Sun, 25 Jan 2026 19:28:52 +0000 Subject: [PATCH] feat(semantic): add TS1052 code to diagnostic (#18538) https://github.com/microsoft/typescript/blob/7affa9e5403035b6d281616e6651529e7387f253/src/compiler/diagnosticMessages.json#L154-L157 --- crates/oxc_parser/src/diagnostics.rs | 2 +- tasks/coverage/snapshots/parser_typescript.snap | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/oxc_parser/src/diagnostics.rs b/crates/oxc_parser/src/diagnostics.rs index fb507095e0a1c..255618b048ad2 100644 --- a/crates/oxc_parser/src/diagnostics.rs +++ b/crates/oxc_parser/src/diagnostics.rs @@ -1137,7 +1137,7 @@ pub fn setter_with_rest_parameter(span: Span) -> OxcDiagnostic { } #[cold] pub fn setter_with_initializer(span: Span) -> OxcDiagnostic { - OxcDiagnostic::error("A 'set' accessor cannot have an initializer.").with_label(span) + ts_error("1052", "A 'set' accessor cannot have an initializer.").with_label(span) } #[cold] diff --git a/tasks/coverage/snapshots/parser_typescript.snap b/tasks/coverage/snapshots/parser_typescript.snap index 8e6e1ee2daabe..714154371a5ab 100644 --- a/tasks/coverage/snapshots/parser_typescript.snap +++ b/tasks/coverage/snapshots/parser_typescript.snap @@ -2478,7 +2478,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: No modifiers are allowed here. - × A 'set' accessor cannot have an initializer. + × TS(1052): A 'set' accessor cannot have an initializer. ╭─[typescript/tests/cases/compiler/accessorWithInitializer.ts:2:10] 1 │ class C { 2 │ set X(v = 0) { } @@ -2486,7 +2486,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va 3 │ static set X(v2 = 0) { } ╰──── - × A 'set' accessor cannot have an initializer. + × TS(1052): A 'set' accessor cannot have an initializer. ╭─[typescript/tests/cases/compiler/accessorWithInitializer.ts:3:17] 2 │ set X(v = 0) { } 3 │ static set X(v2 = 0) { } @@ -22521,7 +22521,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: No modifiers are allowed here. - × A 'set' accessor cannot have an initializer. + × TS(1052): A 'set' accessor cannot have an initializer. ╭─[typescript/tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration16.ts:2:11] 1 │ class C { 2 │ set Foo(a = 1) { }