Skip to content

[Inline Class] The analyzer doesn't emit any error for overriding members inherited from Object. #52285

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

Closed
Cat-sushi opened this issue May 5, 2023 · 2 comments
Labels
feature-extension-types Implementation of the extension type feature legacy-area-analyzer Use area-devexp instead.

Comments

@Cat-sushi
Copy link

Cat-sushi commented May 5, 2023

For the code below, the analyzer doesn't emit any error, but the compiler does.
This is also true for hashCode and runtimeType.

DartPad Based on Flutter 3.11.0-0.0.pre Dart SDK 3.1.0-63.0.dev

inline class Id {
  Id(int id) : _id = id;
  final int _id;
  @override
  String toString() => '[$_id]';
}
Error compiling to JavaScript:
Info: Compiling with sound null safety.
lib/main.dart:5:10:
Error: This extension member conflicts with Object member 'toString'.
  String toString() => '[$_id]';
         ^^^^^^^^
Error: Compilation failed.
@lrhn lrhn added legacy-area-analyzer Use area-devexp instead. feature-extension-types Implementation of the extension type feature labels May 6, 2023
@scheglov
Copy link
Contributor

scheglov commented May 6, 2023

The analyzer does not support inline classes at all, at least currently.

@bwilkerson
Copy link
Member

You can watch #49732 to see when this support is started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-extension-types Implementation of the extension type feature legacy-area-analyzer Use area-devexp instead.
Projects
None yet
Development

No branches or pull requests

4 participants