Skip to content

Commit 5a13c08

Browse files
pqCommit Queue
authored andcommitted
[element model] fix unnecessary_parenthesis
Bug: https://github.com/dart-lang/linter/issues/5099 Change-Id: I6a28a2dfd6d8be5db6bded84685a4691068d2873 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388981 Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Phil Quitslund <[email protected]> Auto-Submit: Phil Quitslund <[email protected]>
1 parent f4a09ee commit 5a13c08

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/linter/analyzer_use_new_elements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ lib/src/rules/unnecessary_library_name.dart
144144
lib/src/rules/unnecessary_new.dart
145145
lib/src/rules/unnecessary_null_aware_assignments.dart
146146
lib/src/rules/unnecessary_null_in_if_null_operators.dart
147+
lib/src/rules/unnecessary_parenthesis.dart
147148
lib/src/rules/unnecessary_raw_strings.dart
148149
lib/src/rules/unnecessary_statements.dart
149150
lib/src/rules/unnecessary_string_escapes.dart

pkg/linter/lib/src/rules/unnecessary_parenthesis.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ class _Visitor extends SimpleAstVisitor<void> {
6868
// Don't over-report on records missing trailing commas.
6969
// `(int,) r = (3);` is OK.
7070
if (parent is VariableDeclaration &&
71-
parent.declaredElement?.type is RecordType) {
71+
parent.declaredElement2?.type is RecordType) {
7272
if (expression is! RecordLiteral) return;
7373
}
7474
// `g((3)); => g((int,) i) { }` is OK.
7575
if (parent is ArgumentList) {
76-
var element = node.staticParameterElement;
76+
var element = node.correspondingParameter;
7777
if (element?.type is RecordType && node.expression is! RecordLiteral) {
7878
return;
7979
}
8080
}
8181
// `g(i: (3)); => g({required (int,) i}) { }` is OK.
8282
if (parent is NamedExpression &&
83-
parent.staticParameterElement?.type is RecordType) {
83+
parent.correspondingParameter?.type is RecordType) {
8484
if (expression is! RecordLiteral) return;
8585
}
8686

0 commit comments

Comments
 (0)