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(language-service): Function alias should be callable #33782

Closed
wants to merge 1 commit into from

Conversation

@kyliau
Copy link
Member

kyliau commented Nov 13, 2019

This commit fixes a long standing bug whereby a template variable that
gets initialized to a class method gets resolved to the Any type, thus
when it is called the language service produces error "Member X is not
callable".

PR closes #16643
PR closes angular/vscode-ng-language-service#234

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@kyliau kyliau requested review from angular/fw-compiler as code owners Nov 13, 2019
@googlebot googlebot added the cla: yes label Nov 13, 2019
@kyliau kyliau force-pushed the kyliau:member-not-callable branch from 6cabd9c to e69add7 Nov 13, 2019
@ngbot ngbot bot added this to the needsTriage milestone Nov 13, 2019
@kyliau kyliau changed the title Member not callable fix(language-service): Function alias should be callable Nov 13, 2019
@ayazhafiz ayazhafiz self-requested a review Nov 13, 2019
Copy link
Member

ayazhafiz left a comment

What happens in this case? Is the called variable treated as an any that is callable or as the type of the method it references?

@kyliau

This comment has been minimized.

Copy link
Member Author

kyliau commented Nov 13, 2019

What happens in this case? Is the called variable treated as an any that is callable or as the type of the method it references?

It resolves to the type of the method it references.

This PR fixes the happy path. We need to also fix the other case - if type resolution fails, we should produce diagnostics instead of defaulting to the Any type. This means we'll have to match the signature of the caller and the receiver. Will probably do it in another PR.

@ayazhafiz ayazhafiz requested a review from alxhub Nov 13, 2019
This commit fixes a long standing bug whereby a template variable that
gets initialized to a class method gets resolved to the Any type, thus
when it is called the language service produces error "Member X is not
callable".

PR closes #16643
PR closes angular/vscode-ng-language-service#234
@kyliau kyliau force-pushed the kyliau:member-not-callable branch from e69add7 to b7d0a49 Nov 14, 2019
@kyliau kyliau removed request for angular/fw-compiler and alxhub Nov 14, 2019
@kyliau

This comment has been minimized.

Copy link
Member Author

kyliau commented Nov 15, 2019

caretaker: I am a member of tools-language-service

alxhub added a commit that referenced this pull request Nov 15, 2019
This commit fixes a long standing bug whereby a template variable that
gets initialized to a class method gets resolved to the Any type, thus
when it is called the language service produces error "Member X is not
callable".

PR closes #16643
PR closes angular/vscode-ng-language-service#234

PR Close #33782
@alxhub alxhub closed this in 1d3aae6 Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.