-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Fixed a crash caused by circularly-reentrant getEffectsSignature
#63026
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
gabritto
merged 7 commits into
microsoft:main
from
Andarist:fix/reentrant-getEffectsSignature
Feb 2, 2026
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b23740c
Fixed a crash caused by circularly-reentrant `getEffectsSignature`
Andarist 3c573f7
Merge remote-tracking branch 'origin/main' into fix/reentrant-getEffe…
Andarist 9579094
bring back IsControlFlowContainer
Andarist 8298766
PropagatesThisKeyword
Andarist 3d83c8c
Merge remote-tracking branch 'origin/main' into fix/reentrant-getEffe…
Andarist bf335f5
oops, remove the old fix
Andarist 11bec36
Merge remote-tracking branch 'origin/main' into fix/reentrant-getEffe…
Andarist 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
52 changes: 52 additions & 0 deletions
52
tests/baselines/reference/controlFlowForFunctionLike1.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,52 @@ | ||
| controlFlowForFunctionLike1.ts(10,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. | ||
| controlFlowForFunctionLike1.ts(31,10): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. | ||
|
|
||
|
|
||
| ==== controlFlowForFunctionLike1.ts (2 errors) ==== | ||
| function test1(a: number | string) { | ||
| if (typeof a === "number") { | ||
| const fn = (arg: typeof a) => true; | ||
| return fn; | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| test1(0)?.(100); | ||
| test1(0)?.(""); | ||
| ~~ | ||
| !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. | ||
|
|
||
| function test2(a: number | string) { | ||
| if (typeof a === "number") { | ||
| const fn: { (arg: typeof a): boolean; } = () => true; | ||
| return fn; | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| test2(0)?.(100); | ||
| test2(0)?.(""); | ||
|
|
||
| function test3(a: number | string) { | ||
| if (typeof a === "number") { | ||
| return (arg: typeof a) => {}; | ||
| } | ||
| throw new Error(""); | ||
| } | ||
|
|
||
| test3(1)(100); | ||
| test3(1)(""); | ||
| ~~ | ||
| !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. | ||
|
|
||
| function test4(a: number | string) { | ||
| let fn = (arg: typeof a) => {}; | ||
| if (Math.random() && typeof a === "number") { | ||
| return fn; | ||
| } | ||
| throw new Error(""); | ||
| } | ||
|
|
||
| test4(1)?.(100); | ||
| test4(1)?.(""); | ||
|
|
100 changes: 100 additions & 0 deletions
100
tests/baselines/reference/controlFlowForFunctionLike1.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,100 @@ | ||
| //// [tests/cases/compiler/controlFlowForFunctionLike1.ts] //// | ||
|
|
||
| === controlFlowForFunctionLike1.ts === | ||
| function test1(a: number | string) { | ||
| >test1 : Symbol(test1, Decl(controlFlowForFunctionLike1.ts, 0, 0)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 0, 15)) | ||
|
|
||
| if (typeof a === "number") { | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 0, 15)) | ||
|
|
||
| const fn = (arg: typeof a) => true; | ||
| >fn : Symbol(fn, Decl(controlFlowForFunctionLike1.ts, 2, 9)) | ||
| >arg : Symbol(arg, Decl(controlFlowForFunctionLike1.ts, 2, 16)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 0, 15)) | ||
|
|
||
| return fn; | ||
| >fn : Symbol(fn, Decl(controlFlowForFunctionLike1.ts, 2, 9)) | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| test1(0)?.(100); | ||
| >test1 : Symbol(test1, Decl(controlFlowForFunctionLike1.ts, 0, 0)) | ||
|
|
||
| test1(0)?.(""); | ||
| >test1 : Symbol(test1, Decl(controlFlowForFunctionLike1.ts, 0, 0)) | ||
|
|
||
| function test2(a: number | string) { | ||
| >test2 : Symbol(test2, Decl(controlFlowForFunctionLike1.ts, 9, 15)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 11, 15)) | ||
|
|
||
| if (typeof a === "number") { | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 11, 15)) | ||
|
|
||
| const fn: { (arg: typeof a): boolean; } = () => true; | ||
| >fn : Symbol(fn, Decl(controlFlowForFunctionLike1.ts, 13, 9)) | ||
| >arg : Symbol(arg, Decl(controlFlowForFunctionLike1.ts, 13, 17)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 11, 15)) | ||
|
|
||
| return fn; | ||
| >fn : Symbol(fn, Decl(controlFlowForFunctionLike1.ts, 13, 9)) | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| test2(0)?.(100); | ||
| >test2 : Symbol(test2, Decl(controlFlowForFunctionLike1.ts, 9, 15)) | ||
|
|
||
| test2(0)?.(""); | ||
| >test2 : Symbol(test2, Decl(controlFlowForFunctionLike1.ts, 9, 15)) | ||
|
|
||
| function test3(a: number | string) { | ||
| >test3 : Symbol(test3, Decl(controlFlowForFunctionLike1.ts, 20, 15)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 22, 15)) | ||
|
|
||
| if (typeof a === "number") { | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 22, 15)) | ||
|
|
||
| return (arg: typeof a) => {}; | ||
| >arg : Symbol(arg, Decl(controlFlowForFunctionLike1.ts, 24, 12)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 22, 15)) | ||
| } | ||
| throw new Error(""); | ||
| >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) | ||
| } | ||
|
|
||
| test3(1)(100); | ||
| >test3 : Symbol(test3, Decl(controlFlowForFunctionLike1.ts, 20, 15)) | ||
|
|
||
| test3(1)(""); | ||
| >test3 : Symbol(test3, Decl(controlFlowForFunctionLike1.ts, 20, 15)) | ||
|
|
||
| function test4(a: number | string) { | ||
| >test4 : Symbol(test4, Decl(controlFlowForFunctionLike1.ts, 30, 13)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 32, 15)) | ||
|
|
||
| let fn = (arg: typeof a) => {}; | ||
| >fn : Symbol(fn, Decl(controlFlowForFunctionLike1.ts, 33, 5)) | ||
| >arg : Symbol(arg, Decl(controlFlowForFunctionLike1.ts, 33, 12)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 32, 15)) | ||
|
|
||
| if (Math.random() && typeof a === "number") { | ||
| >Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
| >Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
| >random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
| >a : Symbol(a, Decl(controlFlowForFunctionLike1.ts, 32, 15)) | ||
|
|
||
| return fn; | ||
| >fn : Symbol(fn, Decl(controlFlowForFunctionLike1.ts, 33, 5)) | ||
| } | ||
| throw new Error(""); | ||
| >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2022.error.d.ts, --, --)) | ||
| } | ||
|
|
||
| test4(1)?.(100); | ||
| >test4 : Symbol(test4, Decl(controlFlowForFunctionLike1.ts, 30, 13)) | ||
|
|
||
| test4(1)?.(""); | ||
| >test4 : Symbol(test4, Decl(controlFlowForFunctionLike1.ts, 30, 13)) | ||
|
|
Oops, something went wrong.
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.