Disallow expression with type parameters as left side of property access#49464
Disallow expression with type parameters as left side of property access#49464jakebailey merged 8 commits intomicrosoft:mainfrom
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
| "category": "Message", | ||
| "code": 1476 | ||
| }, | ||
| "Instantiation expression cannot be followed by property access.": { |
There was a problem hiding this comment.
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