This repository was archived by the owner on Nov 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -88,10 +88,10 @@ class _Visitor extends SimpleAstVisitor<void> {
88
88
@override
89
89
void visitParenthesizedPattern (ParenthesizedPattern node) {
90
90
//https://github.com/dart-lang/linter/issues/4062
91
- // var parent = node.parent;
92
- // if (parent is DartPattern && parent.precedence < node.precedence) {
93
- // rule.reportLint(node);
94
- // }
91
+ var parent = node.parent;
92
+ if (parent is DartPattern && parent.precedence < node.pattern .precedence) {
93
+ rule.reportLint (node);
94
+ }
95
95
}
96
96
97
97
@override
Original file line number Diff line number Diff line change @@ -36,26 +36,27 @@ void f(int i) {
36
36
}
37
37
38
38
///https://github.com/dart-lang/linter/issues/4062
39
- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/51426' )
39
+ //@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/51426')
40
+ @soloTest
40
41
test_parenthesized_listPattern () async {
41
42
await assertDiagnostics (r'''
42
- void f(Object x ) {
43
- if (x case [(<3), 12]) return;
43
+ void f(List<int> l ) {
44
+ if (l case [(<3), 12]) return;
44
45
}
45
46
''' , [
46
47
lint (41 , 11 ),
47
48
]);
48
49
}
49
50
50
- ///https://github.com/dart-lang/linter/issues/4062
51
- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/51426' )
51
+ @soloTest
52
52
test_parenthesized_relationalPattern () async {
53
53
await assertDiagnostics (r'''
54
- void f(int x ) {
55
- if (x case (<3) || (>5)) return;
54
+ void f(List< int> l ) {
55
+ if (l case [ (<3) || (>5)] ) return;
56
56
}
57
57
''' , [
58
- lint (41 , 11 ),
58
+ lint (36 , 4 ),
59
+ lint (44 , 4 ),
59
60
]);
60
61
}
61
62
}
You can’t perform that action at this time.
0 commit comments