From b09dd47d3867b4261475752486615e8bb2ede879 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Fri, 10 Jul 2020 16:19:07 +0000 Subject: [PATCH] Enforce prefer_typing_uninitialized_variables lint. R=brianwilkerson@google.com Change-Id: Icfe4a24a6e69ab08f4743502ae88f94ab9cd8c8a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153951 Reviewed-by: Brian Wilkerson Commit-Queue: Konstantin Shcheglov --- pkg/analyzer/analysis_options.yaml | 1 + pkg/analyzer/lib/src/dart/analysis/driver.dart | 2 +- pkg/analyzer/lib/src/error/best_practices_verifier.dart | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/analyzer/analysis_options.yaml b/pkg/analyzer/analysis_options.yaml index 89a3db64244c..24ce13d4b8f7 100644 --- a/pkg/analyzer/analysis_options.yaml +++ b/pkg/analyzer/analysis_options.yaml @@ -18,5 +18,6 @@ linter: rules: - avoid_unused_constructor_parameters - empty_statements + - prefer_typing_uninitialized_variables - unnecessary_brace_in_string_interps - unnecessary_parenthesis diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart index d52a6e1fd571..f2844c6755f6 100644 --- a/pkg/analyzer/lib/src/dart/analysis/driver.dart +++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart @@ -2278,7 +2278,7 @@ class _DiscoverAvailableFilesTask { /// Information about an exception and its context. class _ExceptionState { - final exception; + final Object exception; final StackTrace stackTrace; /// The key under which the context of the exception was stored, or `null` diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart index 60696721c6e6..38391220eacb 100644 --- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart +++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart @@ -1526,9 +1526,9 @@ class _InvalidAccessVerifier { } AstNode grandparent = parent?.parent; - var element; - var name; - var node; + Element element; + String name; + AstNode node; if (grandparent is ConstructorName) { element = grandparent.staticElement;