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

NNBD: Dart does not throw compile error when declare incorrectly super bounded to non-null Object variable. #42429

Closed
iarkh opened this issue Jun 22, 2020 · 2 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@iarkh
Copy link
Contributor

iarkh commented Jun 22, 2020

Dart VM version: 2.9.0-16.0.dev (dev) (Tue Jun 16 10:35:10 2020 +0200) on "windows_x64"

Here is a source code example:

class A<T extends A<T>> {}

main() {
  A<Object?> a1;
  A<Object>  a2;

  A<A<Object?>> a3;
  A<A<Object>>  a4;
}

Dart passes with this with nnbd enabled.

Object is not a top type with null-safety enabled, so actually dart should throw a compile error for a2 and a4 here.

See also Issue #42415.

@lrhn lrhn added area-front-end Use area-front-end for front end / CFE / kernel format related issues. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jun 22, 2020
@lrhn
Copy link
Member

lrhn commented Jun 22, 2020

Correct, Object is no longer a top type, so it isn't allowed as a type argument in super-bounded types.

@johnniwinther
Copy link
Member

Likely related to #41684

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 type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants