Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 2703253006: Turn off `strong_mode_down_cast_composite` warnings by default in Flutter projects.
Patch Set: Remove newline. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/workspace.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong/checker.dart
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 491b50a6703913089c0f861a7cca12038e01a1b4..b9918a0e8390f53ff9fdfe28bbe61c18ba4e3a84 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -147,13 +147,14 @@ class CodeChecker extends RecursiveAstVisitor {
final TypeProvider typeProvider;
final AnalysisErrorListener reporter;
final AnalysisOptionsImpl _options;
+ final bool _hasFlutterDependency;
_OverrideChecker _overrideChecker;
bool _failure = false;
bool _hasImplicitCasts;
CodeChecker(TypeProvider typeProvider, StrongTypeSystemImpl rules,
- AnalysisErrorListener reporter, this._options)
+ AnalysisErrorListener reporter, this._options, this._hasFlutterDependency)
: typeProvider = typeProvider,
rules = rules,
reporter = reporter {
@@ -1111,6 +1112,17 @@ class CodeChecker extends RecursiveAstVisitor {
}
}
+ // BUG(28588): The down-cast-composite warning will be turned off by
+ // default, but as a first step we're only doing this for Flutter code
+ // and we will leave it on for web projects to help with the migration
+ // to strong mode and the associate runtime type checks. Flutter projects
+ // can still turn on the warning explicitly through analysis options.
+ if (_hasFlutterDependency && downCastComposite) {
+ bool hasExplicitOption = _options.errorProcessors.any(
+ (processor) => processor.code == StrongModeCode.DOWN_CAST_COMPOSITE);
+ if (!hasExplicitOption) return;
+ }
+
var parent = expr.parent;
ErrorCode errorCode;
if (downCastComposite) {
« no previous file with comments | « pkg/analyzer/lib/src/generated/workspace.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698