Skip to content

Implement ImplicitCallTearoff AstNode class in analyzer #47443

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

Closed
srawlins opened this issue Oct 12, 2021 · 1 comment
Closed

Implement ImplicitCallTearoff AstNode class in analyzer #47443

srawlins opened this issue Oct 12, 2021 · 1 comment
Assignees
Labels
dart-model-analyzer-spec Issues with the analyzer's implementation of the language spec legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on

Comments

@srawlins
Copy link
Member

Given the following code:

class C {
  void call(int p) {}
}
class D {}
extension on D {
  void call(int p) {}
}
void foo(C c, D d) {
  void Function(int) f1 = c;
  void Function(String) f2 = c; // Correctly reports an error
  void Function(int) g1 = d;
  void Function(String) g2 = d; // Should report an error
}

The analyzer currently has a rudimentary mechanism for type-checking these assignments, which cannot properly check g2, a call tear-off of an extension method, call. To properly handle this case, as well as implicit type-instantiated call method tear-offs, the analyzer needs to insert tear-off nodes for implicit call tear-offs.

Needed for #47366, #46020. Also related: #32864, #45936

@srawlins srawlins added legacy-area-analyzer Use area-devexp instead. dart-model-analyzer-spec Issues with the analyzer's implementation of the language spec labels Oct 12, 2021
@srawlins srawlins self-assigned this Oct 12, 2021
copybara-service bot pushed a commit that referenced this issue Oct 12, 2021
Bug: #47443

Change-Id: I70f9fda3256f963b805ba379d79f706010f0c2fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216269
Commit-Queue: Samuel Rawlins <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
@jcollins-g jcollins-g added the P2 A bug or feature request we're likely to work on label Oct 13, 2021
@srawlins
Copy link
Member Author

srawlins commented Nov 1, 2021

Done

@srawlins srawlins closed this as completed Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dart-model-analyzer-spec Issues with the analyzer's implementation of the language spec legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

2 participants