-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Allow assignments to a narrowable reference to be considered narrowable #39824
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
Conversation
@typescript-bot perf test |
Heya @rbuckton, I've started to run the perf test suite on this PR at b9db641. You can monitor the build here. Update: The results are in! |
@rbuckton Here they are:Comparison Report - master..39824
System
Hosts
Scenarios
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
@typescript-bot user test this |
@typescript-bot user test this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the changes in dbg.ts are just orthogonal, yes?
The changes in dbg.ts were to fix a circular reference issue that I found while I was investigating the control flow graphs of the original issue and aren't directly related to this fix. |
@ahejlsberg any other feedback? I'd like to get this in for 4.0.1 if its an acceptable change as this issue has already been rescheduled several times. |
This modifies control flow to consider an assignment to be narrowable if the assignment target is a narrowable reference.
Given:
Prior to this fix,
o.value
inA
had the type1
buto.value
inB
had the type1 | 2
because we did not consider(o = f())
to be narrowable.This also fixes some discrepancies in the control flow graph formatter used for debugging to handle circular references in loops.
Fixes #35484