-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Disallow expression with type parameters as left side of property access #49464
Conversation
This PR now uses the grammar check functionality in the checker rather than the parser as we discussed in the design meeting, however, I don't think that this is working how I'd desire.
|
src/compiler/diagnosticMessages.json
Outdated
@@ -1493,6 +1493,10 @@ | |||
"category": "Message", | |||
"code": 1476 | |||
}, | |||
"Instantiation expression cannot be followed by property access.": { |
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.
Should this instead complain on the type arguments and say they should be removed? And quickfix?
I made the change I prefer in #49645 to show the difference. See: |
Can you remind me why we decided to make this a grammar check? |
This was the suggestion by @ahejlsberg, as a potentially better recovery method. But, I think #49645's method here is better; the tree is the same in both cases, but it correctly fires when it's done in the parser (whereas grammar checks do not always fire). |
Updated to be in the parser, and to move the error message onto the type parameters. |
@typescript-bot cherry-pick this to release-4.7 |
Heya @jakebailey, I've started to run the task to cherry-pick this into |
Hey @jakebailey, I couldn't open a PR with the cherry-pick. (You can check the log here). You may need to squash and pick this PR into release-4.7 manually. |
Fixes #49293