Skip to content
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

String#matchAll should return iterable of RegExpExecArray (fixes #36788) #55565

Merged
merged 2 commits into from Nov 30, 2023
Merged

String#matchAll should return iterable of RegExpExecArray (fixes #36788) #55565

merged 2 commits into from Nov 30, 2023

Conversation

nihil-admirari
Copy link
Contributor

Fixes #36788.

matchAll accepts only global RegExps and thus, if it didn't throw, it always returns RegExpExecArray with non-optional index and input.

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll#return_value.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Aug 29, 2023
@nihil-admirari
Copy link
Contributor Author

@microsoft-github-policy-service agree

@jakebailey
Copy link
Member

@typescript-bot test this
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 29, 2023

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at d0be0cd. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 29, 2023

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at d0be0cd. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 29, 2023

Heya @jakebailey, I've started to run the tsc-only perf test suite on this PR at d0be0cd. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 29, 2023

Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at d0be0cd. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparing main and refs/pull/55565/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"
  • 2 instances of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

rxjs-src

/mnt/ts_downloads/rxjs-src/build.sh

  • [NEW] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-55565/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
  • [MISSING] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(62,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v16.17.1, x64)
Memory used 300,268k (± 0.00%) 300,284k (± 0.01%) ~ 300,256k 300,302k p=0.230 n=6
Parse Time 3.01s (± 0.18%) 3.00s (± 0.34%) ~ 2.99s 3.02s p=0.663 n=6
Bind Time 0.93s (± 0.00%) 0.93s (± 0.44%) ~ 0.92s 0.93s p=0.405 n=6
Check Time 9.30s (± 0.24%) 9.32s (± 0.43%) ~ 9.27s 9.38s p=0.627 n=6
Emit Time 7.62s (± 0.33%) 7.64s (± 0.39%) ~ 7.60s 7.68s p=0.332 n=6
Total Time 20.86s (± 0.21%) 20.89s (± 0.28%) ~ 20.80s 20.95s p=0.335 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 193,960k (± 0.01%) 194,434k (± 0.68%) ~ 193,870k 197,124k p=0.173 n=6
Parse Time 1.58s (± 0.00%) 1.58s (± 0.00%) ~ 1.58s 1.58s p=1.000 n=6
Bind Time 0.80s (± 0.65%) 0.80s (± 0.65%) ~ 0.79s 0.80s p=1.000 n=6
Check Time 9.96s (± 0.43%) 9.92s (± 0.36%) ~ 9.87s 9.96s p=0.169 n=6
Emit Time 2.74s (± 0.15%) 2.73s (± 0.20%) ~ 2.73s 2.74s p=0.282 n=6
Total Time 15.07s (± 0.29%) 15.03s (± 0.23%) ~ 14.98s 15.07s p=0.108 n=6
Monaco - node (v16.17.1, x64)
Memory used 347,195k (± 0.00%) 347,172k (± 0.01%) ~ 347,103k 347,193k p=0.336 n=6
Parse Time 2.69s (± 0.30%) 2.69s (± 0.43%) ~ 2.68s 2.71s p=1.000 n=6
Bind Time 0.99s (± 0.00%) 0.99s (± 0.00%) ~ 0.99s 0.99s p=1.000 n=6
Check Time 7.96s (± 1.16%) 7.93s (± 0.33%) ~ 7.89s 7.96s p=0.936 n=6
Emit Time 4.27s (± 0.37%) 4.27s (± 0.45%) ~ 4.24s 4.29s p=1.000 n=6
Total Time 15.91s (± 0.68%) 15.87s (± 0.23%) ~ 15.83s 15.92s p=0.872 n=6
TFS - node (v16.17.1, x64)
Memory used 301,167k (± 0.01%) 301,180k (± 0.00%) ~ 301,169k 301,186k p=0.173 n=6
Parse Time 2.17s (± 0.50%) 2.18s (± 0.73%) ~ 2.15s 2.20s p=0.322 n=6
Bind Time 1.11s (± 0.46%) 1.09s (± 5.72%) ~ 0.96s 1.12s p=0.386 n=6
Check Time 7.24s (± 0.29%) 7.21s (± 0.34%) ~ 7.17s 7.24s p=0.107 n=6
Emit Time 3.98s (± 0.42%) 3.98s (± 0.27%) ~ 3.97s 4.00s p=1.000 n=6
Total Time 14.51s (± 0.19%) 14.46s (± 0.62%) ~ 14.29s 14.55s p=0.224 n=6
material-ui - node (v16.17.1, x64)
Memory used 479,475k (± 0.00%) 479,471k (± 0.00%) ~ 479,448k 479,494k p=0.689 n=6
Parse Time 3.15s (± 0.24%) 3.15s (± 0.24%) ~ 3.14s 3.16s p=1.000 n=6
Bind Time 0.91s (± 0.00%) 0.91s (± 0.00%) ~ 0.91s 0.91s p=1.000 n=6
Check Time 17.81s (± 0.53%) 17.80s (± 0.41%) ~ 17.68s 17.88s p=0.748 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 21.87s (± 0.44%) 21.86s (± 0.35%) ~ 21.73s 21.94s p=0.872 n=6
xstate - node (v16.17.1, x64)
Memory used 542,895k (± 0.02%) 542,802k (± 0.01%) ~ 542,704k 542,851k p=0.066 n=6
Parse Time 3.70s (± 0.17%) 3.69s (± 0.40%) ~ 3.67s 3.71s p=0.156 n=6
Bind Time 1.42s (± 4.20%) 1.46s (± 0.38%) ~ 1.45s 1.46s p=0.341 n=6
Check Time 3.22s (± 2.84%) 3.16s (± 0.89%) ~ 3.13s 3.20s p=0.293 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 4.99%) ~ 0.08s 0.09s p=0.405 n=6
Total Time 8.42s (± 0.46%) 8.38s (± 0.38%) ~ 8.35s 8.44s p=0.050 n=6
System info unknown
Hosts
  • node (v16.17.1, x64)
Scenarios
  • Angular - node (v16.17.1, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Monaco - node (v16.17.1, x64)
  • TFS - node (v16.17.1, x64)
  • material-ui - node (v16.17.1, x64)
  • xstate - node (v16.17.1, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/55565/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.
There were interesting changes:

Branch only errors:

Package: string.prototype.matchall
Error:

Error: /home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/DefinitelyTyped/types/string.prototype.matchall/string.prototype.matchall-tests.ts:11:1
ERROR: 11:1  expect  TypeScript@local expected type to be:
  IterableIterator<RegExpMatchArray>
got:
  IterableIterator<RegExpExecArray>
ERROR: 12:1  expect  TypeScript@local expected type to be:
  IterableIterator<RegExpMatchArray>
got:
  IterableIterator<RegExpExecArray>

    at testTypesVersion (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:194:15)
    at async runTests (/home/vsts/work/1/s/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/@definitelytyped/dtslint/dist/index.js:151:9)

You can check the log here.

@nihil-admirari
Copy link
Contributor Author

@jakebailey, sorry, I'm new here. Where string.prototype.matchall-tests.ts is located?

@jakebailey
Copy link
Member

That's over in https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/string.prototype.matchall

This is somewhat an expected failure because that other package duplicated the type, so is going to need typesVersions to fix.

@nihil-admirari
Copy link
Contributor Author

I've made a pull request to DefinitelyTyped but it's failing the tests and it'll continue to fail unless this pull request is merged.

@sandersn sandersn added this to Not started in PR Backlog Sep 6, 2023
@sandersn sandersn moved this from Not started to Waiting on reviewers in PR Backlog Sep 7, 2023
PR Backlog automation moved this from Waiting on reviewers to Needs merge Oct 4, 2023
@DanielRosenwasser
Copy link
Member

I think we can take this in post-beta. Thoughts @sandersn?

@sandersn
Copy link
Member

sandersn commented Oct 9, 2023

It seems quite safe for a change to the stdlib, since it's only in es2020 and above.
I'm OK with merging it if you're OK with shipping a point release to revert it if needed!

@sandersn sandersn merged commit fd74874 into microsoft:main Nov 30, 2023
19 checks passed
PR Backlog automation moved this from Needs merge to Done Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
PR Backlog
  
Done
Development

Successfully merging this pull request may close these issues.

String#matchAll should return iterable of RegExpExecArray instead of RegExpMatchArray
6 participants