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 flattening futures incorrectly #38368

Open
fishythefish opened this issue Sep 12, 2019 · 1 comment
Open

Analyzer flattening futures incorrectly #38368

fishythefish opened this issue Sep 12, 2019 · 1 comment
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@fishythefish
Copy link
Member

class Divergent<T> implements Future<Divergent<Divergent<T>>> {
  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

void main() {
  Future<Divergent<Divergent<int>>> x = (() async => Divergent<int>())();
}

This code compiles with CFE, but analyzer complains that:

  • the return type of the closure is Divergent<int>, which isn't a Future<Divergent<Divergent<Divergent<int>>>> and
  • a value of type Future<Divergent<Divergent<Divergent<int>>>> can't be assigned to a variable of type Future<Divergent<Divergent<int>>>.

flatten(Divergent<T>) = Divergent<Divergent<T>>, so the return type of the closure should be Future<Divergent<Divergent<int>>>.

Also see #25611, #31887, #32881.

@fishythefish fishythefish added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Sep 12, 2019
@stereotype441 stereotype441 added the P2 A bug or feature request we're likely to work on label Sep 13, 2019
@stereotype441
Copy link
Member

a554c8b introduces a failing test case for this

@srawlins srawlins added the analyzer-spec Issues with the analyzer's implementation of the language spec label Jun 16, 2020
@srawlins srawlins added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants