sdk
sdk copied to clipboard
No error in analyzer in case of inherited members conflict
The followinng code produces an error in CFE but no issues in analyzer
class V1 {
int m() => 42;
}
class V2 {
String get m => "42";
}
class V implements V1, V2 {
String get m => "V"; // Error: Can't declare a member that conflicts with an inherited one.
}
main() {
print(V);
}
Tested on Dart SDK version: 3.1.0-155.0.dev (dev) (Fri May 26 19:56:47 2023 -0700) on "windows_x64"
cc @eernstg to confirm which tool is right here
The analyzer is wrong.
@scheglov Just FYI
Right, the relationship between V1.m and V.m is not a correct override, and this is a compile-time error. It is enough that one is a getter and the other is a method, there is no way the return/parameter types can be fiddled such that this is not an error.
Still no error from analyzer.