commit | 47f69b1612a267e2174af8bc2a1f6adb24f993d5 | [log] [tgz] |
---|---|---|
author | pq <pquitslund@google.com> | Mon Oct 14 21:30:27 2024 +0000 |
committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Oct 14 21:30:27 2024 +0000 |
tree | 219a7a31a482b770399ef77a2527abdc3f8cabc3 | |
parent | d0afa40d20b051b9b726e030da914d6808ea29f9 [diff] |
[element model] migrate `prefer_constructors_over_static_methods` Bug: https://github.com/dart-lang/linter/issues/5099 Change-Id: I8b165b87ac6159d3df2a7cd7f0a804b619c7eeb6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390022 Commit-Queue: Phil Quitslund <pquitslund@google.com> Auto-Submit: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart b/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart index 642a3340..85c0008 100644 --- a/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart +++ b/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart
@@ -80,10 +80,12 @@ extension on AstNode? { InterfaceType? typeToCheckOrNull() => switch (this) { - ExtensionTypeDeclaration e => - e.typeParameters == null ? e.declaredElement?.thisType : null, - ClassDeclaration c => - c.typeParameters == null ? c.declaredElement?.thisType : null, + ExtensionTypeDeclaration e => e.typeParameters == null + ? e.declaredFragment?.element.thisType + : null, + ClassDeclaration c => c.typeParameters == null + ? c.declaredFragment?.element.thisType + : null, _ => null }; }