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

Generic tearoff not working #25619

Closed
vsmenon opened this issue Jan 29, 2016 · 3 comments
Closed

Generic tearoff not working #25619

vsmenon opened this issue Jan 29, 2016 · 3 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures

Comments

@vsmenon
Copy link
Member

vsmenon commented Jan 29, 2016

We're not getting the right type on math.max below:

import 'dart:math' as math;
main() {
  takeFn(math.max/*<int>*/);
}
void takeFn(int fn(int a, int b)) {}

We're getting the following errors:

[error] Type check failed: math.max (<T extends num>(T, T) → T) is not of type (int, int) → int (/Users/vsm/git/dev_compiler/foo.dart, line 7, col 10)
[warning] The argument type '(T, T) → T' cannot be assigned to the parameter type '(int, int) → int' (/Users/vsm/git/dev_compiler/foo.dart, line 7, col 10)
1 error and 1 warning found.
@vsmenon vsmenon added P1 A high priority bug; for example, a single project is unusable or has many test failures area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-strong-mode labels Jan 29, 2016
@vsmenon vsmenon self-assigned this Jan 29, 2016
@vsmenon
Copy link
Member Author

vsmenon commented Jan 29, 2016

@jmesserly Are we missing logic on tearoffs?

@jmesserly
Copy link

yeah this is basically the unimplemented case in #25175 ... we chatted about it, might be worth adding the downward inference here even though we don't support explicit instantiation yet.

The workaround would be: (x, y) => max(x, y) then inference should figure it out.

@vsmenon vsmenon assigned jmesserly and unassigned vsmenon Jan 29, 2016
@jmesserly
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

2 participants