Skip to content

Commit

Permalink
[wildcards] avoid_unused_constructor_parameters wildcard test
Browse files Browse the repository at this point in the history
Test to ensure that `avoid_unused_constructor_parameters` doesn't overreport in the presence of an unused wildcard param.

(Note that underscores are ignored pre-wildcards too and this ensures that that behavior is preserved too.)

Fixes: dart-lang/linter#4995

Change-Id: I13ef73eb28cf2501ed292dd3c56c9933a8feefa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
pq authored and Commit Queue committed Jun 10, 2024
1 parent 7d7596f commit 224d19e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/linter/test/rule_test_support.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class PubPackageResolutionTest extends _ContextResolutionTest {

bool get dumpAstOnFailures => true;

List<String> get experiments => ['macros'];
List<String> get experiments => ['macros', 'wildcard-variables'];

List<String> get lintRules => _lintRules;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ class A {
class B extends A {
B(super.a, super.b);
}
''');
}

test_wildcardParam() async {
await assertNoDiagnostics(r'''
class C {
C(int _);
}
''');
}

test_wildcardParam_preWildcards() async {
await assertNoDiagnostics(r'''
// @dart = 3.4
// (pre wildcard-variables)
class C {
C(int _);
}
''');
}
}

0 comments on commit 224d19e

Please sign in to comment.