Skip to content

Fix crash caused by incorrect bounds check (regression in 4.8)#50797

Merged
ahejlsberg merged 2 commits intomainfrom
fix50479
Sep 16, 2022
Merged

Fix crash caused by incorrect bounds check (regression in 4.8)#50797
ahejlsberg merged 2 commits intomainfrom
fix50479

Conversation

@ahejlsberg
Copy link
Copy Markdown
Member

Fixes #50479.

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Sep 15, 2022
@ahejlsberg
Copy link
Copy Markdown
Member Author

@andrewbranch @DanielRosenwasser We'll want this one in 4.8.4.

@andrewbranch
Copy link
Copy Markdown
Member

@typescript-bot cherry-pick this to release-4.8

@typescript-bot
Copy link
Copy Markdown
Collaborator

typescript-bot commented Sep 16, 2022

Heya @andrewbranch, I've started to run the task to cherry-pick this into release-4.8 on this PR at 23784d7. You can monitor the build here.

@typescript-bot
Copy link
Copy Markdown
Collaborator

Hey @andrewbranch, I've opened #50798 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Sep 16, 2022
Component commits:
23a1dd4 Fix bounds check

23784d7 Add regression test
@ahejlsberg ahejlsberg merged commit 3b84f76 into main Sep 16, 2022
@ahejlsberg ahejlsberg deleted the fix50479 branch September 16, 2022 14:14
andrewbranch pushed a commit that referenced this pull request Sep 16, 2022
Component commits:
23a1dd4 Fix bounds check

23784d7 Add regression test

Co-authored-by: Anders Hejlsberg <[email protected]>
@Ayc0
Copy link
Copy Markdown

Ayc0 commented Sep 23, 2022

Thanks for the fix!
Do you know if this will be deployed with the 4.8.4 or if it'll be with the next 4.9.x?

@ahejlsberg
Copy link
Copy Markdown
Member Author

The fix will be in 4.8.4.

@Ayc0
Copy link
Copy Markdown

Ayc0 commented Sep 23, 2022

Thanks 🙏

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Jan 12, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [typescript](https://www.typescriptlang.org/) ([source](https://github.com/Microsoft/TypeScript)) | devDependencies | minor | [`4.8.4` -> `4.9.4`](https://renovatebot.com/diffs/npm/typescript/4.8.4/4.9.4) |

---

### Release Notes

<details>
<summary>Microsoft/TypeScript</summary>

### [`v4.9.4`](https://github.com/microsoft/TypeScript/releases/tag/v4.9.4): TypeScript 4.9.4

[Compare Source](https://github.com/Microsoft/TypeScript/compare/v4.9.3...v4.9.4)

For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9).

For the complete list of fixed issues, check out the

-   [fixed issues query for Typescript v4.9.4](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=is%3Aissue+milestone%3A%22TypeScript+4.9.4%22+is%3Aclosed+).

Downloads are available on:

-   [npm](https://www.npmjs.com/package/typescript)
-   [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)

#### Changes:

-   [`e286821`](https://github.com/Microsoft/TypeScript/commit/e2868216f637e875a74c675845625eb15dcfe9a2) Bump version to 4.9.4 and LKG.
-   [`eb5419f`](https://github.com/Microsoft/TypeScript/commit/eb5419fc8d980859b98553586dfb5f40d811a745) Cherry-pick [#&#8203;51704](https://github.com/Microsoft/TypeScript/issues/51704) to release 4.9 ([#&#8203;51712](https://github.com/Microsoft/TypeScript/issues/51712))
-   [`b4d382b`](https://github.com/Microsoft/TypeScript/commit/b4d382b9b12460adf2da4cc0d1429cf19f8dc8be) Cherry-pick changes for narrowing to tagged literal types.
-   [`e7a02f4`](https://github.com/Microsoft/TypeScript/commit/e7a02f43fce47e1a39259ada5460bcc33c8e98b5) Port of [#&#8203;51626](https://github.com/Microsoft/TypeScript/issues/51626) and [#&#8203;51689](https://github.com/Microsoft/TypeScript/issues/51689) to release-4.9 ([#&#8203;51627](https://github.com/Microsoft/TypeScript/issues/51627))
-   [`1727912`](https://github.com/Microsoft/TypeScript/commit/1727912f0437a7f367d90040fc4b0b4f3efd017a) Cherry-pick fix around `visitEachChild` to release-4.9. ([#&#8203;51544](https://github.com/Microsoft/TypeScript/issues/51544))

This list of changes was [auto generated](https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/\_release?releaseId=117&\_a=release-summary).

### [`v4.9.3`](https://github.com/microsoft/TypeScript/releases/tag/v4.9.3): TypeScript 4.9

[Compare Source](https://github.com/Microsoft/TypeScript/compare/v4.8.4...v4.9.3)

For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/).

Downloads are available on:

-   [npm](https://www.npmjs.com/package/typescript)
-   [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)

#### Changes:

-   [`93bd577`](https://github.com/Microsoft/TypeScript/commit/93bd577458d55cd720b2677705feab5c91eb12ce) Bump version to 4.9.3 and LKG.
-   [`107f832`](https://github.com/Microsoft/TypeScript/commit/107f832b80df2dc97748021cb00af2b6813db75b) Update LKG.
-   [`31bee56`](https://github.com/Microsoft/TypeScript/commit/31bee5682df130a14ffdd5742f994dbe7313dd0e) Cherry-pick PR [#&#8203;50977](https://github.com/Microsoft/TypeScript/issues/50977) into release-4.9 ([#&#8203;51363](https://github.com/Microsoft/TypeScript/issues/51363)) \[ [#&#8203;50872](https://github.com/Microsoft/TypeScript/issues/50872) ]
-   [`1e2fa7a`](https://github.com/Microsoft/TypeScript/commit/1e2fa7ae15f8530910fef8b916ec8a4ed0b59c45) Update version to 4.9.2-rc and LKG.
-   [`7ab89e5`](https://github.com/Microsoft/TypeScript/commit/7ab89e5c6e401d161f31f28a6c555a3ba530910e) Merge remote-tracking branch 'origin/main' into release-4.9
-   [`e5cd686`](https://github.com/Microsoft/TypeScript/commit/e5cd686defb1a4cbdb36bd012357ba5bed28f371) Update package-lock.json
-   [`8d40dc1`](https://github.com/Microsoft/TypeScript/commit/8d40dc15d1b9945837e7860320fdccfe27c40cad) Update package-lock.json
-   [`5cfb3a2`](https://github.com/Microsoft/TypeScript/commit/5cfb3a2fe344a5350734305193e6cc99516285ca) Only call return() for an abrupt completion in user code ([#&#8203;51297](https://github.com/Microsoft/TypeScript/issues/51297))
-   [`a7a9d15`](https://github.com/Microsoft/TypeScript/commit/a7a9d158e817fcb0e94dc1c24e0a401b21be0cc9) Fix for broken baseline in yieldInForInInDownlevelGenerator ([#&#8203;51345](https://github.com/Microsoft/TypeScript/issues/51345))
-   [`7f8426f`](https://github.com/Microsoft/TypeScript/commit/7f8426f4df0d0a7dd8b72079dafc3e60164a23b1) fix for-in enumeration containing yield in generator ([#&#8203;51295](https://github.com/Microsoft/TypeScript/issues/51295))

<details><summary><b>See More</b></summary>

-   [`3d2b401`](https://github.com/Microsoft/TypeScript/commit/3d2b4017eb6b9a2b94bc673291e56ae95e8beddd) Fix assertion functions accessed via wildcard imports ([#&#8203;51324](https://github.com/Microsoft/TypeScript/issues/51324))
-   [`64d0d5a`](https://github.com/Microsoft/TypeScript/commit/64d0d5ae140b7b26a09e75114517b418d6bcaa9f) fix(51301): Fixing an unused import at the end of a line removes the newline ([#&#8203;51320](https://github.com/Microsoft/TypeScript/issues/51320))
-   [`754eeb2`](https://github.com/Microsoft/TypeScript/commit/754eeb2986bde30d5926e0fa99c87dda9266d01b) Update CodeQL workflow and configuration, fix found bugs ([#&#8203;51263](https://github.com/Microsoft/TypeScript/issues/51263))
-   [`d8aad26`](https://github.com/Microsoft/TypeScript/commit/d8aad262006ad2d2c91aa7a0e4449b4b83c57f7b) Update package-lock.json
-   [`d4f26c8`](https://github.com/Microsoft/TypeScript/commit/d4f26c840b1db76c0b25a405c8e73830a2b45cbc) fix(51245): Class with parameter decorator in arrow function causes "convert to default export" refactoring failure ([#&#8203;51256](https://github.com/Microsoft/TypeScript/issues/51256))
-   [`16faf45`](https://github.com/Microsoft/TypeScript/commit/16faf45682173ea437a50330feb4785578923d7f) Update package-lock.json
-   [`8b1ecdb`](https://github.com/Microsoft/TypeScript/commit/8b1ecdb701e2a2e19e9f8bcdd6b2beac087eabee) fix(50654): "Move to a new file" breaks the declaration of referenced variable ([#&#8203;50681](https://github.com/Microsoft/TypeScript/issues/50681))
-   [`170a17f`](https://github.com/Microsoft/TypeScript/commit/170a17fad57eae619c5ef2b7bdb3ac00d6c32c47) Dom update 2022-10-25 ([#&#8203;51300](https://github.com/Microsoft/TypeScript/issues/51300))
-   [`9c4e14d`](https://github.com/Microsoft/TypeScript/commit/9c4e14d75174432f6a4dc5967a09712a6784ab88) Remove "No type information for this code" from baseline ([#&#8203;51311](https://github.com/Microsoft/TypeScript/issues/51311))
-   [`88d25b4`](https://github.com/Microsoft/TypeScript/commit/88d25b4f232929df59729156dfda6b65277affec) fix(50068): Refactors trigger debug failure when JSX text has a ' and a tag on the same line. ([#&#8203;51299](https://github.com/Microsoft/TypeScript/issues/51299))
-   [`8bee69a`](https://github.com/Microsoft/TypeScript/commit/8bee69acf410d4986cb0cc102b949e2d133d5380) Update package-lock.json
-   [`702de1e`](https://github.com/Microsoft/TypeScript/commit/702de1eeaaef88a189e4d06e5a2aae287853790a) Fix early call to return/throw on generator ([#&#8203;51294](https://github.com/Microsoft/TypeScript/issues/51294))
-   [`2c12b14`](https://github.com/Microsoft/TypeScript/commit/2c12b1499908ad7718e65d20e264561207c22375) Add a GH Action to file a new issue if we go a week without seeing a typescript-error-deltas issue ([#&#8203;51271](https://github.com/Microsoft/TypeScript/issues/51271))
-   [`6af270d`](https://github.com/Microsoft/TypeScript/commit/6af270dee09d62516f6dc02ec102a745ffebc037) Update package-lock.json
-   [`2cc4c16`](https://github.com/Microsoft/TypeScript/commit/2cc4c16a26672a7ba6c97ba16309fcf334db7cae) Update package-lock.json
-   [`6093491`](https://github.com/Microsoft/TypeScript/commit/60934915d9ccc4ca9c0fb2cd060d7ec81601942b) Fix apparent typo in getStringMappingType ([#&#8203;51248](https://github.com/Microsoft/TypeScript/issues/51248))
-   [`61c2609`](https://github.com/Microsoft/TypeScript/commit/61c26096e3373719ece686b84c698423890e9a5f) Update package-lock.json
-   [`ef69116`](https://github.com/Microsoft/TypeScript/commit/ef69116c41cb6805f89e6592eacb0ccb7f02207d) Generate shortest `rootDirs` module specifier instead of first possible ([#&#8203;51244](https://github.com/Microsoft/TypeScript/issues/51244))
-   [`bbb42f4`](https://github.com/Microsoft/TypeScript/commit/bbb42f453dc684e03d977c5b70391124d57543a9) Fix typo in canWatchDirectoryOrFile found by CodeQL ([#&#8203;51262](https://github.com/Microsoft/TypeScript/issues/51262))
-   [`a56b254`](https://github.com/Microsoft/TypeScript/commit/a56b254ad3c52b598bc5d44f83f3d0a1cf806068) Include 'this' type parameter in isRelatedTo fast path ([#&#8203;51230](https://github.com/Microsoft/TypeScript/issues/51230))
-   [`3abd351`](https://github.com/Microsoft/TypeScript/commit/3abd351c0eea55758f27ee5558a4a1525b77f45b) Fix super property transform in async arrow in method ([#&#8203;51240](https://github.com/Microsoft/TypeScript/issues/51240))
-   [`eed0511`](https://github.com/Microsoft/TypeScript/commit/eed05112180e0d94f78aa02d676d49468f15dc31) Update package-lock.json
-   [`2625c1f`](https://github.com/Microsoft/TypeScript/commit/2625c1feae25aede35465ca835440fc57bf13d52) Make the init config category order predictable ([#&#8203;51247](https://github.com/Microsoft/TypeScript/issues/51247))
-   [`1ca99b3`](https://github.com/Microsoft/TypeScript/commit/1ca99b34029dafad2c18af7bdc0711f4abf7e522) fix(50551): Destructuring assignment with var bypasses "variable is used before being assigned" check (2454) ([#&#8203;50560](https://github.com/Microsoft/TypeScript/issues/50560))
-   [`3f28fa1`](https://github.com/Microsoft/TypeScript/commit/3f28fa12dfecb8dfd66ce4684bf26f64e1f092f1) Update package-lock.json
-   [`906ebe4`](https://github.com/Microsoft/TypeScript/commit/906ebe49334a3a9c2dbd73cd3c902898bc712b66) Revert structuredTypeRelatedTo change and fix isUnitLikeType ([#&#8203;51076](https://github.com/Microsoft/TypeScript/issues/51076))
-   [`8ac4652`](https://github.com/Microsoft/TypeScript/commit/8ac465239f52de1da3ada8cdc4c3f107f4d62e45) change type ([#&#8203;51231](https://github.com/Microsoft/TypeScript/issues/51231))
-   [`245a02c`](https://github.com/Microsoft/TypeScript/commit/245a02cbed7ad50a21289730159abc8d19a66f40) fix(51222): Go-to-definition on return statements should jump to the containing function declaration ([#&#8203;51227](https://github.com/Microsoft/TypeScript/issues/51227))
-   [`2dff34e`](https://github.com/Microsoft/TypeScript/commit/2dff34e8c4a91c0005ca9ccfb7e045e225b6f2e4) markAliasReferenced should include ExportValue as well ([#&#8203;51219](https://github.com/Microsoft/TypeScript/issues/51219))
-   [`5ef2634`](https://github.com/Microsoft/TypeScript/commit/5ef2634f3df138323383c7f2e5a05163a924ee86) Update package-lock.json
-   [`d0f0e35`](https://github.com/Microsoft/TypeScript/commit/d0f0e35c88ae017fc4c1213eb2f83303ee22ebde) Remove old tslint comments ([#&#8203;51220](https://github.com/Microsoft/TypeScript/issues/51220))
-   [`85d405a`](https://github.com/Microsoft/TypeScript/commit/85d405a1d74c0730a9d8d6307b26e8d6f3f75421) Fixed a false positive "await has no effect on the type" diagnostic with mixed generic union ([#&#8203;50833](https://github.com/Microsoft/TypeScript/issues/50833))
-   [`1f8959f`](https://github.com/Microsoft/TypeScript/commit/1f8959f5dc04b2b2c2fc8a7dc53b6ac761e1f754) fix: avoid downleveled dynamic import closing over specifier expression ([#&#8203;49663](https://github.com/Microsoft/TypeScript/issues/49663))
-   [`11066b2`](https://github.com/Microsoft/TypeScript/commit/11066b264f5d30fb5ac1f6c2f3a155c0190e75d2) Rename internal functions to `narrowTypeBySwitchOnTypeOf` and `narrowTypeByInKeyword` ([#&#8203;51215](https://appwritefunc.yet-another-testing-domain.com/api/grab?url=https: