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

Analyzer inference fails on recursive call of generic method in certain circumstances #30980

Closed
leafpetersen opened this issue Oct 3, 2017 · 0 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. language-strong-mode-polish

Comments

@leafpetersen
Copy link
Member

In the following code, the analyzer type inference fails and produces dynamic for the recursive call on line 4 only. The non-recursive case succeeds.

void _mergeSort2<T>(List<T> list, int compare(T a, T b), List<T> target) {}

void _mergeSort<T>(List<T> list, int compare(T a, T b), List<T> target) {
  _mergeSort(list, compare, target); // Error
  _mergeSort(list, compare, list);
  _mergeSort(target, compare, target);
  _mergeSort(target, compare, list);

  _mergeSort2(list, compare, target);
  _mergeSort2(list, compare, list);
  _mergeSort2(target, compare, target);
  _mergeSort2(target, compare, list);
}
@leafpetersen leafpetersen added analyzer-strong-mode area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. language-strong-mode-polish labels Oct 3, 2017
@leafpetersen leafpetersen self-assigned this Oct 16, 2017
@whesse whesse closed this as completed in dd17a4c Oct 19, 2017
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. language-strong-mode-polish
Projects
None yet
Development

No branches or pull requests

1 participant