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 doesn't reject bounds that contain raw types with non-simple bounds #33208

Closed
chloestefantsova opened this issue May 23, 2018 · 3 comments
Closed
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error P2 A bug or feature request we're likely to work on
Milestone

Comments

@chloestefantsova
Copy link
Contributor

CFE should emit a compile-time error in the described case as specified in this section of the feature spec.

Currently, the following program compiles without any warnings or errors, and it should be rejected by the compiler with an appropriate compile-time error message:

class A<X extends Comparable<X>> {}

class B<Y extends A> {}

main() {
  B b;
}

The following program, that also should be rejected because of the use of generic types with non-simple bounds, makes the compiler to crash:

class C<Z extends C> {}

main() {
  C c;
}
@chloestefantsova chloestefantsova added P2 A bug or feature request we're likely to work on area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels May 23, 2018
@chloestefantsova chloestefantsova added this to the Dart2Stable milestone May 23, 2018
@chloestefantsova chloestefantsova self-assigned this May 23, 2018
@chloestefantsova
Copy link
Contributor Author

The issue is being worked on in CL 41264.

@askeksa-google
Copy link

Fixing this should also fix #31810, #32416 and #32417.

@dgrove
Copy link
Contributor

dgrove commented Jun 15, 2018

With -dev.59, the first example:

cat ~/tmp/dart2stable/33208a.dart
class A<X extends Comparable> {}

class B {}

main() {
B b;
}
dgrove@dgrove:~$ /usr/lib/google-dartlang/bin/dartanalyzer --preview-dart-2 ~/tmp/dart2stable/33208a.dart
Analyzing /usr/local/google/home/dgrove/tmp/dart2stable/33208a.dart...
error • Type parameter bound types must be instantiated at tmp/dart2stable/33208a.dart:3:19 • strong_mode_not_instantiated_bound
hint • The value of the local variable 'b' isn't used at tmp/dart2stable/33208a.dart:6:5 • unused_local_variable
1 error and 1 hint found.

cat ~/tmp/dart2stable/33208b.dart
class C {}

main() {
C c;
}
dgrove@dgrove:~$ /usr/lib/google-dartlang/bin/dartanalyzer --preview-dart-2 ~/tmp/dart2stable/33208b.dart
Analyzing /usr/local/google/home/dgrove/tmp/dart2stable/33208b.dart...
error • Type parameter bound types must be instantiated at tmp/dart2stable/33208b.dart:1:19 • strong_mode_not_instantiated_bound
hint • The value of the local variable 'c' isn't used at tmp/dart2stable/33208b.dart:4:5 • unused_local_variable
1 error and 1 hint found.

@dgrove dgrove modified the milestones: Dart2Stable, Dart2.1 Jun 18, 2018
@kmillikin kmillikin moved this from In Progress to Done in Dart Front End Aug 1, 2018
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. front-end-missing-error P2 A bug or feature request we're likely to work on
Projects
Development

No branches or pull requests

3 participants