-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Provide User-Friendly Message for Extended Unicode Escapes in Regular Expressions in Non-Unicode Modes #58981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rbuckton
merged 5 commits into
microsoft:main
from
graphemecluster:regex-extended-escape
Jul 18, 2024
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4b274b3
Provide User-Friendly Message for Extended Unicode Escapes in Regular…
graphemecluster 7de4d00
Merge remote-tracking branch 'upstream/main' into regex-extended-escape
graphemecluster 115f5eb
Apply Baseline Change Due to #58982
graphemecluster b0ad38a
Apply Suggested Changes
graphemecluster b7ad90c
Rerun Test
graphemecluster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/regularExpressionExtendedUnicodeEscapes.errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| regularExpressionExtendedUnicodeEscapes.ts(2,3): error TS1538: Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set. | ||
| regularExpressionExtendedUnicodeEscapes.ts(2,13): error TS1538: Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set. | ||
|
|
||
|
|
||
| ==== regularExpressionExtendedUnicodeEscapes.ts (2 errors) ==== | ||
| const regexes: RegExp[] = [ | ||
| /\u{10000}[\u{10000}]/, | ||
| ~~~~~~~~~ | ||
| !!! error TS1538: Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set. | ||
| ~~~~~~~~~ | ||
| !!! error TS1538: Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set. | ||
| /\u{10000}[\u{10000}]/u, | ||
| /\u{10000}[\u{10000}]/v, | ||
| ]; | ||
|
|
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/regularExpressionExtendedUnicodeEscapes.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| //// [tests/cases/compiler/regularExpressionExtendedUnicodeEscapes.ts] //// | ||
|
|
||
| //// [regularExpressionExtendedUnicodeEscapes.ts] | ||
| const regexes: RegExp[] = [ | ||
| /\u{10000}[\u{10000}]/, | ||
| /\u{10000}[\u{10000}]/u, | ||
| /\u{10000}[\u{10000}]/v, | ||
| ]; | ||
|
|
||
|
|
||
| //// [regularExpressionExtendedUnicodeEscapes.js] | ||
| const regexes = [ | ||
| /\u{10000}[\u{10000}]/, | ||
| /\u{10000}[\u{10000}]/u, | ||
| /\u{10000}[\u{10000}]/v, | ||
| ]; |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/regularExpressionExtendedUnicodeEscapes.symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| //// [tests/cases/compiler/regularExpressionExtendedUnicodeEscapes.ts] //// | ||
|
|
||
| === regularExpressionExtendedUnicodeEscapes.ts === | ||
| const regexes: RegExp[] = [ | ||
| >regexes : Symbol(regexes, Decl(regularExpressionExtendedUnicodeEscapes.ts, 0, 5)) | ||
| >RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.regexp.d.ts, --, --) ... and 3 more) | ||
|
|
||
| /\u{10000}[\u{10000}]/, | ||
| /\u{10000}[\u{10000}]/u, | ||
| /\u{10000}[\u{10000}]/v, | ||
| ]; | ||
|
|
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/regularExpressionExtendedUnicodeEscapes.types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| //// [tests/cases/compiler/regularExpressionExtendedUnicodeEscapes.ts] //// | ||
|
|
||
| === regularExpressionExtendedUnicodeEscapes.ts === | ||
| const regexes: RegExp[] = [ | ||
| >regexes : RegExp[] | ||
| > : ^^^^^^^^ | ||
| >[ /\u{10000}[\u{10000}]/, /\u{10000}[\u{10000}]/u, /\u{10000}[\u{10000}]/v,] : RegExp[] | ||
| > : ^^^^^^^^ | ||
|
|
||
| /\u{10000}[\u{10000}]/, | ||
| >/\u{10000}[\u{10000}]/ : RegExp | ||
| > : ^^^^^^ | ||
|
|
||
| /\u{10000}[\u{10000}]/u, | ||
| >/\u{10000}[\u{10000}]/u : RegExp | ||
| > : ^^^^^^ | ||
|
|
||
| /\u{10000}[\u{10000}]/v, | ||
| >/\u{10000}[\u{10000}]/v : RegExp | ||
| > : ^^^^^^ | ||
|
|
||
| ]; | ||
|
|
6 changes: 6 additions & 0 deletions
6
tests/cases/compiler/regularExpressionExtendedUnicodeEscapes.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // @target: esnext | ||
| const regexes: RegExp[] = [ | ||
| /\u{10000}[\u{10000}]/, | ||
| /\u{10000}[\u{10000}]/u, | ||
| /\u{10000}[\u{10000}]/v, | ||
| ]; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.