Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
make
RegExpExecArray
always include index 0 (#50713)
* make `RegExpExecArray` always include index 0 * update baseline * remove `BaseRegExpArray` interface * add test Co-authored-by: DetachHead <detachhead@users.noreply.github.com>
- Loading branch information
1 parent
01cae69
commit 2970c5d
Showing
31 changed files
with
671 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
28 changes: 28 additions & 0 deletions
28
tests/baselines/reference/regexpExecAndMatchTypeUsages(strict=false).errors.txt
This file contains 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,28 @@ | ||
error TS5052: Option 'exactOptionalPropertyTypes' cannot be specified without specifying option 'strictNullChecks'. | ||
|
||
|
||
!!! error TS5052: Option 'exactOptionalPropertyTypes' cannot be specified without specifying option 'strictNullChecks'. | ||
==== tests/cases/compiler/regexpExecAndMatchTypeUsages.ts (0 errors) ==== | ||
export function foo(matchResult: RegExpExecArray, execResult: RegExpExecArray) { | ||
matchResult[0].length; | ||
matchResult[999].length; | ||
matchResult.index + 0; | ||
matchResult.input.length; | ||
matchResult.groups["someVariable"].length; | ||
matchResult.groups = undefined; | ||
|
||
execResult[0].length; | ||
execResult[999].length; | ||
execResult.index + 0; | ||
execResult.input.length; | ||
execResult.groups["someVariable"].length; | ||
execResult.groups = undefined; | ||
|
||
if (Math.random()) { | ||
matchResult = execResult; | ||
} | ||
else { | ||
execResult = matchResult | ||
} | ||
} | ||
|
50 changes: 50 additions & 0 deletions
50
tests/baselines/reference/regexpExecAndMatchTypeUsages(strict=false).js
This file contains 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,50 @@ | ||
//// [regexpExecAndMatchTypeUsages.ts] | ||
export function foo(matchResult: RegExpExecArray, execResult: RegExpExecArray) { | ||
matchResult[0].length; | ||
matchResult[999].length; | ||
matchResult.index + 0; | ||
matchResult.input.length; | ||
matchResult.groups["someVariable"].length; | ||
matchResult.groups = undefined; | ||
|
||
execResult[0].length; | ||
execResult[999].length; | ||
execResult.index + 0; | ||
execResult.input.length; | ||
execResult.groups["someVariable"].length; | ||
execResult.groups = undefined; | ||
|
||
if (Math.random()) { | ||
matchResult = execResult; | ||
} | ||
else { | ||
execResult = matchResult | ||
} | ||
} | ||
|
||
|
||
//// [regexpExecAndMatchTypeUsages.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.foo = void 0; | ||
function foo(matchResult, execResult) { | ||
matchResult[0].length; | ||
matchResult[999].length; | ||
matchResult.index + 0; | ||
matchResult.input.length; | ||
matchResult.groups["someVariable"].length; | ||
matchResult.groups = undefined; | ||
execResult[0].length; | ||
execResult[999].length; | ||
execResult.index + 0; | ||
execResult.input.length; | ||
execResult.groups["someVariable"].length; | ||
execResult.groups = undefined; | ||
if (Math.random()) { | ||
matchResult = execResult; | ||
} | ||
else { | ||
execResult = matchResult; | ||
} | ||
} | ||
exports.foo = foo; |
Oops, something went wrong.