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] Apparently no checks are performed for member accesses on an object of type X extends FutureOr<X> #49555

Open
eernstg opened this issue Jul 28, 2022 · 0 comments
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. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented Jul 28, 2022

Consider the following program:

import 'dart:async';

void f<X extends FutureOr<X>>(X x) {
  x.asStream(); // A member from the interface of `Future`.
  x.whatever; // A non-member of all classes nearby.
}

void main() {}

This program is accepted by the analyzer (dart analyze from 2.19.0-32.0.dev) with no issues. It looks like the bound X extends FutureOr<X> creates confusion about how to check expressions whose type involves X.

The interface of X should be taken from the bound, and the interface of FutureOr<T> is the interface of Object, for any T.

@eernstg eernstg added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-spec Issues with the analyzer's implementation of the language spec labels Jul 28, 2022
@eernstg eernstg changed the title [analyzer] Normal checks [analyzer] Apparently no checks are performed for member accesses on an object of type X extends FutureOr<X> Jul 28, 2022
@keertip keertip added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P2 A bug or feature request we're likely to work on labels Aug 1, 2022
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. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants