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] No error produced for not-implementing-final-classes through legacy libraries. #52115

Closed
kallentu opened this issue Apr 20, 2023 · 2 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@kallentu
Copy link
Member

Example:

// old_lib.dart
// @dart=2.19

// MapEntry is `final`, but can be implemented due to SDK exception.
class M implements MapEntry<int, int> {
  int get key => 0;
  int get value => 1;
  String toString() => "Bad";
}

and

// new_lib.dart
// @dart=3.0

import "old_lib.dart";

class N implements M {
  int get key => 0;
  int get value => 1;
  String toString() => "Evil";
}

void main() {
  print(N()); // Evil.
}

This gives no errors, or warnings, in the front end.

Analyzer issue for this: #52078

@kallentu kallentu 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. labels Apr 20, 2023
@kallentu kallentu self-assigned this Apr 20, 2023
copybara-service bot pushed a commit that referenced this issue May 10, 2023
… class in the core libraries.

This behaviour should only happen when a post-feature library implements
a pre-feature library declaration that has a final/base core library class as a super declaration.

Bug: #52115
Change-Id: If42129ba3ba7e337cc6ffc21604c6d0f2976344c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301503
Reviewed-by: Nate Bosch <[email protected]>
Commit-Queue: Kallen Tu <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
@kallentu
Copy link
Member Author

@sgrekhov versioning_A03_t02.dart should be fixed from this being fixed.

@sgrekhov
Copy link
Contributor

Confirmed. versioning_A03_t02.dart works on CFE now. Thank you!

copybara-service bot pushed a commit that referenced this issue May 22, 2023
…f a core lib declaration through a 2.19 library and a 3.0 library.

Cherry pick for the following behaviour from 3 different CLs.

Error produced when a post-feature library implements
a pre-feature library declaration that has a final/base core library class as a super declaration.

Error produced when a post-feature library subtypes (but not implements)
a pre-feature library declaration that has a final/base core library class as a super declaration.

Fixes: #52406

Bug: #52315, #52115, #52078
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/302365
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/301503
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/300861
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/301442
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/300880
Change-Id: I2a192a157d417c1de7656aa624d3b10d9e67626e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302851
Commit-Queue: Kallen Tu <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
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. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants