Skip to content

Commit a86ec25

Browse files
pqCommit Queue
authored and
Commit Queue
committed
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 <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent cba9543 commit a86ec25

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

pkg/analyzer/test/src/diagnostics/unused_result_test.dart

+33
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,39 @@ void main() {
746746
''');
747747
}
748748

749+
test_method_result_assigned_wildcard_unused() async {
750+
await assertNoErrorsInCode(r'''
751+
import 'package:meta/meta.dart';
752+
753+
class A {
754+
@useResult
755+
int foo() => 0;
756+
}
757+
758+
void main() {
759+
var _ = A().foo();
760+
}
761+
''');
762+
}
763+
764+
test_method_result_assigned_wildcard_unused_preWildcards() async {
765+
await assertNoErrorsInCode(r'''
766+
// @dart = 3.4
767+
// (pre wildcard-variables)
768+
769+
import 'package:meta/meta.dart';
770+
771+
class A {
772+
@useResult
773+
int foo() => 0;
774+
}
775+
776+
void main() {
777+
var _ = A().foo();
778+
}
779+
''');
780+
}
781+
749782
test_method_result_binaryExpression() async {
750783
await assertNoErrorsInCode('''
751784
import 'package:meta/meta.dart';

0 commit comments

Comments
 (0)