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

Unified Diff: pkg/analyzer/lib/src/generated/static_type_analyzer.dart

Issue 2043173002: Fix LUB computation in face of errors in code (issue 26631) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | pkg/analyzer/test/generated/static_type_analyzer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index fefd3ebca75ef140371cec76fc2601ee7985cce1..8699787fdab54f78fc5c6451af5e60a80bf3d27c 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -662,8 +662,11 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
// elements
if (node.elements.isNotEmpty) {
// Infer the list type from the arguments.
- DartType staticType =
- node.elements.map((e) => e.staticType).reduce(_leastUpperBound);
+ Iterable<DartType> types = node.elements.map((e) => e.staticType).where((t) => t != null);
+ if (types.isEmpty) {
+ return null;
+ }
+ DartType staticType = types.reduce(_leastUpperBound);
if (staticType.isBottom) {
staticType = _dynamicType;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/static_type_analyzer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698