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

CFE: Accept super-bounded type also when top type uses FutureOr #43053

Open
eernstg opened this issue Aug 14, 2020 · 0 comments
Open

CFE: Accept super-bounded type also when top type uses FutureOr #43053

eernstg opened this issue Aug 14, 2020 · 0 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. NNBD Issues related to NNBD Release P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented Aug 14, 2020

Consider the following program:

import 'dart:async';
class C<X extends num> {}

void main() {
  C<FutureOr<Object?>> x;
}

This program is rejected by dart (eb4cf54) as follows:

n021.dart:5:24: Error: Type argument 'FutureOr<Object?>' doesn't conform to the bound 'num' of the type variable 'X' on 'C'.
 - 'Object' is from 'dart:core'.
Try changing type arguments so that they conform to the bounds.
  C<FutureOr<Object?>> x;
                       ^
n021.dart:2:9: Context: This is the type variable whose bound isn't conformed to.
class C<X extends num> {}
        ^

However, C<FutureOr<Object?>> is correctly super-bounded because FutureOr<Object?> is a top type. The error seems to occur only with FutureOr, so it's probably a matter of checking for all top types rather than just some of them when it is considered whether this could be a super-bounded type.

@eernstg eernstg added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) area-front-end Use area-front-end for front end / CFE / kernel format related issues. NNBD Issues related to NNBD Release labels Aug 14, 2020
@johnniwinther johnniwinther added the P3 A lower priority bug or feature request label Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. NNBD Issues related to NNBD Release 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

2 participants