diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f5d83a2..80a6e7c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# 1.27.0 + +- fix `avoid_redundant_argument_values` when referencing required + parameters in legacy libraries +- performance improvements for `use_late_for_private_fields_and_variables` +- new lint: `use_string_in_part_of_directives` +- fixed `use_super_parameters` false positive with repeated super + parameter references +- updated `use_late_for_private_fields_and_variables` to handle enums +- fixed `prefer_contains` false positive when start index is non-zero +- improved `noop_primitive_operations` to catch `.toString()` + in string interpolations +- updated `public_member_api_docs` to report diagnostics on extension + names (instead of bodies) +- miscellaneous documentation improvements +- (internal): `DartTypeUtilities` refactoring + # 1.26.0 - new lint: `combinators_ordering` diff --git a/lib/src/rules/avoid_redundant_argument_values.dart b/lib/src/rules/avoid_redundant_argument_values.dart index b7713367c..584268d1a 100644 --- a/lib/src/rules/avoid_redundant_argument_values.dart +++ b/lib/src/rules/avoid_redundant_argument_values.dart @@ -71,7 +71,10 @@ class _Visitor extends SimpleAstVisitor { for (var i = arguments.length - 1; i >= 0; --i) { var arg = arguments[i]; var param = arg.staticParameterElement; - if (param == null || param.hasRequired || !param.isOptional) { + if (param == null || + param.declaration.isRequired || + param.hasRequired || + !param.isOptional) { continue; } var value = param.computeConstantValue(); diff --git a/lib/src/version.dart b/lib/src/version.dart index 2a919c31d..766a2916d 100644 --- a/lib/src/version.dart +++ b/lib/src/version.dart @@ -3,4 +3,4 @@ // BSD-style license that can be found in the LICENSE file. /// Package version. Synchronized w/ pubspec.yaml. -const String version = '1.26.0'; +const String version = '1.27.0'; diff --git a/pubspec.yaml b/pubspec.yaml index de0fb2e3f..01f615d1d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: linter -version: 1.26.0 +version: 1.27.0 description: >- The implementation of the lint rules supported by the analyzer framework. diff --git a/test/rules/avoid_redundant_argument_values_test.dart b/test/rules/avoid_redundant_argument_values_test.dart index a33c21853..ad2954fe5 100644 --- a/test/rules/avoid_redundant_argument_values_test.dart +++ b/test/rules/avoid_redundant_argument_values_test.dart @@ -51,6 +51,26 @@ void g() { '''); } + /// https://github.com/dart-lang/sdk/issues/49596 + test_legacyRequired() async { + var a = newFile('$testPackageLibPath/a.dart', r''' +class Foo { + int? foo; + Foo({required this.foo}); +} +'''); + await resolveFile(a.path); + + await assertNoDiagnostics(r''' +// @dart = 2.9 +import 'a.dart'; + +void f() { + Foo(foo: null); +} +'''); + } + test_requiredNullable() async { await assertNoDiagnostics(r''' void f({required int? x}) { }