linter
linter copied to clipboard
unnecessary_overrides does not work for generic methods and null safety mix
The lint is not reported for:
class A<T> {
T foo() {
throw 42;
}
}
class B extends A<int> {
@override
int foo() => super.foo();
}
This is a failing test from analysis server.
Future<void> test_method_nullSafety_optIn_fromOptOut() async {
createAnalysisOptionsFile(
experiments: ['non-nullable'],
lints: [lintCode],
);
newFile('/home/test/lib/a.dart', content: r'''
class A {
int foo() => 0;
}
''');
await resolveTestUnit('''
// @dart = 2.7
import 'a.dart';
class B extends A {
@override
int foo() => super.foo();
}
''');
await assertHasFix('''
// @dart = 2.7
import 'a.dart';
class B extends A {
}
''');
}
Thanks! I've got this reproduced and see the problem. 👍