Skip to content
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(49223): checker.getTypeAtLocation for ExpressionWithTypeArguments returns an error any type #49284

Merged
merged 3 commits into from
Jun 3, 2022

Conversation

a-tarasyuk
Copy link
Contributor

Fixes #49223

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label May 27, 2022
@bradennapier
Copy link

That was quick! Thanks!

@DanielRosenwasser
Copy link
Member

@typescript-bot cherry-pick this to release-4.7

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 1, 2022

Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into release-4.7 on this PR at 1394d80. You can monitor the build here.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Jun 1, 2022
Component commits:
9b919ff fix(49223): handle ExpressionWithTypeArguments nodes in isExpressionNode

1394d80 Update src/compiler/utilities.ts
@typescript-bot
Copy link
Collaborator

Hey @DanielRosenwasser, I've opened #49346 for you.

@DanielRosenwasser
Copy link
Member

Ugh, sorry. Would you be able to accept baselines?

@DanielRosenwasser
Copy link
Member

Doing this pretty much wrecks every .types baseline so that something like

class ContextMenu extends EventManager {
  // ...
}

has the following diff

  >ContextMenu : ContextMenu
- >EventManager : EventManager
+ >EventManager : typeof EventManager
+ >EventManager : typeof EventManager

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jun 2, 2022

It also breaks how find-all-refs seems to work.

  // === /tests/cases/fourslash/findAllRefsForStaticInstanceMethodInheritance.ts ===
  // class X{
  // 	/*FIND ALL REFS*/[|foo|](): void{}
  // }
  // 
  // class Y extends X{
  // 	static foo(): void{}
  // }
  // 
  // class Z extends Y{
  // 	static foo(): void{}
- // 	[|foo|](): void{}
+ // 	foo(): void{}
  // }
  // 
  // const x = new X();
  // const y = new Y();
  // const z = new Z();
  // x.[|foo|]();
  // y.[|foo|]();
- // z.[|foo|]();
+ // z.foo();
  // Y.foo();
  // Z.foo();

@ahejlsberg @RyanCavanaugh @andrewbranch to be honest, I am considering putting this into a 4.7.4 change unless others can help guide this PR today.

@DanielRosenwasser
Copy link
Member

Unless we just revert my change at 1394d80 and go with @a-tarasyuk's original change.

@ahejlsberg
Copy link
Member

I would go with return !isHeritageClause(node.parent); instead of the original change (since the other part of the expression is redundant).

@DanielRosenwasser
Copy link
Member

Everything seems to pass with just that.

@DanielRosenwasser
Copy link
Member

@typescript-bot cherry-pick this to release-4.7

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 3, 2022

Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into release-4.7 on this PR at 3ed5d0a. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @DanielRosenwasser, 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.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Jun 3, 2022
Component commits:
9b919ff fix(49223): handle ExpressionWithTypeArguments nodes in isExpressionNode

1394d80 Update src/compiler/utilities.ts

3ed5d0a Just use `!isHeritageClause(node.parent)`.
@DanielRosenwasser DanielRosenwasser merged commit 9c8e6b5 into microsoft:main Jun 3, 2022
DanielRosenwasser added a commit that referenced this pull request Jun 3, 2022
… returns an error any type (#49284)

* fix(49223): handle ExpressionWithTypeArguments nodes in isExpressionNode

* Update src/compiler/utilities.ts

* Just use `!isHeritageClause(node.parent)`.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
DanielRosenwasser added a commit that referenced this pull request Jun 3, 2022
… returns an error any type (#49284) (#49369)

* fix(49223): handle ExpressionWithTypeArguments nodes in isExpressionNode

* Update src/compiler/utilities.ts

* Just use `!isHeritageClause(node.parent)`.

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

checker.getTypeAtLocation for ExpressionWithTypeArguments returns an error any type
6 participants