Skip to content

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

Closed
@leafpetersen

Description

@leafpetersen

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);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @leafpetersen

      Issue actions

        Analyzer inference fails on recursive call of generic method in certain circumstances · Issue #30980 · dart-lang/sdk