-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(compiler): Update type check block to fix control flow source mappings #53980
Conversation
…pings The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988
initializer = ts.factory.createAsExpression( | ||
initializer, ts.factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword)); | ||
} | ||
const initializer: ts.Expression = ts.factory.createAsExpression( |
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.
If we're going to cast for all cases, should we just not pass the type
in createVariableDeclaration
? E.g. const _t1 = null! as Foo
instead of const _t1: Foo = null! as Foo
.
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.
Yea, so I also had this thought and it mostly works. The problem is with the "find references" operation. If I find references for Foo
, instead of getting the variable t1
, I get the type assertion. This makes it difficult to get the correct source map for the variable. It's technically possible, but would require some adjustments in logic for references that I'm not sure is worth it. I'll add a comment about this because Alex had the same question.
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 don't feel strongly about it, but I'm concerned if it won't have any impact on type checking performance.
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.
Okay, I added a fixup commit to adjust the references code to account for this. Let me know how you feel about it.
bec11c7
to
75781cc
Compare
1bd5da6
to
3d2da2e
Compare
…pings (#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close #53980
This PR was merged into the repository by commit eddf5da. |
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
…pings (angular#53980) The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information. fixes angular/vscode-ng-language-service#1988 PR Close angular#53980
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The source mappings and types for various pieces of the control flow were not quite right and prevented the language service from providing accurate information.
fixes angular/vscode-ng-language-service#1988