wildcard variable test for unused_result validation

We talked about migrating these tests to using language version overrides but I lost the plot over the weekend :).

Can you suggest how I'd modify this? How would I opt into this feature with a language version override if there is not version in which we have it enabled?


Change-Id: Ie0411d8f24e7468692a99cc2bc645bdbd3d5a500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369420
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
pq 2024-06-03 21:45:12 +00:00 committed by Commit Queue
parent cba9543c70
commit a86ec25ffb

View file

@ -746,6 +746,39 @@ void main() {
''');
}
test_method_result_assigned_wildcard_unused() async {
await assertNoErrorsInCode(r'''
import 'package:meta/meta.dart';
class A {
@useResult
int foo() => 0;
}
void main() {
var _ = A().foo();
}
''');
}
test_method_result_assigned_wildcard_unused_preWildcards() async {
await assertNoErrorsInCode(r'''
// @dart = 3.4
// (pre wildcard-variables)
import 'package:meta/meta.dart';
class A {
@useResult
int foo() => 0;
}
void main() {
var _ = A().foo();
}
''');
}
test_method_result_binaryExpression() async {
await assertNoErrorsInCode('''
import 'package:meta/meta.dart';