[wildcards] avoid_unused_constructor_parameters wildcard test

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: https://github.com/dart-lang/linter/issues/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>
This commit is contained in:
pq 2024-06-10 15:00:00 +00:00 committed by Commit Queue
parent 7d7596fe3a
commit 224d19ec06
2 changed files with 20 additions and 1 deletions

View file

@ -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;

View file

@ -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 _);
}
''');
}
}