Skip to content

Commit

Permalink
1.27.0 (#3576)
Browse files Browse the repository at this point in the history
* 1.27.0

* Insert reasoning for `avoid_function_literals_in_foreach_calls` lint (#3545)

* Update avoid_function_literals_in_foreach_calls.dart

* Second attempt

* Add a the to make for betterer english

* convert unnecessary `.from`s to `.of`s (#3577)

* deflake `avoid_redundant_argument_values`

* ++

Co-authored-by: Brett Morgan <[email protected]>
  • Loading branch information
pq and domesticmouse authored Aug 8, 2022
1 parent b677397 commit 075a3b6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
5 changes: 4 additions & 1 deletion lib/src/rules/avoid_redundant_argument_values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
20 changes: 20 additions & 0 deletions test/rules/avoid_redundant_argument_values_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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}) { }
Expand Down

0 comments on commit 075a3b6

Please sign in to comment.