diff --git a/crates/oxc_parser/src/diagnostics.rs b/crates/oxc_parser/src/diagnostics.rs index 180bd0f5d02f1..47d6131f5059a 100644 --- a/crates/oxc_parser/src/diagnostics.rs +++ b/crates/oxc_parser/src/diagnostics.rs @@ -197,7 +197,7 @@ pub fn unterminated_string(span: Span) -> OxcDiagnostic { #[cold] pub fn reg_exp_flag(x0: char, span1: Span) -> OxcDiagnostic { - OxcDiagnostic::error(format!("Unexpected flag {x0} in regular expression literal")) + ts_error("1499", format!("Unexpected flag {x0} in regular expression literal")) .with_label(span1) .with_help(format!("The allowed flags are `{REGEXP_FLAGS_LIST}`")) } diff --git a/tasks/coverage/snapshots/parser_test262.snap b/tasks/coverage/snapshots/parser_test262.snap index 3e4dbadfd03e7..4f35e098a1989 100644 --- a/tasks/coverage/snapshots/parser_test262.snap +++ b/tasks/coverage/snapshots/parser_test262.snap @@ -23220,7 +23220,7 @@ Negative Passed: 4581/4581 (100.00%) ╰──── help: Valid modifiers are: i, m, s - × Unexpected flag G in regular expression literal + × TS(1499): Unexpected flag G in regular expression literal ╭─[test262/test/language/literals/regexp/early-err-bad-flag.js:19:4] 18 │ 19 │ /./G; diff --git a/tasks/coverage/snapshots/parser_typescript.snap b/tasks/coverage/snapshots/parser_typescript.snap index ff84556b1bc6f..3ce520af21f04 100644 --- a/tasks/coverage/snapshots/parser_typescript.snap +++ b/tasks/coverage/snapshots/parser_typescript.snap @@ -9993,7 +9993,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: Valid group names are: foo - × Unexpected flag a in regular expression literal + × TS(1499): Unexpected flag a in regular expression literal ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:11] 2 │ // Flags 3 │ /foo/visualstudiocode, @@ -10002,7 +10002,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: The allowed flags are `gimsuydv` - × Unexpected flag l in regular expression literal + × TS(1499): Unexpected flag l in regular expression literal ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:12] 2 │ // Flags 3 │ /foo/visualstudiocode, @@ -10020,7 +10020,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: Remove the duplicated flag here - × Unexpected flag t in regular expression literal + × TS(1499): Unexpected flag t in regular expression literal ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:14] 2 │ // Flags 3 │ /foo/visualstudiocode, @@ -10047,7 +10047,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: Remove the duplicated flag here - × Unexpected flag o in regular expression literal + × TS(1499): Unexpected flag o in regular expression literal ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:18] 2 │ // Flags 3 │ /foo/visualstudiocode, @@ -10056,7 +10056,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: The allowed flags are `gimsuydv` - × Unexpected flag c in regular expression literal + × TS(1499): Unexpected flag c in regular expression literal ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:19] 2 │ // Flags 3 │ /foo/visualstudiocode, @@ -10065,7 +10065,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: The allowed flags are `gimsuydv` - × Unexpected flag o in regular expression literal + × TS(1499): Unexpected flag o in regular expression literal ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:20] 2 │ // Flags 3 │ /foo/visualstudiocode, @@ -10083,7 +10083,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: Remove the duplicated flag here - × Unexpected flag e in regular expression literal + × TS(1499): Unexpected flag e in regular expression literal ╭─[typescript/tests/cases/compiler/regularExpressionScanning.ts:3:22] 2 │ // Flags 3 │ /foo/visualstudiocode, @@ -23009,7 +23009,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/statements/Va ╰──── help: Try inserting a semicolon here - × Unexpected flag a in regular expression literal + × TS(1499): Unexpected flag a in regular expression literal ╭─[typescript/tests/cases/conformance/parser/ecmascript5/RegularExpressions/parserRegularExpressionDivideAmbiguity3.ts:1:16] 1 │ if (1) /regexp/a.foo(); · ─