Skip to content

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

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
leafpetersen opened this issue Oct 3, 2017 · 0 comments
Assignees

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant