Skip to content

Commit 2acdf23

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

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/linter/analyzer_use_new_elements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ lib/src/rules/avoid_js_rounded_ints.dart
2828
lib/src/rules/avoid_multiple_declarations_per_line.dart
2929
lib/src/rules/avoid_print.dart
3030
lib/src/rules/avoid_private_typedef_functions.dart
31+
lib/src/rules/avoid_redundant_argument_values.dart
3132
lib/src/rules/avoid_relative_lib_imports.dart
3233
lib/src/rules/avoid_return_types_on_setters.dart
3334
lib/src/rules/avoid_returning_null.dart
@@ -169,6 +170,7 @@ lib/src/rules/unnecessary_library_directive.dart
169170
lib/src/rules/unnecessary_library_name.dart
170171
lib/src/rules/unnecessary_new.dart
171172
lib/src/rules/unnecessary_null_aware_assignments.dart
173+
lib/src/rules/unnecessary_null_checks.dart
172174
lib/src/rules/unnecessary_null_in_if_null_operators.dart
173175
lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart
174176
lib/src/rules/unnecessary_parenthesis.dart

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ DartType? getExpectedType(PostfixExpression node) {
118118
} else if (grandParent is MethodInvocation) {
119119
var targetType = grandParent.realTarget?.staticType;
120120
if (targetType is InterfaceType) {
121-
var targetClass = targetType.element;
121+
var targetClass = targetType.element3;
122122

123-
if (targetClass.library.isDartAsync &&
123+
if (targetClass.library2.isDartAsync &&
124124
targetClass.name == 'Completer' &&
125125
grandParent.methodName.name == 'complete') {
126126
return null;

0 commit comments

Comments
 (0)